- # Unordered list
- } else if ( match( block, "(^|\n) ? ? ?[-+*][ \t][^\n]+(\n|$)" \
- "(([ \t]*\n)* ? ? ?[-+*][ \t][^\n]+(\n|$)" \
- "|([ \t]*\n)*( ? ? ?\t| +)[^\n]+(\n|$)" \
- "|[^\n \t][^\n]+(\n|$))*" ) ) {
- st = RSTART; len = RLENGTH; list = substr( block, RSTART, RLENGTH);
- sub("^\n", "", list); match(list, "^ ? ? ?[-+*]"); indent = RLENGTH;
- gsub( "(^|\n) {0," indent - 1 "}", "\n", list); sub("^\n", "", list);
-
- text = substr(block, 1, st - 1); block = substr(block, st + len);
- if (match( list, "\n([0-9]+\\.|#\\.)[ \t]" )) {
- block = substr(list, RSTART + 1) block;
- list = substr(list, 1, RSTART);
- }
-
- return _block( text ) "<ul>\n" _list( list, "[-+*]" ) "</ul>\n" _block( block );
-
- # Ordered list
- } else if ( match( block, "(^|\n) ? ? ?([0-9]+\\.|#\\.)[ \t][^\n]+(\n|$)" \
- "(([ \t]*\n)* ? ? ?([0-9]+\\.|#\\.)[ \t][^\n]+(\n|$)" \
- "|([ \t]*\n)*( ? ? ?\t| +)[^\n]+(\n|$)" \
- "|[^\n \t][^\n]+(\n|$))*" ) ) {
- st = RSTART; len = RLENGTH; list = substr( block, RSTART, RLENGTH);
- sub("^\n", "", list); match(list, "^ ? ? ?[0-9#]"); indent = RLENGTH;
- gsub( "(^|\n) {0," indent - 1 "}", "\n", list); sub("^\n", "", list);
-
- text = substr(block, 1, st - 1); block = substr(block, st + len);
- if (match( list, "\n[-+*][ \t]" )) {
- block = substr(list, RSTART + 1) block;
- list = substr(list, 1, RSTART);
- }
-
- return _block( text ) "<ol>\n" _list( list, "([0-9]+\\.|#\\.)" ) "</ol>\n" _block( block );
+ # Unordered list types
+ } else if ( text = _startlist( block, "ul", "-", "([+*]|[0-9]+\\.|#\\.|[0-9]+\\)|#\\))") ) {
+ return text;
+ } else if ( text = _startlist( block, "ul", "\\+", "([-*]|[0-9]+\\.|#\\.|[0-9]+\\)|#\\))") ) {
+ return text;
+ } else if ( text = _startlist( block, "ul", "\\*", "([-+]|[0-9]+\\.|#\\.|[0-9]+\\)|#\\))") ) {
+ return text;
+
+ # Ordered list types
+ } else if ( text = _startlist( block, "ol", "[0-9]+\\.", "([-+*]|#\\.|[0-9]+\\)|#\\))") ) {
+ return text;
+ } else if ( text = _startlist( block, "ol", "[0-9]+\\)", "([-+*]|[0-9]+\\.|#\\.|#\\))") ) {
+ return text;
+ } else if ( text = _startlist( block, "ol", "#\\.", "([-+*]|[0-9]+\\.|[0-9]+\\)|#\\))") ) {
+ return text;
+ } else if ( text = _startlist( block, "ol", "#\\)", "([-+*]|[0-9]+\\.|#\\.|[0-9]+\\))") ) {
+ return text;