Overview
Comment:Trim \n sillyness from escaped strings
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8b94f6cb84fa085a6dc7def1bae8bb93e3cf4823
User & Date: matt on 2016-09-21 04:31:57
Other Links: manifest | tags
Context
2016-09-21
04:34
Oops. Use the string result. check-in: 8c0e13bea5 user: matt tags: trunk
04:31
Trim \n sillyness from escaped strings check-in: 8b94f6cb84 user: matt tags: trunk
2016-09-19
06:05
Oops. missed setup.scm check-in: 4b5ced8c71 user: matt tags: trunk
Changes

Modified html-filter.scm from [11f89f1bff] to [14891b2741].

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
	 (rem    (caddr tmp)))
    res))

(define (s:html-filter->string input-text allowed-tags)
  (let ((ostr (open-output-string)))
    ;;; (s:output-new ostr (s:html-filter input-text allowed-tags))
    (s:output-new ostr (car (eval (s:html-filter input-text allowed-tags))))
    (get-output-string ostr)))
	
;;     (if (null? rem)
;; 	res '())
;; 	(s:toks->stml (if (list? res) res '()) #f rem allowed-tags))))

(define (s:str->toks str)
  (apply append (map (lambda (tok)







|







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
	 (rem    (caddr tmp)))
    res))

(define (s:html-filter->string input-text allowed-tags)
  (let ((ostr (open-output-string)))
    ;;; (s:output-new ostr (s:html-filter input-text allowed-tags))
    (s:output-new ostr (car (eval (s:html-filter input-text allowed-tags))))
    (string-chomp (get-output-string ostr)))) ;; don't need the linefeed, could stop adding it ...
	
;;     (if (null? rem)
;; 	res '())
;; 	(s:toks->stml (if (list? res) res '()) #f rem allowed-tags))))

(define (s:str->toks str)
  (apply append (map (lambda (tok)

Modified session.scm from [fc54694d2f] to [50b203d5ca].

725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
    (session:get-param-from params key)))

;; This one will get the first value found regardless of form
;; param: (dtype [tag1 tag2 ...])
;; dtype:
;;    'raw     : do no conversion
;;    'number  : convert to number, return #f if fails
;;    'escaped : use html-escape to protect the input
;;
(define (session:get-input self key params)
  (let* ((dtype    (if (null? params)
		       'escaped
		       (car params)))
	 (tags    (if (null? params)
		      '()







|







725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
    (session:get-param-from params key)))

;; This one will get the first value found regardless of form
;; param: (dtype [tag1 tag2 ...])
;; dtype:
;;    'raw     : do no conversion
;;    'number  : convert to number, return #f if fails
;;    'escaped : use html-escape to protect the input -- this is the default
;;
(define (session:get-input self key params)
  (let* ((dtype    (if (null? params)
		       'escaped
		       (car params)))
	 (tags    (if (null? params)
		      '()
748
749
750
751
752
753
754

755

756
757
758
759
760
761
762
				#f))
			  (begin
			    (session:log self "ERROR: bad key " key)
			    #f)))))
    (case dtype
      ((raw)     res)
      ((number)  (if (string? res)(string->number res) #f))

      ((escaped) (s:html-filter res tags)) 

      (else      (if (string? res)
		     (s:html-filter res '())
		     res)))))

;; This one will get the first value found regardless of form
(define (session:get-input-keys self)
  (let* ((formdat (sdat-get-formdat self)))







>
|
>







748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
				#f))
			  (begin
			    (session:log self "ERROR: bad key " key)
			    #f)))))
    (case dtype
      ((raw)     res)
      ((number)  (if (string? res)(string->number res) #f))
      ((escaped) (if (string? res)
		     (s:html-filter res tags)
		     res))
      (else      (if (string? res)
		     (s:html-filter res '())
		     res)))))

;; This one will get the first value found regardless of form
(define (session:get-input-keys self)
  (let* ((formdat (sdat-get-formdat self)))