Module Textile (.ml)

module Textile: sig .. end

Textile markup language syntax tree


Textile syntax tree

Options

type attr = 
| Class of string (*

p(myclass).

*)
| Id of string (*

p(#myid).

*)
| Style of string (*

p{color:red}.

*)
| Language of string (*

p[fr-fr].

*)
type img_float = 
| Float_left (*

<

*)
| Float_right (*

>

*)

Image float.

type talign = 
| Right (*

>

*)
| Left (*

<

*)
| Center (*

=

*)
| Justify (*

<>

*)

Text-alignment option.

type valign = 
| Top (*

^

*)
| Middle (*

-

*)
| Bottom (*

~

*)

Vertical alignment.

type padding = int * int 

Left and right padding consistently. Define with ( and ) in block modifier. (0,0) if padding doesn't set.

type options = attr list * talign option * padding 

Content

Phrases may be presents like HTML tags for text formatting. For example, **ocaml is __functional__ language** is equivalent for ocaml is functional language or Bold ([], [CData "ocaml is ";
Italic ([], [CData "functional"]); CData " language"])

type phrase = 
| CData of string
| Emphasis of (attr list * phrase list) (*

_

*)
| Strong of (attr list * phrase list) (*

*

*)
| Italic of (attr list * phrase list) (*

__

*)
| Bold of (attr list * phrase list) (*

**

*)
| Citation of (attr list * phrase list) (*

??

*)
| Deleted of (attr list * phrase list) (*

-

*)
| Inserted of (attr list * phrase list) (*

+

*)
| Superscript of (attr list * phrase list) (*

^

*)
| Subscript of (attr list * phrase list) (*

~

*)
| Span of (attr list * phrase list) (*

%

*)
| Code of (attr list * string) (*

@

*)
| Notextile of string (*

==

*)
| Acronym of string * string (*

ABC(Always Be Closing)

*)
| Image of attr list * img_float option * string * string option (*

!imgsrc(alt)!

*)
| Link of (attr list * phrase list) * string option * string (*

"linktext(title)":url

*)
| Reference of int (*

[1]

*)
type line = phrase list 

One line of text. It terminates by line break character.

type element = int * line 

One element of a list. It's a line and depth of element, or just count of asterisk or sharps.

Tables

type tableoptions = options * valign option 

Table specific options. May be applied to a table or to a row.

type celltype = 
| Data (*

| <...> |

*)
| Head (*

|_. <...> |

*)

In textile symbol _ defines a cell as a table header. Otherwise it's a regular data cell.

type cellspan = int option * int option 

Colspan and rowspan.

type celloptions = celltype * tableoptions * cellspan 

Cell specific options.

type cell = celloptions * line list 

A cell in row.

type row = tableoptions * cell list 

A row in table.

Blocks

type block = 
| Header of int * (options * line list) (*

h1.

*)
| Blockquote of (options * line list) (*

bq.

*)
| Footnote of int * (options * line list) (*

fnn.

*)
| Paragraph of (options * line list) (*

p.

*)
| Blockcode of (options * string list) (*

bc.

*)
| Pre of (options * string list) (*

pre.

*)
| Blocknott of (options * string list) (*

notextile.

*)
| Numlist of element list (*

#

*)
| Bulllist of element list (*

*

*)
| Table of (tableoptions * row list) (*

|t|a|b|

*)

Extended blocks parse automaticly so there is no difference for you between normal and extended blocks.

Translation

val string_of_line : line -> string

Translates the line to a simple string which can be used, for example, in HTML's <title> tag. All markup will be removed.