Textile (approximately) in Clojure
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
texticl @ 6b942dd



A Clojure library designed to transform an “approximate subset” of the
Textile text markup format into something you could feed into Hiccup.
It probably doesn’t do exactly the same as Textile in any strange or
borderline cases, and it deliberately doesn’t do exactly the same as
Textile in the case of newlines, which it leaves intact in the output
instead of transforming them to <br>

(texticlj.core/to-hiccup (slurp "myfile.textile"))

Based on https://github.com/telent/texticl

The input is a lump of text. Processing is as follows:

  1. separate it into block-level elements
    p h[123456] bq

Each element is introduced by its name followed by “.” and finished by
a blank line. If the element name is missing, assume p

  1. find ordered and unordered lists
    ^#+ ' or '^*+ ' 

mark the start of a list item; nesting depth is given by the number of
hashes or stars. The item runs until (a) the next item, or (b) the end
of the block.

  1. within each block, look for character sequences that delimit inline
" *" bold  "* "
" _" underline  "_ "

… etc

  1. footnotes, tables, stuff like that all TBD