commit 2ed47f1bbd1fa477b2f1c071beefe9000467d5ec parent bb79dcff2d7b6f4d958239b6a4e660158ad570af Author: Eli Barzilay <eli@barzilay.org> Date: Sat, 28 Sep 2013 14:51:06 -0400 Add a `doctype' convenience. original commit: ab0cde405ad87bc07a235063e77b2de2799ac789 Diffstat:
| M | pkgs/scribble-pkgs/scribble-lib/scribble/html/html.rkt | | | 23 | +++++++++++++++++------ |
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/pkgs/scribble-pkgs/scribble-lib/scribble/html/html.rkt b/pkgs/scribble-pkgs/scribble-lib/scribble/html/html.rkt @@ -5,15 +5,26 @@ (require "xml.rkt" scribble/text) ;; ---------------------------------------------------------------------------- +;; Doctype line + +(provide doctype) +(define (doctype type) + (cond [(string? type) (literal "<!DOCTYPE " type ">\n")] + [(eq? 'html type) (doctype type)] + [(eq? 'xhtml type) + (list (literal "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n") + (doctype (string-append + "html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"" + " \"http://www.w3.org/TR/xhtml1/DTD/" + "xhtml1-strict.dtd\"")))] + [else (raise-type-error 'doctype + "string or known doctype symbol" type)])) + +;; ---------------------------------------------------------------------------- ;; Xhtml toplevel ;; creation of xhtml files requires some extra stuff -(define xhtml-prefix - (literal - (string-append - "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n" - "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"" - " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"))) +(define xhtml-prefix (doctype 'xhtml)) (provide xhtml) (define (xhtml . body) (list xhtml-prefix