Move xml->string to a more proper place
This commit is contained in:
parent
8694d7b8ae
commit
5da56167a9
|
@ -2,7 +2,7 @@
|
|||
|
||||
;; XML-like objects and functions, with rendering
|
||||
|
||||
(require scribble/text)
|
||||
(require scribble/text racket/port)
|
||||
|
||||
;; ----------------------------------------------------------------------------
|
||||
;; Represent attribute names as `foo:' symbols. They are made self-quoting in
|
||||
|
@ -61,6 +61,10 @@
|
|||
(define (output-xml content [p (current-output-port)])
|
||||
(output (disable-prefix (with-writer (xml-writer) content)) p))
|
||||
|
||||
(provide xml->string)
|
||||
(define (xml->string content)
|
||||
(with-output-to-string (lambda () (output-xml content))))
|
||||
|
||||
;; ----------------------------------------------------------------------------
|
||||
;; Structs for xml data: elements, literals, entities
|
||||
|
||||
|
|
|
@ -26,13 +26,14 @@
|
|||
@navbar-style
|
||||
})
|
||||
|
||||
(define (xml->string content)
|
||||
(regexp-replace* #rx" "
|
||||
(with-output-to-string (lambda () (output-xml content)))
|
||||
"\\ "))
|
||||
(define (get-resource-text . args)
|
||||
(let ([str (xml->string (apply www:the-resources args))])
|
||||
;; due to some obscure xml issue the `nbsp' entity is not recognized
|
||||
;; in blogger pages
|
||||
(regexp-replace* #rx" " str "\\ ")))
|
||||
|
||||
(define (racket-navbar) (xml->string (www:the-resources 'navbar #f)))
|
||||
(define (racket-favicon) (xml->string (www:the-resources 'favicon-headers)))
|
||||
(define (racket-navbar) (get-resource-text 'navbar #f))
|
||||
(define (racket-favicon) (get-resource-text 'favicon-headers))
|
||||
|
||||
(provide blog)
|
||||
(define blog
|
||||
|
|
|
@ -6,12 +6,6 @@
|
|||
|
||||
(define-context "stubs/dirlist" #:resources dnld:the-resources)
|
||||
|
||||
(require racket/port)
|
||||
(define (xml->string content)
|
||||
(regexp-replace* #rx" "
|
||||
(with-output-to-string (lambda () (output-xml content)))
|
||||
"\\ "))
|
||||
|
||||
(define header+footer
|
||||
(delay (regexp-split #rx"{{{BODY}}}"
|
||||
(xml->string @page[#:id 'browse-downloads
|
||||
|
|
Loading…
Reference in New Issue
Block a user