Avoid regexp-replace* unless the string really contains escapable characters.
This commit is contained in:
parent
40116eb16d
commit
5cb2f3eb58
|
@ -168,7 +168,15 @@
|
|||
(define (escape x table)
|
||||
(regexp-replace* table x replace-escaped))
|
||||
|
||||
(define (display/escape x table out)
|
||||
(cond [(regexp-match table x)
|
||||
(display (escape x table) out)]
|
||||
[else
|
||||
(display x out)]))
|
||||
|
||||
|
||||
(provide escape
|
||||
display/escape
|
||||
escape-table
|
||||
escape-attribute-table
|
||||
lowercase-symbol
|
||||
|
|
|
@ -141,7 +141,7 @@
|
|||
(display (car att) out)
|
||||
(display "=" out)
|
||||
(display "\"" out)
|
||||
(display (escape (cadr att) escape-attribute-table) out)
|
||||
(display/escape (cadr att) escape-attribute-table out)
|
||||
(display "\"" out))
|
||||
; Write end of opening tag
|
||||
(if (and (null? content)
|
||||
|
@ -161,7 +161,7 @@
|
|||
(display ">" out)))]
|
||||
; PCData
|
||||
[(string? x)
|
||||
(display (escape x escape-table) out)]
|
||||
(display/escape x escape-table out)]
|
||||
; Entities
|
||||
[(symbol? x)
|
||||
(display "&" out)
|
||||
|
|
Loading…
Reference in New Issue
Block a user