Is it possible to have a numbered list instead of this:
Not as standard, but it would be an easy mod (trivial if you want ordered lists *instead* of unordered, but not hard to offer both).
For a quick hack, search Subs.php for:
// Lists... [list][*]First, ...[o]Second![li]THIRD!!![/li][/list]
'~\[list\](?:<br />)?~i' => isset($disabled['list']) || isset($disabled['li']) ? '' : '<ul style="margin-top: 0; margin-bottom: 0;">',
'~\[/list\](?:<br />)?~i' => isset($disabled['list']) || isset($disabled['li']) ? '' : '</ul>',
'~(?:<br />| |\s)*\[li\](.+?)\[/li\](?:<br />| |\s)*~i' => isset($disabled['list']) || isset($disabled['li']) ? '<br />$1<br />' : '<li>$1</li>',
And add after:
// Lists... [olist][*]First, ...[o]Second![li]THIRD!!![/li][/olist]
'~\[olist\](?:<br />)?~i' => isset($disabled['olist']) || isset($disabled['li']) ? '' : '<ol style="margin-top: 0; margin-bottom: 0;">',
'~\[/olist\](?:<br />)?~i' => isset($disabled['olist']) || isset($disabled['li']) ? '' : '</ol>',
'~(?:<br />| |\s)*\[li\](.+?)\[/li\](?:<br />| |\s)*~i' => isset($disabled['olist']) || isset($disabled['li']) ? '<br />$1<br />' : '<li>$1</li>',
And type 'olist' instead of 'list' for the tags.
Great! Thanks! ;D
PS Needs a little tweaking because some of the alternate list style tags (eg #) still produce their unordered bullet styles, but it's fine with 'li' and I'll sort the others soon.
Don't think it's worth modifying further because that'd involve the 'li' as well as 'list' tags so, on second thoughts (and because the results of # etc. are hardly catastrophic), I'd just stick to posting with the valid opening and closing 'li' tags.
Thanks for the help Peter!
Just realised (after deciding to upload this to one of my sites) that I've inadvertently posted CVS code where things have been changed. So the equivalent hack for RC2 should be to search Subs.php for:
// Lists... [list][*]First, ...[o]Second![li]THIRD!!![/li][/list]
'~\[list\](?:<br />)?~i' => '<ul style="margin-top: 0; margin-bottom: 0;">',
'~\[/list\](?:<br />)?~i' => '</ul>',
'~(?:<br />| |\s)*\[li\](.+?)\[/li\](?:<br />| |\s)*~i' => '<li>$1</li>',
And add after:
// Lists... [olist][*]First, ...[o]Second![li]THIRD!!![/li][/olist]
'~\[olist\](?:<br />)?~i' => '<ol style="margin-top: 0; margin-bottom: 0;">',
'~\[/olist\](?:<br />)?~i' => '</ol>',
'~(?:<br />| |\s)*\[li\](.+?)\[/li\](?:<br />| |\s)*~i' => '<li>$1</li>',
Sorry about that!
Also just discovered that the new 'olist' tag isn't recognised by the 'printpage' action, but I did say it was a *quick* hack. So you might be interested in Anguz's Custom BB Code mod, but I might equally well finish the ordered list tag properly sometime (which should also mean including some alternative list styles) because it's something I've always missed too.
Quote from: Peter Duggan on December 18, 2004, 02:57:09 PM
which should also mean including some alternative list styles
Here we go again:
// Lists... [olist][*]First, ...[o]Second![li]THIRD!!![/li][/olist]
'~\[olist\](?:<br />)?~i' => '<ol style="margin-top: 0; margin-bottom: 0;">',
'~\[olist style=la\](?:<br />)?~i' => '<ol style="margin-top: 0; margin-bottom: 0; list-style-type: lower-alpha;">',
'~\[olist style=ua\](?:<br />)?~i' => '<ol style="margin-top: 0; margin-bottom: 0; list-style-type: upper-alpha;">',
'~\[olist style=lr\](?:<br />)?~i' => '<ol style="margin-top: 0; margin-bottom: 0; list-style-type: lower-roman;">',
'~\[olist style=ur\](?:<br />)?~i' => '<ol style="margin-top: 0; margin-bottom: 0; list-style-type: upper-roman;">',
'~\[/olist\](?:<br />)?~i' => '</ol>',
'~(?:<br />| |\s)*\[li\](.+?)\[/li\](?:<br />| |\s)*~i' => '<li>$1</li>',
Lower/upper alpha and lower/upper roman styles (haven't bothered with decimal because you'll get that by default with no 'style=' attribute). So type
[olist style=la]
For lower alpha,
[olist style=ua]
For upper alpha,
[olist style=lr]
For lower roman and
[olist style=ur]
For upper roman.
:) Very cool!
Thanks!
Sorry to bump this, but is there any chance of getting an updated and working version of this? Perhaps make it into a MOD?