123 | 123 |
(list-tag 'p)
|
124 | 124 |
(list-tag 'ul)
|
125 | 125 |
(list-tag 'ol)
|
| 126 |
(cons 'br (lambda _ `(br)))
|
126 | 127 |
(simple-tag 'blockquote)
|
127 | 128 |
(cons 'comment (lambda _ ""))
|
128 | 129 |
(cons 'link (lambda (url name)
|
129 | 130 |
`(a (@ (href ,(apply string-append url))) ,name)))
|
130 | |
(cons 'sidenote (lambda (arg) `(span (@ (class sidenote)) ,arg)))
|
131 | |
(cons 'ref (lambda (name)
|
| 131 |
(cons 'img (lambda (src)
|
| 132 |
`(img (@ (src ,(apply string-append src))))))
|
| 133 |
(cons 'center (lambda (arg)
|
| 134 |
`(div (@ (align "center")) ,arg))))))
|
| 135 |
|
| 136 |
(define standard-tag-list
|
| 137 |
(append basic-tag-list
|
| 138 |
(list (cons 'wd (lambda (wd mn)
|
| 139 |
`(span (@ (class "word"))
|
| 140 |
,wd
|
| 141 |
(span (@ (class "meaning")) ,mn))))
|
| 142 |
(cons 'sidenote (lambda (arg)
|
| 143 |
`(span (@ (class sidenote)) ,arg)))
|
| 144 |
(cons 'ref (lambda (name)
|
132 | 145 |
`(label (@ (for ,(car name)) (class "sidenote-number")) ""))))))
|
| 146 |
|
| 147 |
(define feed-tag-list
|
| 148 |
(append basic-tag-list
|
| 149 |
(list (cons 'wd (lambda (wd _) wd))
|
| 150 |
(cons 'sidenote
|
| 151 |
(lambda (arg) (list "(" arg ")")))
|
| 152 |
(cons 'ref (lambda _ "")))))
|
133 | 153 |
|
134 | 154 |
(define (partition doc lst)
|
135 | 155 |
(cond ((null? doc) (reverse lst))
|
|
188 | 208 |
|
189 | 209 |
(define (translate-file filename)
|
190 | 210 |
(let ((body (with-input-from-file filename read-string)))
|
191 | |
(telml->sxml (parse body) basic-tag-list)))
|
| 211 |
(telml->sxml (parse body) standard-tag-list)))
|
| 212 |
|
| 213 |
(define (translate-feed-file filename)
|
| 214 |
(let ((body (with-input-from-file filename read-string)))
|
| 215 |
(telml->sxml (parse body) feed-tag-list)))
|