diff options
-rwxr-xr-x | aux/emparse | 29 | ||||
-rw-r--r-- | mkfile | 3 | ||||
-rw-r--r-- | test.em | 11 | ||||
-rw-r--r-- | test.html | 14 |
4 files changed, 34 insertions, 23 deletions
diff --git a/aux/emparse b/aux/emparse index 73fdd5c..e59487d 100755 --- a/aux/emparse +++ b/aux/emparse @@ -15,7 +15,7 @@ function escape(s) { } function beginblock(name) { - if (name == "nl") printf "<ol>\n" + if (name == "nl") printf "<ol class=\"reflist\" style=\"font-size: small;\">\n" else printf "<%s>\n", name } @@ -57,8 +57,8 @@ function heading(level, line) { function item(level, type, line) { if (openitem) printf "</li>" openitem = 1 - if (level > itemlevel) printf "<ul>\n" - if (level < itemlevel) printf "</ul>\n" + if (level > itemlevel) printf "<%s>\n", type + if (level < itemlevel) printf "</%s>\n", type itemlevel = level if (type == "ul") { sub("^ +- ", "") @@ -92,8 +92,7 @@ function term(line, t) { # t is a local variable function ref(v) { if (ENVIRON["ref" v] != "") return "(<a href=\"" ENVIRON["ref" v] "\">" linktext "</a>)" - else - return "[<a href=\"#ref" v "\">" v "</a>]" + return "[<a href=\"#ref" v "\">" v "</a>]" } function format(line) { @@ -179,15 +178,15 @@ openblock == "nl" && /^ \[[0-9a-z]\]+ [^ ]+$/ { next } # hyperlink reference openblock == "nl" && /^ \[[0-9a-z]\]+ / { item(1, "nl", line) } # text reference openblock == "dl" && /^ .*: / { term(line) } -openblock == "ul" && /^ -/ { item(2, "ul", line) } -openblock == "ol" && /^ [0-9a-z]+\./ { item(2, "ol", line) } -openblock == "ul" && /^ -/ { item(3, "ul", line) } -openblock == "ol" && /^ [0-9a-z]+\./ { item(3, "ol", line) } -openblock == "ul" && /^ -/ { item(4, "ul", line) } -openblock == "ol" && /^ [0-9a-z]+\./ { item(4, "ol", line) } -openblock == "ul" && /^ -/ { item(5, "ul", line) } -openblock == "ol" && /^ [0-9a-z]+\./ { item(5, "ol", line) } -openblock == "ul" && /^ -/ { item(6, "ul", line) } -openblock == "ol" && /^ [0-9a-z]+\./ { item(6, "ol", line) } +(openblock == "ul" || openblock == "ol") && /^ -/ { item(2, "ul", line) } +(openblock == "ul" || openblock == "ol") && /^ [0-9a-z]+\./ { item(2, "ol", line) } +(openblock == "ul" || openblock == "ol") && /^ -/ { item(3, "ul", line) } +(openblock == "ul" || openblock == "ol") && /^ [0-9a-z]+\./ { item(3, "ol", line) } +(openblock == "ul" || openblock == "ol") && /^ -/ { item(4, "ul", line) } +(openblock == "ul" || openblock == "ol") && /^ [0-9a-z]+\./ { item(4, "ol", line) } +(openblock == "ul" || openblock == "ol") && /^ -/ { item(5, "ul", line) } +(openblock == "ul" || openblock == "ol") && /^ [0-9a-z]+\./ { item(5, "ol", line) } +(openblock == "ul" || openblock == "ol") && /^ -/ { item(6, "ul", line) } +(openblock == "ul" || openblock == "ol") && /^ [0-9a-z]+\./ { item(6, "ol", line) } { format($0) } @@ -1,2 +1,5 @@ test: em test.em > test.html + +README.html: README + em README > README.html @@ -1,6 +1,6 @@ = Em example = -This is an example of *Em* [1]. +This is an example of *em* [a]. - Here is an unordered list item. @@ -11,10 +11,13 @@ ordered list item. 2. Here is another. - Here is a list - - With another list inside it [a] + - With another list inside it [1] - [1] http://example.com - [a] Reference list item + 1. Here is a mixed nested list + - An unordered item + + [1] Reference list item + [a] http://example.com term: definition long term: long @@ -1,6 +1,6 @@ <h1>Em example</h1> <p> -This is an example of <i>Em</i> (<a href="http://example.com">link</a>). +This is an example of <i>em</i> (<a href="http://example.com">link</a>). </p> <ul> <li>Here is an @@ -17,13 +17,19 @@ ordered list item. <ul> <li>Here is a list </li><ul> -<li>With another list inside it [<a href="#refa">a</a>] +<li>With another list inside it [<a href="#ref1">1</a>] </li> </ul> </ul> <ol> -<li value="1" id="ref1">http://example.com -</li><li value="a" id="refa">Reference list item +<li value="1">Here is a mixed nested list +</li><ul> +<li>An unordered item +</li> +</ol> +</ol> +<ol class="reflist" style="font-size: small;"> +<li value="1" id="ref1">Reference list item </li> </ol> <dl> |