package wikitext

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

mapper allows to implement AST rewriting using open recursion. A typical mapper would be based on default_mapper, a deep identity mapper, and will fall back on it for handling the syntax it does not modify.

type mapper = {
  1. document : mapper -> Wikitext__.Wktxt_type.block list -> Wikitext__.Wktxt_type.block list;
  2. block : mapper -> Wikitext__.Wktxt_type.block -> Wikitext__.Wktxt_type.block;
  3. table_block : mapper -> Wikitext__.Wktxt_type.table_block -> Wikitext__.Wktxt_type.table_block;
  4. inline : mapper -> Wikitext__.Wktxt_type.inline -> Wikitext__.Wktxt_type.inline;
}
val default_mapper : mapper

A default mapper, which implements a "deep identity" mapping.

val noformat : Wikitext__.Wktxt_type.inline list -> Wikitext__.Wktxt_type.inline list
val toc : Wikitext__.Wktxt_type.block list -> (Wikitext__.Wktxt_type.block list * Wikitext__.Wktxt_type.block) option

toc doc Compute the table of contents of doc. This table of contents is computed by looking at headers. First level header is omitted. Table of contents is returned as un ordered list of links pointing to title's anchors.

val set_toc : Wikitext__.Wktxt_type.block list -> Wikitext__.Wktxt_type.block list

set_toc doc Replace "__TOC__" in doc by the auto-generated table of contents.

link sep str A very basic link creation. No escaping is performed. Turn str into a link ("<a href=\"%s\">%s</a>"). If str contains a sep character, everything coming before is used as the url, and the rest as text.

set_links doc Replace Link and ExtLink occurences by their HTML representation. using link. Link uses '|' as separator and ExtLink uses ' '.

val normalize : Wikitext__.Wktxt_type.block list -> Wikitext__.Wktxt_type.block list

normalize doc Concatenates following Strings elements together and removes block's leading and trailing spaces.