/p/
Toledo Talk forums search sign-up login

Article source for : Textile

[[Textile Quick Reference|Quick Reference]]

==

<P>Textile processes text in units of blocks and lines. A block might also
be considered a paragraph, since blocks are separated from one another by a
blank line. Blocks can begin with a signature that helps identify the rest of
the block content. Block signatures include:</P>

<h1>Syntax</h1>

<DL>
<DT><A name=p></A>p.
<DD>
<P>A paragraph block. This is the default signature if no signature is
explicitly given. Paragraphs are formatted with all the inline rules (see
inline formatting) and each line receives the appropriate markup rules for the
flavor of HTML in use. For example, newlines for XHTML content receive a
&lt;br /&gt; tag at the end of the line (with the exception of the last line
in the paragraph). Paragraph blocks are enclosed in a &lt;p&gt; tag.</P>
<DT><A name=pre></A>pre.
<DD>
<P>A pre-formatted block of text. Textile will not add any HTML tags for
individual lines. Whitespace is also preserved.</P>
<P>Note that within a "pre" block, &lt; and &gt; are translated into HTML
entities automatically.</P>
<DT><A name=bc></A>bc.
<DD>
<P>A "bc" signature is short for "block code", which implies a preformatted
section like the 'pre' block, but it also gets a &lt;code&gt; tag (or for
XHTML 2, a &lt;blockcode&gt; tag is used instead).</P>
<P>Note that within a "bc" block, &lt; and &gt; are translated into HTML
entities automatically.</P>
<DT><A name=table></A>table.
<DD>
<P>For composing HTML tables. See the "TABLES" section for more
information.</P>
<DT><A name=bq></A>bq.
<DD>
<P>A "bq" signature is short for "block quote". Paragraph text formatting is
applied to these blocks and they are enclosed in a &lt;blockquote&gt; tag as
well as &lt;p&gt; tags within.</P>
<DT>h1., h2., h3., h4., h5., h6.
<DD>
<P>Headline signatures that produce &lt;h1&gt;, etc. tags. You can adjust the
relative output of these using the head_offset attribute.</P>
<DT><A name=clear></A>clear.
<DD>
<P>A 'clear' signature is simply used to indicate that the next block should
emit a CSS style attribute that clears any floating elements. The default
behavior is to clear "both", but you can use the left (&lt;) or right (&gt;)
alignment characters to indicate which side to clear.</P>
<DT><A name=dl></A>dl.
<DD>
<P>A "dl" signature is short for "definition list". See the "LISTS" section
for more information.</P>
<DT><A name=fn></A>fn.
<DD>
<P>A "fn" signature is short for "footnote". You add a number following the
"fn" keyword to number the footnote. Footnotes are output as paragraph tags
but are given a special CSS class name which can be used to style them as you
see fit.</P></DD></DL>
<P>All signatures should end with a period and be followed with a space.
Inbetween the signature and the period, you may use several parameters to
further customize the block. These include:</P>
<DL>
<DT><A name=style></A><A name={style_rule}></A><CODE>{style rule}</CODE>
<DD>
<P>A CSS style rule. Style rules can span multiple lines.</P>
<DT><A name=ll></A><A name=[ll]></A><CODE>[ll]</CODE>
<DD>
<P>A language identifier (for a "lang" attribute).</P>
<DT><A name=class></A><A
name=(class)_or_(#id)_or_(class#id)></A><CODE>(class)</CODE> or
<CODE>(#id)</CODE> or <CODE>(class#id)</CODE>
<DD>
<P>For CSS class and id attributes.</P>
<DT><A name=">,_<,_=,_<>"></A><CODE>&gt;</CODE>, <CODE>&lt;</CODE>,
<CODE>=</CODE>, <CODE>&lt;&gt;</CODE>
<DD>
<P>Modifier characters for alignment. Right-justification, left-justification,
centered, and full-justification.</P>
<DT><A name=one></A><A name=(_(one_or_more)></A><CODE>(</CODE> (one or more)
<DD>
<P>Adds padding on the left. 1em per "(" character is applied. When combined
with the align-left or align-right modifier, it makes the block float.</P>
<DT><A name=one></A><A name=)_(one_or_more)></A><CODE>)</CODE> (one or more)
<DD>
<P>Adds padding on the right. 1em per ")" character is applied. When combined
with the align-left or align-right modifier, it makes the block float.</P>
<DT><A name=filter></A><A
name=|filter|_or_|filter|filter|filter|></A><CODE>|filter|</CODE> or
<CODE>|filter|filter|filter|</CODE>
<DD>
<P>A filter may be invoked to further format the text for this signature. If
one or more filters are identified, the text will be processed first using the
filters and then by Textile's own block formatting rules.</P></DD></DL>
<H2><A name=Extended_Blocks></A>Extended Blocks</H2>
<P>Normally, a block ends with the first blank line encountered. However, there
are situations where you may want a block to continue for multiple paragraphs of
text. To cause a given block signature to stay active, use two periods in your
signature instead of one. This will tell Textile to keep processing using that
signature until it hits the next signature is found.</P>
<P>For example:</P><PRE> bq.. This is paragraph one of a block quote.

This is paragraph two of a block quote.

p. Now we're back to a regular paragraph.</PRE>
<P>You can apply this technique to any signature (although for some it doesn't
make sense, like "h1" for example). This is especially useful for "bc" blocks
where your code may have many blank lines scattered through it.</P>
<H2><A name=Escaping></A>Escaping</H2>
<P>Sometimes you want Textile to just get out of the way and let you put some
regular HTML markup in your document. You can disable Textile formatting for a
given block using the '==' escape mechanism:</P><PRE> p. Regular paragraph

&#061;&#061;
Escaped portion -- will not be formatted
by Textile at all
&#061;&#061;

p. Back to normal.</PRE>
<P>You can also use this technique within a Textile block, temporarily disabling
the inline formatting functions:</P><PRE> p. This is ==*a test*== of escaping.</PRE>
<H2><A name=Inline_Formatting></A>Inline Formatting</H2>
<P>Formatting within a block of text is covered by the "inline" formatting
rules. These operators must be placed up against text/punctuation to be
recognized. These include:</P>
<DL>
<DT><A name=strong></A><A name=*strong*></A>*<CODE>strong</CODE>*
<DD>
<P>Translates into &lt;strong&gt;strong&lt;/strong&gt;.</P>
<DT><A name=_emphasis_></A><CODE>_emphasis_</CODE>
<DD>
<P>Translates into &lt;em&gt;emphasis&lt;/em&gt;.</P>
<DT><A name=bold></A><A name=**bold**></A>**<CODE>bold</CODE>**
<DD>
<P>Translates into &lt;b&gt;bold&lt;/b&gt;.</P>
<DT><A name=__italics__></A><CODE>__italics__</CODE>
<DD>
<P>Translates into &lt;i&gt;italics&lt;/i&gt;.</P>
<DT><A name=bigger></A><A name=++bigger++></A><CODE>++bigger++</CODE>
<DD>
<P>Translates into &lt;big&gt;bigger&lt;/big&gt;.</P>
<DT><A name=smaller></A><A name=--smaller--></A><CODE>--smaller--</CODE>
<DD>
<P>Translates into: &lt;small&gt;smaller&lt;/small&gt;.</P>
<DT><A name=deleted></A><A name=-deleted_text-></A><CODE>-deleted text-</CODE>

<DD>
<P>Translates into &lt;del&gt;deleted text&lt;/del&gt;.</P>
<DT><A name=inserted></A><A name=+inserted_text+></A><CODE>+inserted
text+</CODE>
<DD>
<P>Translates into &lt;ins&gt;inserted text&lt;/ins&gt;.</P>
<DT><A name=superscript></A><A
name=^superscript^></A><CODE>^superscript^</CODE>
<DD>
<P>Translates into &lt;sup&gt;superscript&lt;/sup&gt;.</P>
<DT><A name=subscript></A><A name=~subscript~></A><CODE>~subscript~</CODE>
<DD>
<P>Translates into &lt;sub&gt;subscript&lt;/sub&gt;.</P>
<DT><A name=span></A><A name=%span%></A><CODE>%span%</CODE>
<DD>
<P>Translates into &lt;span&gt;span&lt;/span&gt;.</P>
<DT><A name=code></A><A name=@code@></A><CODE>@code@</CODE>
<DD>
<P>Translates into &lt;code&gt;code&lt;/code&gt;. Note that within a '@...@'
section, &lt; and &gt; are translated into HTML entities
automatically.</P></DD></DL>
<P>Inline formatting operators accept the following modifiers:</P>
<DL>
<DT><A name=style></A><A name={style_rule}></A><CODE>{style rule}</CODE>
<DD>
<P>A CSS style rule.</P>
<DT><A name=ll></A><A name=[ll]></A><CODE>[ll]</CODE>
<DD>
<P>A language identifier (for a "lang" attribute).</P>
<DT><A name=class></A><A
name=(class)_or_(#id)_or_(class#id)></A><CODE>(class)</CODE> or
<CODE>(#id)</CODE> or <CODE>(class#id)</CODE>
<DD>
<P>For CSS class and id attributes.</P></DD></DL>
<strong>Examples</strong><PRE> Textile is *way* cool.


Textile is *_way_* cool.</PRE>
<P>Now this won't work, because the formatting characters need whitespace before
and after to be properly recognized.</P><PRE> Textile is way c*oo*l.</PRE>
<P>However, you can supply braces or brackets to further clarify that you want
to format, so this would work:</P><PRE> Textile is way c[*oo*]l.</PRE>
<H2><A name=Footnotes></A>Footnotes</H2>
<P>You can create footnotes like this:</P><PRE> And then he went on a long trip[1].</PRE>
<P>By specifying the brackets with a number inside, Textile will recognize that
as a footnote marker. It will replace that with a construct like this:</P><PRE> And then he went on a long
trip&lt;sup class="footnote"&gt;&lt;a href="#fn1"&gt;1&lt;/a&gt;&lt;/sup&gt;</PRE>
<P>To supply the content of the footnote, place it at the end of your document
using a "fn" block signature:</P><PRE> fn1. And there was much rejoicing.</PRE>
<P>Which creates a paragraph that looks like this:</P><PRE> &lt;p class="footnote" id="fn1"&gt;&lt;sup&gt;1&lt;/sup&gt; And there was
much rejoicing.&lt;/p&gt;</PRE>
<H2><A name=Links></A>Links</H2>
<P>Textile defines a shorthand for formatting hyperlinks. The format looks like
this:</P><PRE> "Text to display":<A href="http://example.com/">http://example.com/</A></PRE>
<P>In addition to this, you can add 'title' text to your link:</P><PRE> "Text to display (Title text)":<A href="http://example.com/">http://example.com/</A></PRE>
<P>The URL portion of the link supports relative paths as well as other
protocols like ftp, mailto, news, telnet, etc.</P><PRE> "E-mail me please":mailto:someone@example.com</PRE>
<P>You can also use single quotes instead of double-quotes if you prefer. As
with the inline formatting rules, a hyperlink must be surrounded by whitespace
to be recognized (an exception to this is common punctuation which can reside at
the end of the URL). If you have to place a URL next to some other text, use the
bracket or brace trick to do that:</P><PRE> You["gotta":<A href="http://example.com]seethis/">http://example.com]seethis/</A>!</PRE>
<P>Textile supports an alternate way to compose links. You can optionally create
a lookup list of links and refer to them separately. To do this, place one or
more links in a block of it's own (it can be anywhere within your document):</P><PRE> [excom]<A href="http://example.com/">http://example.com/</A>
[exorg]<A href="http://example.org/">http://example.org/</A></PRE>
<P>For a list like this, the text in the square brackets is used to uniquely
identify the link given. To refer to that link, you would specify it like
this:</P><PRE> "Text to display":excom</PRE>
<P>Once you've defined your link lookup table, you can use the identifiers any
number of times.</P>
<H2><A name=Images></A>Images</H2>
<P>Images are identified by the following pattern:</P><PRE> !/path/to/image!</PRE>
<P>Image attributes may also be specified:</P><PRE> !/path/to/image 10x20!</PRE>
<P>Which will render an image 10 pixels wide and 20 pixels high. Another way to
indicate width and height:</P><PRE> !/path/to/image 10w 20h!</PRE>
<P>You may also redimension the image using a percentage.</P><PRE> !/path/to/image 20%x40%!</PRE>
<P>Which will render the image at 20% of it's regular width and 40% of it's
regular height.</P>
<P>Or specify one percentage to resize proprotionately:</P><PRE> !/path/to/image 20%!</PRE>
<P>Alt text can be given as well:</P><PRE> !/path/to/image (Alt text)!</PRE>
<P>The path of the image may refer to a locally hosted image or can be a full
URL.</P>
<P>You can also use the following modifiers after the opening '!' character:</P>
<DL>
<DT><A name="<"></A><CODE>&lt;</CODE>
<DD>
<P>Align the image to the left (causes the image to float if CSS options are
enabled).</P>
<DT><A name=">"></A><CODE>&gt;</CODE>
<DD>
<P>Align the image to the right (causes the image to float if CSS options are
enabled).</P>
<DT><A name=dash></A><A name=-_(dash)></A><CODE>-</CODE> (dash)
<DD>
<P>Aligns the image to the middle.</P>
<DT><A name=^></A><CODE>^</CODE>
<DD>
<P>Aligns the image to the top.</P>
<DT><A name=tilde></A><A name=~_(tilde)></A><CODE>~</CODE> (tilde)
<DD>
<P>Aligns the image to the bottom.</P>
<DT><A name=style></A><A name={style_rule}></A><CODE>{style rule}</CODE>
<DD>
<P>Applies a CSS style rule to the image.</P>
<DT><A name=class></A><A
name=(class)_or_(#id)_or_(class#id)></A><CODE>(class)</CODE> or
<CODE>(#id)</CODE> or <CODE>(class#id)</CODE>
<DD>
<P>Applies a CSS class and/or id to the image.</P>
<DT><A name=one></A><A name=(_(one_or_more)></A><CODE>(</CODE> (one or more)
<DD>
<P>Pads 1em on the left for each '(' character.</P>
<DT><A name=one></A><A name=)_(one_or_more)></A><CODE>)</CODE> (one or more)
<DD>
<P>Pads 1em on the right for each ')' character.</P></DD></DL>
<H2><A name=Character_Replacements></A>Character Replacements</H2>
<P>A few simple, common symbols are automatically replaced:</P><PRE> (c)
(r)
(tm)</PRE>
<P>In addition to these, there are a whole set of character macros that are
defined by default. All macros are enclosed in curly braces. These include:</P><PRE> {c|} or {|c} cent sign
{L-} or {-L} pound sign
{Y=} or {=Y} yen sign</PRE>
<P>Many of these macros can be guessed. For example:</P><PRE> {A'} or {'A}
{a"} or {"a}
{1/4}
{*}
{:)}
{:(}</PRE>
<H2><A name=Lists></A>Lists</H2>
<P>Textile also supports ordered and unordered lists. You simply place an
asterisk or pound sign, followed with a space at the start of your lines.</P>
<P>Simple lists:</P><PRE> * one
* two
* three</PRE>
<P>Multi-level lists:</P><PRE> * one
** one A
** one B
*** one B1
* two
** two A
** two B
* three</PRE>
<P>Ordered lists:</P><PRE> # one
# two
# three</PRE>
<P>Styling lists:</P><PRE> (class#id)* one
* two
* three</PRE>
<P>The above sets the class and id attributes for the &lt;ul&gt; tag.</P><PRE> *(class#id) one
* two
* three</PRE>
<P>The above sets the class and id attributes for the first &lt;li&gt; tag.</P>
<P>Definition lists:</P><PRE> dl. textile:a cloth, especially one manufactured by weaving
or knitting; a fabric
format:the arrangement of data for storage or display.</PRE>
<P>Note that there is no space between the term and definition. The term must be
at the start of the line (or following the "dl" signature as shown above).</P>
<H2><A name=Tables></A>Tables</H2>
<P>Textile supports tables. Tables must be in their own block and must have pipe
characters delimiting the columns. An optional block signature of "table" may be
used, usually for applying style, class, id or other options to the table
element itself.</P>
<P>From the simple:</P><PRE> |a|b|c|
|1|2|3|</PRE>
<P>To the complex:</P><PRE> table(fig). {color:red}_|Top|Row|
{color:blue}|/2. Second|Row|
|_{color:green}. Last|</PRE>
<P>Modifiers can be specified for the table signature itself, for a table row
(prior to the first '|' character) and for any cell (following the '|' for that
cell). Note that for cells, a period followed with a space must be placed after
any modifiers to distinguish the modifier from the cell content.</P>
<P>Modifiers allowed are:</P>
<DL>
<DT><A name=style></A><A name={style_rule}></A><CODE>{style rule}</CODE>
<DD>
<P>A CSS style rule.</P>
<DT><A name=class></A><A
name=(class)_or_(#id)_or_(class#id)></A><CODE>(class)</CODE> or
<CODE>(#id)</CODE> or <CODE>(class#id)</CODE>
<DD>
<P>A CSS class and/or id attribute.</P>
<DT><A name=one></A><A name=(_(one_or_more)></A><CODE>(</CODE> (one or more)
<DD>
<P>Adds 1em of padding to the left for each '(' character.</P>
<DT><A name=one></A><A name=)_(one_or_more)></A><CODE>)</CODE> (one or more)
<DD>
<P>Adds 1em of padding to the right for each ')' character.</P>
<DT><A name="<"></A><CODE>&lt;</CODE>
<DD>
<P>Aligns to the left (floats to left for tables if combined with the ')'
modifier).</P>
<DT><A name=">"></A><CODE>&gt;</CODE>
<DD>
<P>Aligns to the right (floats to right for tables if combined with the '('
modifier).</P>
<DT><A name==></A><CODE>=</CODE>
<DD>
<P>Aligns to center (sets left, right margins to 'auto' for tables).</P>
<DT><A name="<>"></A><CODE>&lt;&gt;</CODE>
<DD>
<P>For cells only. Justifies text.</P>
<DT><A name=^></A><CODE>^</CODE>
<DD>
<P>For rows and cells only. Aligns to the top.</P>
<DT><A name=tilde></A><A name=~_(tilde)></A><CODE>~</CODE> (tilde)
<DD>
<P>For rows and cells only. Aligns to the bottom.</P>
<DT><A name=_></A><A name=__(underscore)></A><CODE>_</CODE> (underscore)
<DD>
<P>Can be applied to a table row or cell to indicate a header row or cell.</P>
<DT><A name=2></A><A name=\2_or_\3_or_\4,_etc.></A><CODE>\2</CODE> or
<CODE>\3</CODE> or <CODE>\4</CODE>, etc.
<DD>
<P>Used within cells to indicate a colspan of 2, 3, 4, etc. columns. When you
see "\", think "push forward".</P>
<DT><A name=2></A><A name=/2_or_/3_or_/4,_etc.></A><CODE>/2</CODE> or
<CODE>/3</CODE> or <CODE>/4</CODE>, etc.
<DD>
<P>Used within cells to indicate a rowspan or 2, 3, 4, etc. rows. When you see
"/", think "push downward".</P></DD></DL>
<P>When a cell is identified as a header cell and an alignment is specified,
that becomes the default alignment for cells below it. You can always override
this behavior by specifying an alignment for one of the lower cells.</P>
<H2><A name=CSS_Notes></A>CSS Notes</H2>
<P>When CSS is enabled (and it is by default), CSS class names are automatically
applied in certain situations.</P>
<DL>
<DT><A name=Aligning></A><A
name=Aligning_a_block_or_span_or_other_element_to_left,_right,_etc.></A>Aligning
a block or span or other element to left, right, etc.

<DD>
<P>"left" for left justified, "right" for right justified, "center" for
centered text, "justify" for full-justified text.</P>
<DT><A name=Aligning></A><A
name=Aligning_an_image_to_the_top_or_bottom></A>Aligning an image to the top
or bottom
<DD>
<P>"top" for top alignment, "bottom" for bottom alignment, "middle" for middle
alignment.</P>
<DT><A name=Footnotes></A>Footnotes
<DD>
<P>"footnote" is applied to the paragraph tag for the footnote text itself. An
id of "fn" plus the footnote number is placed on the paragraph for the
footnote as well. For the footnote superscript tag, a class of "footnote" is
used.</P>
<DT><A name=Capped></A><A name=Capped_text></A>Capped text
<DD>
<P>For a series of characters that are uppercased, a span is placed around
them with a class of "caps".</P></DD></DL>
<H2><A name=Miscellaneous></A>Miscellaneous</H2>
<P>Textile tries to do it's very best to ensure proper XHTML syntax. It will
even attempt to fix errors you may introduce writing in HTML yourself. Unescaped
'&amp;' characters within URLs will be properly escaped. Singlet tags such as

br, img and hr are checked for the '/' terminator (and it's added if necessary).
The best way to make sure you produce valid XHTML with Textile is to not use any
HTML markup at all-- use the Textile syntax and let it produce the markup for
you.</P>


Lewiki uses the Perl module Text::Textile, which was written by Brad Choate, brad@bradchoate.com. It is an adaptation of Textile, developed by Dean Allen of <a href="http://www.textism.com/">Textism.com</a>.

<br />
<br />

<h2>Document fragment linking</h2>

<p>
The following feature doc is from http://instiki.org/show/Textile.
</p>

<p>
This was used to set up the link list at the top of this page. It doesn’t appear to be documented anywhere – inluding either http://hobix.com/textile/quick.html or http://textism.com/tools/textile/ – and it’s very handy for writers who need to link from one place in a document to another part of the same document.
</p>

<p>
Footnote creation and linking is a similar idea, but it’s done differently from the method shown here, and isn’t really equivalent.
</p>

<p>
Here’s how to do it:
</p>

<p>
Do this:
</p>

<p>
This is a "link from here":#to_here
</p>

<p>
h4(#to_here). To here
</p>

<p>
…to get this:
</p>

<p>
This is a link from here
</p>

<p>
To here
</p>

<p>
One can link to a header, but also to a paragraph, like so (showing only the anchor):
</p>

<p>
p(#anchor). Paragraph text
</p>

==

h2. Working Examples

==

table.
|{background:#f8eaba;border:1px solid #ccc;width:45%;padding:5px;vertical-align:top;}. {For Toledo Wi-Fi}|{background:#ffdddd;border:1px solid #ccc;width:45%;align:top;padding:5px;verticle-align:top;}. {Against Toledo Wi-Fi}|.

==

produces "this":http://www.toledotalk.com/cgi-bin/lewiki.pl/article/1437/Toledo_Wi-Fi_Debate

br.
table{border:1px solid black; width: 500px;}.
| |\4=. *Number of Servings*|
| |3|6|9|12|
|*Ingredients*|\4=. *Number of Shots*|
|Cuervo Gold Tequila| 2| 4| 6| 8|
|Cointreau| 0.75| 1.5| 2.25| 3|
|Grand Marnier| 0.75| 1.5| 2.25| 3|
|Sweet & Sour Mix| 6| 12| 18| 24|
|Rose's Lime| 1 Splash| 2 Splashes| 3 Splashes| 4 Splashes|



produces "this":http://www.toledotalk.com/cgi-bin/lewiki.pl/article/1605/Jr_recipes#Margaritas



edit=no