#+xcvb
(module
(:depends-on
- ("fare-utils"
- "fare-matcher"
- "exscribe/packages"
+ ("exscribe/packages"
"exscribe/macros"
"exscribe/specials"
"exscribe/exscribe-data")))
(let ((h (make-hash-table :test 'eql)))
(dolist (f fields)
(ematch f
- ((list (and fn (of-type symbol)) fv)
+ ((list (and fn (typep symbol)) fv)
(setf (gethash fn h) fv))))
h))
(defun init-bib-entry (m kind ident fields)
(warn "Discarding duplicate bibliography entry ~A" ident))))
(defun bib-add! (table entry)
(match entry
- ((list* (and kind (of-type symbol))
- (and ident (of-type (or string symbol)))
+ ((list* (and kind (typep symbol))
+ (and ident (typep (or string symbol)))
fields)
(let* ((ident (conc-string ident))
(old (gethash ident table)))
(merge-bib-entry old kind entry fields)
(setf (gethash ident table)
(make-bib-entry kind ident fields)))))
- (* (error "bad bibliography entry ~A" entry))))
+ (_ (error "bad bibliography entry ~A" entry))))
(define-markup (bibliography &rest r)
(dolist (f r)
(cond
:nicknames ("exscribe")
:supersedes-asdf ("exscribe")
:build-depends-on
- ("/cl-launch" "/xcvb/driver" "/fare-utils"
- "/fare-matcher" "/scribble" (:asdf "alexandria")
+ ("/cl-launch" "/xcvb/driver" "/fare-utils" "/xcvb/xcvb-utils"
+ "/fare-quasiquote" "/scribble" (:asdf "alexandria")
(:when (:featurep :exscribe-typeset)
(:asdf "cl-typesetting")))
:depends-on
#+xcvb
(module
(:depends-on
- ("fare-utils"
- "fare-matcher"
- "exscribe/packages"
+ ("exscribe/packages"
"exscribe/macros"
"exscribe/specials")))
(progn
(defmacro make-tag (tag attr contents)
`(vector ,tag ,attr ,contents))
- (define-macro-matcher tag
- #'(lambda (tag attr contents)
- (pattern-matcher `(vector ,tag ,attr ,contents))))
+ (defpattern tag (tag attr contents) `(vector ,tag ,attr ,contents))
(defun replace-tag! (x tag attr contents)
(setf (svref x 0) tag
(svref x 1) attr
(progn
(defmacro make-tag (tag attr contents)
`(cons (cons ,tag ,attr) ,contents))
- (define-macro-matcher tag
- #'(lambda (tag attr contents)
- (pattern-matcher `(cons (cons ,tag ,attr) ,contents))))
+ (defpattern tag (tag attr contents) `(cons (cons ,tag ,attr) ,contents))
(defun replace-tag! (x tag attr contents)
(setf (car x) (cons tag attr)
(cdr x) contents))
#+xcvb
(module
(:depends-on
- ("fare-utils"
- "fare-matcher"
- "scribble"
+ ("/scribble"
"exscribe/packages"
"exscribe/macros"
"exscribe/specials"
(return-from find-first-paragraph nil))
(walk (x)
(match x
- ((tag :p * *) x)
- ((tag :id * x) (walk x))
- ((tag * * *) (fail))
- ((of-type string) (fail))
+ ((tag :p _ _) x)
+ ((tag :id _ x) (walk x))
+ ((tag _ _ _) (fail))
+ ((typep string) (fail))
((cons x y) (or (walk x) (walk y)))
- (* nil))))
+ (_ nil))))
(walk x)))
(defun edit-footnote (note num)
((vector :table-of-contents options list)
(replace-tag! doc :id () (cons (apply #'make-toc options) list))
(walk doc))
- (* (walk doc))))
+ (_ (walk doc))))
;; Another pass for internal references, after all sections are indexed.
(walking-document (doc *document*)
(hname (car section-data))
(title (cdr section-data)))
(replace-tag! doc :a (list :href hname) (or body (list title)))))
- (* (walk doc))))
+ (_ (walk doc))))
(setf *toc* (nreverse *toc*))
(when *footnotes*
#+xcvb
(module
(:depends-on
- ("fare-utils"
- "fare-matcher"
- "exscribe/packages"
+ ("exscribe/packages"
"exscribe/specials"
"exscribe/exscribe-data")))
(emit-quote () (emit "\""))
(walk (x)
(match x
- ((tag :p * x) (space) (walk x) (space))
- ((tag :q * x) (emit-quote) (walk x) (emit-quote))
- ((tag :br * *) (space))
- ((tag :footnote * *) nil)
- ((tag * * x) (walk x))
- ((of-type string) (emit x))
+ ((tag :p _ x) (space) (walk x) (space))
+ ((tag :q _ x) (emit-quote) (walk x) (emit-quote))
+ ((tag :br _ _) (space))
+ ((tag :footnote _ _) nil)
+ ((tag _ _ x) (walk x))
+ ((typep string) (emit x))
((cons x y) (walk x) (walk y))
- (* nil))))
+ (_ nil))))
(walk node)
(normalize-text
(apply #'concatenate 'string (nreverse strings)))))
(emit `(mark-ref-point "DocumentEnd"))))
- (*
+ (_
(error "Top-level document malformed")))))
(dolist (h (reverse *postprocess-hooks*))
(funcall h))
(process a)
(process b))
- ((of-type character)
+ ((typep character)
(process (string x)))
- ((of-type string)
+ ((typep string)
(emit (if *significant-whitespace*
`(verbatim ,x)
`(put-string ,x))))
;; having full blown closures generated in order to print a single character which can just be included as-is seems like a gratuitious complexity to me. or is there a deeper reason, maybe for other backends?
- ((of-type function)
+ ((typep function)
(emit `(verbatim ,(with-output-to-string (s) (funcall x s)))))
((tag :p options list)
:hfill)
(vspace 12)))))
- ((tag :i * list)
+ ((tag :i _ list)
(emit `(with-style (:font (transform-font (pdf:name typeset::*font*)
:add :italic))
,@(process-list list))))
- ((tag :b * list)
+ ((tag :b _ list)
(emit `(with-style (:font (transform-font (pdf:name typeset::*font*)
:add :bold))
,@(process-list list))))
- ((tag :em * list)
+ ((tag :em _ list)
(emit `(with-style (:font (transform-font (pdf:name typeset::*font*)
:toggle :italic))
,@(process-list list))))
- ((tag :u * list)
+ ((tag :u _ list)
(emit `(with-style (:font (transform-font (pdf:name typeset::*font*)
:add :italic))
,@(process-list list))))
- ((tag :br * *)
+ ((tag :br _ _)
(let ((*significant-whitespace* t))
(process (string #\Newline))))
(emit `(with-style (:font "Helvetica" :font-size 12)
,@(process body))))
- ((tag :ref (list :bib entry) *)
+ ((tag :ref (list :bib entry) _)
(emit `(format-string "[~a]" ,entry)))
- ((tag :ref (list :section section) *)
+ ((tag :ref (list :section section) _)
(emit `(format-string "~s" ,section)))
- ((tag :footnote (list :note note) list)
+ ((tag :footnote (list :note note) _)
;; FIXME: see what list variable may contain
(let ((n (incf *footnote-counter*)))
(emit `(with-superscript ()
,(princ-to-string n)))
(push (cons n note) *footnotes*)))
- ((tag :font * list)
+ ((tag :font _ list)
(process list))
- ((tag :bibliography options list)
+ ((tag :bibliography _ list)
(destructuring-bind ((header . entries)) list
(when header
(process header))
((tag :subsubsection options list)
(process-section 2 options list))
- ((vector :table-of-contents options list)
+ ((vector :table-of-contents _ _)
(delayed-emit `(progn ,@(make-toc)))
#+nil
(dolist (e (nreverse *toc*))
((tag :id nil list)
(process list))
- ((tag :hr * *)
+ ((tag :hr _ _)
#+nil(emit '(hrule :dy .1)))
- ((tag :a * *))
+ ((tag :a _ _))
- ((tag :blockquote * list)
+ ((tag :blockquote _ list)
(emit `(paragraph
(:h-align :left
:font "Times-Roman"
using a high-level syntax (Scribble) completely integrated with the CL syntax.
It notably features proper support for footnotes, table-of-contents, bibliography."
:depends-on (:cl-launch :xcvb-driver
- :scribble :fare-matcher :fare-utils :fare-memoization
+ :scribble :xcvb-utils :fare-quasiquote-optima :fare-memoization
:alexandria
#+exscribe-typeset :cl-typesetting)
:components ((:file "packages")
(if *xtime* (xtime ,msg (,thunk)) (,thunk)))))
)
-;;; Enable my quasiquote implementation for use with fare-matcher...
+;;; Enable my quasiquote implementation for use with optima...
#+nil
(eval-when (:compile-toplevel :load-toplevel :execute)
#-(or cmu sbcl clisp)
(progn
- (error "We use fare-matcher with quasiquotes.
+ (error "We use optima with quasiquotes.
Until fare-quasiquote is fixed, only CMUCL SBCL and CLISP are supported. Sorry.")
(fare-quasiquote:enable-quasiquote)))
(defpackage :scheme-compat
(:documentation "innards of the Scheme in CL emulation")
- (:use :scheme-makeup :xcvb-utils :common-lisp)
- ;(:shadowing-import-from :scheme-makeup :map)
+ (:use :scheme-makeup
+ :xcvb-utils :fare-quasiquote :optima :common-lisp)
+ ;;(:shadowing-import-from :scheme-makeup :map)
(:export
#:set-scheme-macro-characters))
(defpackage :exscribe
(:documentation "core infrastructure for exscribe")
- (:use :common-lisp :xcvb-utils :scribble)
+ (:use :scribble
+ :xcvb-utils :fare-quasiquote :optima :common-lisp)
#+exscribe-typeset
(:import-from :typeset
#:*paper-size* #:*page-margins* #:*twosided* #:*toc-depth*
(defpackage :exscribe-data
(:documentation "internal data representation for exscribe")
- (:use :exscribe :xcvb-utils :fare-matcher :common-lisp)
+ (:use :exscribe
+ :xcvb-utils :fare-quasiquote :optima :common-lisp)
(:export
#:tag-attr #:tag #:xtag #:otag #:ctag
#:make-xml-tag #:make-open-tag #:make-close-tag
(defpackage :exscribe-html
(:documentation "HTML backend for exscribe")
(:shadowing-import-from :exscribe-data #:html)
- (:use :exscribe-data :exscribe :xcvb-utils :fare-matcher
- :html-dumper :common-lisp))
+ (:use :exscribe-data :exscribe :html-dumper
+ :xcvb-utils :fare-quasiquote :optima :common-lisp))
(defpackage :exscribe-txt
(:documentation "Text backend for exscribe")
- (:use :exscribe-data :exscribe :xcvb-utils :fare-matcher :common-lisp)
+ (:use :exscribe-data :exscribe
+ :xcvb-utils :fare-quasiquote :optima :common-lisp)
(:export #:extract-text #:normalize-text))
#+exscribe-typeset
(defpackage :exscribe-typeset
(:documentation "CL-Typesetting backend for exscribe")
(:shadowing-import-from :exscribe-data #:image #:hrule #:table)
- (:use :exscribe-data :exscribe :xcvb-utils :fare-matcher
- :common-lisp :typeset)
+ (:use :exscribe-data :exscribe :typeset
+ :xcvb-utils :fare-quasiquote :optima :common-lisp)
(:export))
(defpackage :exscribe-user
;(:shadowing-import-from :scheme-makeup :map)
- (:use :exscribe-html :exscribe-data :exscribe :fare-matcher
- :xcvb-utils :scheme-makeup :common-lisp))
+ (:use :exscribe-html :exscribe-data :exscribe :scheme-makeup
+ :xcvb-utils :fare-quasiquote :optima :common-lisp)
+ (:export))