gdritter repos when-computer / ac577a3
Updates to accomodate lojban post Getty Ritter 9 years ago
3 changed file(s) with 55 addition(s) and 6 deletion(s). Collapse all Expand all
3333 (intercalate "," (map mk-selector (cdr selector))))
3434 (else "...")))
3535 (define (mk-line line)
36 (++ (as-string (car line)) ": " (as-string (cadr line)) "; "))
36 (++ " " (as-string (car line)) ": " (as-string (cadr line)) ";\n"))
3737 (define (mk-clause clause)
3838 (++
3939 (mk-selector (car clause))
40 " { "
40 " {\n"
4141 (apply ++ (map mk-line (cdr clause)))
42 "} "))
42 "}\n"))
4343 (apply ++ (map mk-clause scss)))
4444
4545 (define (cadr? sexp)
123123 (list-tag 'p)
124124 (list-tag 'ul)
125125 (list-tag 'ol)
126 (cons 'br (lambda _ `(br)))
126127 (simple-tag 'blockquote)
127128 (cons 'comment (lambda _ ""))
128129 (cons 'link (lambda (url name)
129130 `(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)
132145 `(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 _ "")))))
133153
134154 (define (partition doc lst)
135155 (cond ((null? doc) (reverse lst))
188208
189209 (define (translate-file filename)
190210 (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)))
102102
103103 ((= class tag)
104104 (font-style italic))
105
106 ((= class word)
107 (position relative)
108 (padding "2px 10px 2px 10px")
109 (border-radius "5px")
110 (color "#993366"))
111
112 ((// (= class word) span)
113 (display none))
114
115 ((= class word:hover)
116 (background-color "white"))
117
118 ((// (= class word:hover) span)
119 (display block)
120 (background-color "#cccccc")
121 (border-radius "5px")
122 (color "black")
123 (position absolute)
124 (padding "5px")
125 (top "1.3em")
126 (left "0px")
127 (max-width "400px")
128 (white-space "nowrap")
129 (z-index "50"))
105130
106131 ((= class sidenote)
107132 (float right)