Michael Regan wrote:Rather than make a replacement BBCode, is there a way to alter the existing LIST code to allow numberic listing to begin at a numebr other than one?
It's not that simple, but possible.
Open
/includes/bbcode.php and find:
After, add:
Code: Select all
/*** 2011-02-25 BEGIN AmigoJack
Allow a start parameter ***/
$sStart= '';
if( preg_match( '#^[^,"\'],([0-9]+)$#', $type, $aMatch ) ) {
$sStart= '" start="'. $aMatch[1];
$type= substr( $type, 0, -strlen( $aMatch[1] )- 1 );
}
/*** 2011-02-25 END ***/
Find:
Code: Select all
return str_replace('{LIST_TYPE}', $type, $this->bbcode_tpl($tpl));
}
Before, add:
Code: Select all
/*** 2011-02-25 BEGIN AmigoJack
Add possible HTML start attribute ***/
$type.= $sStart;
/*** 2011-02-25 END ***/
Open
/includes/message_parser.php and find:
Code: Select all
'list' => array('bbcode_id' => 9, 'regexp' => array('#\[list(?:=(?:[a-z0-9]|disc|circle|square))?].*\[/list]#ise' => "\$this->bbcode_parse_list('\$0')")),
Replace with:
Code: Select all
/*** 2011-02-25 BEGIN AmigoJack
Also allow optional start ***/
//'list' => array('bbcode_id' => 9, 'regexp' => array('#\[list(?:=(?:[a-z0-9]|disc|circle|square))?].*\[/list]#ise' => "\$this->bbcode_parse_list('\$0')")),
'list' => array('bbcode_id' => 9, 'regexp' => array('#\[list(?:=(?:[a-z0-9]|disc|circle|square))?(,[0-9]+)?].*\[/list]#ise' => "\$this->bbcode_parse_list('\$0')")),
/*** 2011-02-25 END ***/
Find:
Code: Select all
else if (preg_match('#^list(=[0-9a-z]+)?$#i', $buffer, $m))
Replace with:
Code: Select all
/*** 2011-02-25 BEGIN AmigoJack
Allow optional start parameter ***/
//else if (preg_match('#^list(=[0-9a-z]+)?$#i', $buffer, $m))
else if (preg_match('#^list(=[0-9a-z]+)?(,[0-9]+)?$#i', $buffer, $m))
/*** 2011-02-25 END ***/
Tested.
Now you have an optional second parameter for the
list BBCode, separated by a comma and the ordinal. Example:
Code: Select all
[list=a,5]
[*]starts with letter e, because it's the 5th
[*]continues with letter f, because it's the 6th
[*]... (works for all ordered list style types: 0, a, A, i, I)
[/list]