CommonDoc » Libraries

Codex

Codex is the documentation generator used to create this manual.

CommonHTML

CommonHTML is CommonDoc's HTML parser and emitter.

Examples

(defpackage html-example
  (:use :cl :common-doc))
(in-package :html-example)

(ql:quickload :common-html)

(defvar *document*
  (make-document
    "My Document"
    :children
    (list
     (make-section (list (make-text "Introduction"))
                   :children
                   (list
                    (make-paragraph
                     (list (make-text "This is an example of using CommonHTML.")))
                    (make-ordered-list
                     (list
                      (make-list-item
                       (list (make-text "Item one")))
                      (make-list-item
                       (list (make-text "Item two"))))
                     :metadata (make-meta (list (cons "class" "my-list"))))
                    (make-definition-list
                     (list
                      (make-definition
                       (list (make-text "Term"))
                       (list (make-text "Definition"))))))))))

(common-doc.format:emit-to-string (make-instance 'common-html:html)
                                  *document*)
"<!DOCTYPE html>
<html>
  <head>
    <title>My Document</title>
  </head>
  <body>
    <h1>Introduction</h1>

    <p>This is an example of using CommonHTML.</p>

    <ol class=\"my-list\">
      <li>Item one</li>
      <li>Item two</li>
    </ol>

    <dl>
      <dt>Term</dt
      <dd>Definition</dd>
    </dl>
  </body>
</html>"

Thorn

Thorn is a library for inserting special characters into CommonDoc documents.

Most input methods allow the user to insert characters in different alphabets and accented or modified versions of the same, but these are different for everyone and often the user will end up looking up a character by name.

Thorn is a tool for inserting Unicode characters by an ASCII name, the way TeX allows users to insert the letters α and β with the commands \alpha and \beta, respectively.

Simply put, it defines a macro, l, that maps a string to a Unicode character.

Examples

The following Scriba input:

Hw@l(ae)t! We Gardena in geardagum,

@l(th)eodcyninga, @l(th)rym gefrunon,

hu @l(eth)a @l(ae)þelingas ellen fremedon.

Oft Scyld Scefing scea@l(th)ena @l(th)reatum,

Produces the first lines of Beowulf in Anglo-Saxon:

Hwæt! We Gardena in geardagum,

þeodcyninga, þrym gefrunon,

hu ða æþelingas ellen fremedon.

Oft Scyld Scefing sceaþena þreatum,

Pandocl

Pandocl is an easy to use document converter, meant as a simple interface to CommonDoc.

Examples

CL-USER> (pandocl:convert #p"input.tex" #p"output.html")
#<COMMON-DOC:DOCUMENT "My Document">

CL-USER> (pandocl:emit #p"input.tex" #p"output.html"
                       :input-format :vertex
                       :output-format :html)
#<COMMON-DOC:DOCUMENT "My Document">

CL-USER> (pandocl:parse #p"path/to/doc.tex")
#<COMMON-DOC:DOCUMENT "My Document">

CL-USER> (pandocl:parse #p"path/to/doc.tex" :format :vertex)
#<COMMON-DOC:DOCUMENT "My Document">

CL-USER> (pandocl:emit doc #p"path/to/output.html")
#<COMMON-DOC:DOCUMENT "My Document">

CL-USER> (pandocl:emit doc #p"path/to/output.html" :format :html)
#<COMMON-DOC:DOCUMENT "My Document">