~ubuntu-branches/ubuntu/wily/acl2/wily

« back to all changes in this revision

Viewing changes to books/xdoc/preprocess.lisp

  • Committer: Package Import Robot
  • Author(s): Camm Maguire
  • Date: 2015-01-16 10:35:45 UTC
  • mfrom: (3.3.26 sid)
  • Revision ID: package-import@ubuntu.com-20150116103545-prehe9thgo79o8w8
Tags: 7.0-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1197
1197
                       (preprocess-aux x (+ end 2) xl context topics-fal base-pkg kpa state acc)))
1198
1198
 
1199
1199
                    ((when (and (< (+ n 2) xl)
 
1200
                                (or (eql (char x (+ n 2)) #\[)
 
1201
                                    (eql (char x (+ n 2)) #\$))))
 
1202
                     ;; @([...]) directive -- turns into <math> block
 
1203
                     ;; @($...$) directive -- turns into a <mathfrag> block
 
1204
                     (b* ((fragp (eql (char x (+ n 2)) #\$))
 
1205
                          (end (str::strpos-fast (if fragp "$)" "])")
 
1206
                                                 x (+ n 3)
 
1207
                                                 2 ;; length of string we're looking for
 
1208
                                                 xl))
 
1209
                          ((unless end)
 
1210
                           (prog2$ (and (xdoc-verbose-p)
 
1211
                                        (if fragp
 
1212
                                            (cw "; xdoc error in ~x0: no closing $) found for @($ ...~%" context)
 
1213
                                          (cw "; xdoc error in ~x0: no closing ]) found for @([ ...~%" context)))
 
1214
                                   (mv acc state)))
 
1215
                          (sub (subseq x (+ n 3) end))
 
1216
                          (acc (str::revappend-chars (if fragp "<mathfrag>" "<math>") acc))
 
1217
                          ;; Unlike @('...') we don't want to try to automatically insert hyperlinks, as
 
1218
                          ;; that would very likely totally screw up katex.
 
1219
                          (acc (simple-html-encode-str sub 0 (length sub) acc))
 
1220
                          (acc (str::revappend-chars (if fragp "</mathfrag>" "</math>") acc)))
 
1221
                       (preprocess-aux x (+ end 2) xl context topics-fal base-pkg kpa state acc)))
 
1222
 
 
1223
                    ((when (and (< (+ n 2) xl)
1200
1224
                                (eql (char x (+ n 2)) #\`)))
1201
1225
                     ;; @(`...`) directive -- Lisp evaluation of the form.
1202
1226
                     (b* ((end (str::strpos-fast "`)" x (+ n 2) 2 xl))