Skip to content

Commit

Permalink
sxml.tools - Fix to escape attribute values
Browse files Browse the repository at this point in the history
  • Loading branch information
shirok committed Mar 25, 2024
1 parent dd540d1 commit a605e07
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
2024-03-24 Shiro Kawai <[email protected]>

* ext/sxml/sxml-tools.scm.in (sxml:attr->xml, sxml:attr->html):
Override to fix shortcomings of the original sxml that attribute
values are not quoted.
Related: https://github.com/shirok/Gauche-makiki/issues/11

2024-03-23 Shiro Kawai <[email protected]>

* src/gauche-package.in (compile): Support --c++ option. This tells
Expand Down
9 changes: 9 additions & 0 deletions ext/sxml/sxml-tools.scm.in
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,15 @@

;#include-body "src/sxml-tools.scm"

;; Override these two to emit attribute value properly escaped.
(define (sxml:attr->xml attr)
`(" " ,(sxml:ncname attr) "=\"" ,(sxml:string->xml (cadr attr)) "\""))
(define (sxml:attr->html attr)
(if (equal? "" (cadr attr))
`(" " ,(sxml:ncname attr))
`(" " ,(sxml:ncname attr) "=\"" ,(sxml:string->html (cadr attr)) "\"")))


;; Local variables:
;; mode: scheme
;; end:

0 comments on commit a605e07

Please sign in to comment.