1 Usage

The dialect parsed here is the consensus WikiCreole syntax of http://www.wikicreole.org/. It handles all of the WikiCreole test cases, except for one test of wiki-internal links (which is in any case somewhat underspecified).

In particular, the supported syntax is
  • //italics//

  • **bold** : A line which begins with **, with possible whitespace either side, is a (second-level) bulletted list if the line before it is a bulleted list, but is a paragraph starting with bold text otherwise.

  • ##monospaced text## : A line which begins with ##, with possible whitespace either side, is a (second-level) enumerated list if the line before it is an enumerated list, but is a paragraph starting with monospace text otherwise. [This is not specified in the WikiCreole definition, but is clearly compatible with it].

  •  * bulleted list : (including sublists, the asterisk may or may not be indented)

  •  # numbered list : (including sublists)

  • >quoted paragraph : including multiple levels (this appears to be an extension of WikiCreole).

  • [[link to wikipage]]

  • [[URL|description]]

  • {{image.png}} or {{image.png|alt text}} or {{image.png|att=value;att2=value; or more}}. In the last case, the att indicates any attribute on the HTML <img> element, such as class; the att must immediately follow the semicolon (so the last case parses as att2=value; or more); and if the att is omitted, it defaults to alt.

  • == heading

  • === subheading

  • ==== subsubheading

  • line\\break

  • - : (four dashes in a row, on a line by themselves) horizontal list

  • ~escaped character, and ~http://url which isn’t linked

  • {{{in-line literal text}}}

Blocks of verbatim text (which will typically be rendered to <pre> blocks), can be specified with:

{{{

preformatted text

}}}

The opening {{{, and its closing partner, must be on lines by themselves. The newline after the opening marker, and the newline before the closing one, are ignored.

Tables look like this:

|=Heading Col 1 |=Heading Col 2         |

|Cell 1.1       |Two lines\\in Cell 1.2 |

|Cell 2.1       |Cell 2.2               |

To this I add syntax:
  • ::foo bar baz : adds, or replaces, the keyword ’foo’ with the string ’bar baz’.

  • "quoted" : corresponds to <q>quoted</q> (note that’s a double-quote character, not two single quotes).

  • <<element-name content>> : adds <element-name>content</element-name> to the output.

  • The att=value syntax for {{}} is an extension.

For an example, the following parses some input text, and writes it out as XML.

  (require xml squicky/parser)
  (define (write-xml-to-port wiki-text output-port)
    (write-xml/content
     (xexpr->xml
      `(top (,@(map (lambda (k)
                      (list k (lookup wiki-text k)))
                    (lookup-keys wiki-text)))
            . ,(body wiki-text)))
     output-port)
    (newline output-port))
  (write-xml-to-port (parse (current-input-port))
                                 (current-output-port))

Suitable input text would be:

::date 2010 December 12

== Here is a heading

Here is some text, with a list comprising:

  * one

  * two.

 

That's quite //astonishing!//.