Changeset 15372 in project
- Timestamp:
- 08/09/09 10:13:06 (12 years ago)
- Location:
- release/4/qwiki/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
release/4/qwiki/trunk/qwiki-sxml.scm
r15367 r15372 37 37 38 38 (module qwiki-sxml 39 (qwiki- basic-transformation-rules)39 (qwiki-html-transformation-rules) 40 40 41 41 (import chicken scheme) 42 42 43 (use posix sxpath-lolevel sxml-transforms doctype uri-generic) 43 (use posix srfi-1 srfi-13 data-structures) 44 (use sxpath-lolevel sxml-transforms doctype uri-generic) 44 45 45 (define qwiki-basic-transformation-rules 46 47 (define nl (list->string (list #\newline))) 48 49 (define lookup-def 50 (lambda (k lst . rest) 51 (let-optionals rest ((default #f)) 52 (alist-ref k lst eq? default)))) 53 54 55 (define (qwiki-make-html-header head-parms) 56 `(head 57 ,nl (title ,(or (lookup-def 'title head-parms) "qwiki")) 58 ,nl (meta (@ (http-equiv "Content-Type") (content "text/html; charset=UTF-8"))) 59 ,nl (meta (@ (http-equiv "Content-Style-Type") (content "text/css"))) 60 ,nl ,(let ((style (lookup-def 'style head-parms)) 61 (print-style (lookup-def 'print-style head-parms))) 62 (list (if style `(link (@ (rel "stylesheet") (type "text/css") (href ,style))) '()) 63 (if print-style `(link (@ (rel "stylesheet") (type "text/css") 64 (media "print") (href ,print-style))) '()))) 65 ,nl 66 ,(zip 67 (map 68 (lambda (key) 69 (let ((val (lookup-def key head-parms ))) 70 (and val 71 `(meta (@ (name ,(symbol->string key)) (content ,val)))))) 72 '(description Author keywords 73 Date-Revision-yyyymmdd Date-Creation-yyyymmdd)) 74 (circular-list nl)) 75 ,nl 76 (page-specific-links))) 77 78 (define qwiki-html-transformation-rules 79 46 80 `((wiki-page 47 *macro* . ,(lambda page 48 `((xhtml-1.0-strict) 49 (html 50 (head 51 (title ,(or (sxml:attr 'title page) "qwiki"))) 52 (body 53 (page-specific-links) 54 ,@(sxml:content-raw page)))))) 81 . ,(lambda (tag . elems) 82 (list 83 xhtml-1.0-strict 84 "<html>" nl 85 elems 86 "</html>" nl))) 87 88 (Header 89 *macro* 90 . ,(lambda (tag . headers) 91 (qwiki-make-html-header headers))) 92 93 (Section 94 *macro* 95 . ,(lambda (tag level head-word . elems) 96 `((n_) (a (@ (name ,head-word)) (n_)) 97 (,(string->symbol (string-append "h" (number->string level))) 98 ,head-word ,elems)))) 99 100 #| TODO: figure out how to pass the content for rescanning 101 102 (TOC ;; Re-scan the content for "Section" tags and generate 103 . ,(lambda (tag . rest) ;; the table of contents 104 (let ((sections 105 (pre-post-order Content 106 `( 107 (Section ;; (Section level "content ...") 108 ((*text* . ,(lambda (tag str) str))) 109 . ,(lambda (tag level head-word . elems) 110 (list "<li><a href=\"#" head-word 111 "\">" head-word elems "</a>" nl )) 112 ) 113 (*default* 114 . ,(lambda (tag . elems) elems)) 115 116 (*text* . ,(lambda (trigger str) (list))))))) 117 (list "<div id=\"toc\">" 118 "<ul>" 119 sections 120 "</ul></div>" nl)))) 121 |# 122 123 (special 124 *macro* 125 . ,(lambda (tag name arg) 126 `(,(string->symbol (string-upcase (symbol->string name))) ,arg))) 127 128 129 (nowiki 130 *macro* 131 . ,(lambda (tag . lines) 132 `(pre ,@(map (lambda (line) (list " " line nl)) 133 lines)))) 134 (type 135 *macro* 136 . ,(lambda (tag . terms) 137 `(tt ,@terms))) 138 139 (url *macro* . ,(lambda (tag href . contents) 140 `(a (@ (href ,href)) 141 ,(if (pair? contents) contents 142 href)))) 143 144 55 145 ;; Maybe this should be done in multiple steps to make it more "hookable" 56 146 (history … … 76 166 (li (url "?action=edit" "edit")) 77 167 (li (url "?action=history" "history"))))) 78 ,@alist-conv-rules)) 168 169 )) 79 170 80 171 ) -
release/4/qwiki/trunk/qwiki.scm
r15370 r15372 57 57 (define qwiki-transformation-steps 58 58 (make-parameter 59 (list qwiki- basic-transformation-rules59 (list qwiki-html-transformation-rules 60 60 shortcut-rules 61 61 (append doctype-rules universal-conversion-rules)))) -
release/4/qwiki/trunk/qwiki.setup
r15370 r15372 1 (compile -s -O2 qwiki.scm -j qwiki) 2 (compile -s -O2 qwiki.import.scm) 1 ;;;; -*- Hen -*- 3 2 4 3 (compile -s -O2 qwiki-sxml.scm -j qwiki-sxml) … … 7 6 (compile -s -O2 qwiki-svn.scm -j qwiki-svn) 8 7 (compile -s -O2 qwiki-svn.import.scm) 8 9 (compile -s -O2 qwiki.scm -j qwiki) 10 (compile -s -O2 qwiki.import.scm) 9 11 10 12 (install-extension
Note: See TracChangeset
for help on using the changeset viewer.