This patch against Tavi 0.26 adds more enumeration types: romans and letters. You can mix these styles with all other list types.
i. i. i. a. a. a.
would roughly look:
diff -burN release-0.26/parse/html.php formatting/parse/html.php
--- release-0.26/parse/html.php 2006-10-22 00:12:53.693588080 +0200
+++ formatting/parse/html.php 2006-10-22 00:14:08.786172272 +0200
@@ -38,9 +38,17 @@
{ return "<ul $attr>"; }
function html_ul_end()
{ return "</ul>\n"; }
-function html_ol_start()
- { return '<ol>'; }
-function html_ol_end()
+function html_ol_start($attr='') {
+ switch ($attr) {
+ case 'a':
+ case 'A':
+ case 'i':
+ case 'I':
+ return "<ol type=\"$attr\">";
+ }
+ return '<ol>'; //default
+}
+function html_ol_end($attr='')
{ return "</ol>\n"; }
function html_li_start()
{ return '<li>'; }
diff -burN release-0.26/parse/transforms.php formatting/parse/transforms.php
--- release-0.26/parse/transforms.php 2006-10-22 00:12:53.692588232 +0200
+++ formatting/parse/transforms.php 2006-10-22 00:14:08.507214680 +0200
@@ -468,9 +468,9 @@
// Locate the indent prefix characters.
- preg_match('/^([:\\*#]*)(;([^:]*):)?(.*\\n?$)/', $text, $result);
+ preg_match('/^(([:\\*#]|1\\.|[Aa]\\.|[Ii]\\.)*)(;([^:]*):)?(.*\\n?$)/', $text, $result);
- if($result[2] != '') // Definition list.
+ if($result[3] != '') // Definition list.
{ $result[1] = $result[1] . ';'; }
// No list on last line, no list on this line. Bail out:
@@ -478,12 +478,16 @@
if($last_prefix == '' && $result[1] == '')
{ return $text; } // Common case fast.
+// Remove dots from [1ai]., such that one indentation level takes one char
+
+ $result[1] = preg_replace('/\\./', '', $result[1]);
+
// Remember lengths of strings.
$last_len = strlen($last_prefix);
$prefix_len = strlen($result[1]);
- $text = $result[4];
+ $text = $result[5];
$fixup = '';
@@ -543,11 +547,11 @@
// Start the list *item*.
- if($result[2] != '') // Definition list.
+ if($result[3] != '') // Definition list.
{
$fixup = $fixup
. new_entity(array('term_item_start'))
- . $result[3]
+ . $result[4]
. new_entity(array('term_item_end'));
}
@@ -569,6 +573,8 @@
{ return new_entity(array('indent_list_' . $fn)); }
else if($type == '#')
{ return new_entity(array('numbered_list_' . $fn)); }
+ else if($type == '1' || $type == 'A' || $type == 'a' || $type == 'i' || $type == 'I')
+ { return new_entity(array('numbered_list_' . $fn, $type)); }
}
function entity_listitem($type, $fn)
@@ -577,7 +583,7 @@
{ return new_entity(array('bullet_item_' . $fn)); }
else if($type == ':' || $type == ';')
{ return new_entity(array('indent_item_' . $fn)); }
- else if($type == '#')
+ else if($type == '#' || $type == '1' || $type == 'A' || $type == 'a' || $type == 'i' || $type == 'I')
{ return new_entity(array('numbered_item_' . $fn)); }
}