Fixing xml snip bug

svn: r14087
This commit is contained in:
Jay McCarthy 2009-03-13 14:55:37 +00:00
parent acb18e6989
commit 04cdd975e9
5 changed files with 3889 additions and 4 deletions

View File

@ -52,7 +52,7 @@
(lambda () (lambda ()
(let* ([source-name (get-source-name editor)] (let* ([source-name (get-source-name editor)]
[port (open-input-text-editor editor 0 'end (xml-snip-filter editor) source-name)] [port (open-input-text-editor editor 0 'end (xml-snip-filter editor) source-name)]
[xml (read-xml port)] [xml (parameterize ([permissive? #t]) (read-xml port))]
[xexpr (parameterize ([permissive? #t]) (xml->xexpr (document-element xml)))] [xexpr (parameterize ([permissive? #t]) (xml->xexpr (document-element xml)))]
[clean-xexpr (if eliminate-whitespace-in-empty-tags? [clean-xexpr (if eliminate-whitespace-in-empty-tags?
(eliminate-whitespace-in-empty-tags xexpr) (eliminate-whitespace-in-empty-tags xexpr)

File diff suppressed because it is too large Load Diff

View File

@ -111,7 +111,7 @@
(struct (attribute source) ([start location/c] (struct (attribute source) ([start location/c]
[stop location/c] [stop location/c]
[name symbol?] [name symbol?]
[value string?])) [value (or/c string? permissive/c)]))
[permissive? (parameter/c boolean?)] [permissive? (parameter/c boolean?)]
[permissive/c contract?] [permissive/c contract?]
[content/c contract?] [content/c contract?]

View File

@ -129,7 +129,8 @@
;; True if the list is a list of String,Symbol pairs. ;; True if the list is a list of String,Symbol pairs.
(define (attribute-symbol-string? attr true false) (define (attribute-symbol-string? attr true false)
(if (symbol? (car attr)) (if (symbol? (car attr))
(if (string? (cadr attr)) (if (or (string? (cadr attr))
(permissive?))
(true) (true)
(false (make-exn:invalid-xexpr (false (make-exn:invalid-xexpr
(format "Expected a string, given ~a" (cadr attr)) (format "Expected a string, given ~a" (cadr attr))

View File

@ -96,7 +96,7 @@ Represents a document.}
[content (listof content/c)])]{ [content (listof content/c)])]{
Represents an element.} Represents an element.}
@defstruct[(attribute source) ([name symbol?] [value string?])]{ @defstruct[(attribute source) ([name symbol?] [value (or/c string? permissive/c)])]{
Represents an attribute within an element.} Represents an attribute within an element.}