Overview
SHA1 Hash: | 2bb1d6469f96de4575aff0410a59d64f8fe0ee18 |
---|---|
Date: | 2009-12-09 14:39:20 |
User: | jeremy_c |
Comment: |
|
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/wiki.c from [c28c68f6a8] to [362c97b880].
@@ -630,18 +630,20 @@ */ void wikirules_page(void){ style_header("Wiki Formatting Rules"); @ <h2>Formatting Rule Summary</h2> @ <ol> - @ <li> Blank lines are paragraph breaks - @ <li> Bullets are "*" surrounded by two spaces at the beginning of the line. - @ <li> Enumeration items are a number surrounded by two space - @ at the beginning of a line. - @ <li> Indented pargraphs begin with a tab or two spaces. - @ <li> Hyperlinks are contained with square brackets: "[target]" - @ <li> Most ordinary HTML works. - @ <li> <verbatim> and <nowiki>. + @ <li>Blank lines are paragraph breaks</li> + @ <li>Bullets are "*" surrounded by two spaces at the beginning of the + @ line.</li> + @ <li>Enumeration items are "#" surrounded by two spaces at the beginning of + @ a line.</li> + @ <li>Indented pargraphs begin with a tab or two spaces.</li> + @ <li>Hyperlinks are contained with square brackets: "[target]" or + @ "[target|name]".</li> + @ <li>Most ordinary HTML works.</li> + @ <li><verbatim> and <nowiki>.</li> @ </ol> @ <p>We call the first five rules above "wiki" formatting rules. The @ last two rules are the HTML formatting rule.</p> @ <h2>Formatting Rule Details</h2> @ <ol> @@ -653,16 +655,13 @@ @ A bullet list item is a line that begins with a single "*" character @ surrounded on @ both sides by two or more spaces or by a tab. Only a single level @ of bullet list is supported by wiki. For nested lists, use HTML.</p> @ <li> <p><b>Enumeration Lists</b>. - @ An enumeration list item is a line that begins - @ with one or more digits optionally - @ followed by a "." and is surrounded on both sides by two or more spaces or - @ by a tab. The number is significant and becomes the number shown - @ in the rendered enumeration item. Only a single level of enumeration - @ list is supported by wiki. For nested enumerations or for + @ An enumeration list item is a line that begins with a single "#" character + @ surrounded on both sides by two or more spaces or by a tab. Only a single + @ level of enumeration list is supported by wiki. For nested lists or for @ enumerations that count using letters or roman numerials, use HTML.</p> @ <li> <p><b>Indented Paragraphs</b>. @ Any paragraph that begins with two or more spaces or a tab and @ which is not a bullet or enumeration list item is rendered @ indented. Only a single level of indentation is supported by wiki; use
Modified src/wikiformat.c from [b5af4fe5ac] to [b1603948aa].
@@ -329,14 +329,15 @@ #define TOKEN_MARKUP 1 /* <...> */ #define TOKEN_CHARACTER 2 /* "&" or "<" not part of markup */ #define TOKEN_LINK 3 /* [...] */ #define TOKEN_PARAGRAPH 4 /* blank lines */ #define TOKEN_NEWLINE 5 /* A single "\n" */ -#define TOKEN_BULLET 6 /* " * " */ -#define TOKEN_ENUM 7 /* " \(?\d+[.)]? " */ -#define TOKEN_INDENT 8 /* " " */ -#define TOKEN_TEXT 9 /* None of the above */ +#define TOKEN_BUL_LI 6 /* " * " */ +#define TOKEN_NUM_LI 7 /* " # " */ +#define TOKEN_ENUM 8 /* " \(?\d+[.)]? " */ +#define TOKEN_INDENT 9 /* " " */ +#define TOKEN_TEXT 10 /* None of the above */ /* ** State flags */ #define AT_NEWLINE 0x001 /* At start of a line */ @@ -452,23 +453,23 @@ return i>1 && z[i]==';'; } } /* -** Check to see if the z[] string is the beginning of a wiki bullet. +** Check to see if the z[] string is the beginning of a wiki list item. ** If it is, return the length of the bullet text. Otherwise return 0. */ -static int bulletLength(const char *z){ +static int listItemLength(const char *z, const char listChar){ int i, n; n = 0; i = 0; while( z[n]==' ' || z[n]=='\t' ){ if( z[n]=='\t' ) i++; i++; n++; } - if( i<2 || z[n]!='*' ) return 0; + if( i<2 || z[n]!=listChar ) return 0; n++; i = 0; while( z[n]==' ' || z[n]=='\t' ){ if( z[n]=='\t' ) i++; i++; @@ -578,13 +579,18 @@ *pTokenType = TOKEN_NEWLINE; return 1; } } if( (p->state & AT_NEWLINE)!=0 && isspace(z[0]) ){ - n = bulletLength(z); + n = listItemLength(z, '*'); + if( n>0 ){ + *pTokenType = TOKEN_BUL_LI; + return n; + } + n = listItemLength(z, '#'); if( n>0 ){ - *pTokenType = TOKEN_BULLET; + *pTokenType = TOKEN_NUM_LI; return n; } n = enumLength(z); if( n>0 ){ *pTokenType = TOKEN_ENUM; @@ -1059,11 +1065,11 @@ case TOKEN_NEWLINE: { blob_append(p->pOut, "\n", 1); p->state |= AT_NEWLINE; break; } - case TOKEN_BULLET: { + case TOKEN_BUL_LI: { if( inlineOnly ){ blob_append(p->pOut, " • ", -1); }else{ if( p->wikiList!=MARKUP_UL ){ if( p->wikiList ){ @@ -1070,10 +1076,29 @@ popStackToTag(p, p->wikiList); } pushStack(p, MARKUP_UL); blob_append(p->pOut, "<ul>", 4); p->wikiList = MARKUP_UL; + } + popStackToTag(p, MARKUP_LI); + startAutoParagraph(p); + pushStack(p, MARKUP_LI); + blob_append(p->pOut, "<li>", 4); + } + break; + } + case TOKEN_NUM_LI: { + if( inlineOnly ){ + blob_append(p->pOut, " # ", -1); + }else{ + if( p->wikiList!=MARKUP_OL ){ + if( p->wikiList ){ + popStackToTag(p, p->wikiList); + } + pushStack(p, MARKUP_OL); + blob_append(p->pOut, "<ol>", 4); + p->wikiList = MARKUP_OL; } popStackToTag(p, MARKUP_LI); startAutoParagraph(p); pushStack(p, MARKUP_LI); blob_append(p->pOut, "<li>", 4);