Topic: [TEST] sva_parserus (the Parserus parser for PunBB)
Link https://github.com/MioVisman/punbb_exte … a_parserus
My Parserus parser as expansions for PunBB forum.
Replaces (or tries to replace ) the standard parser.
Requirements: PHP >= 5.4.0
For the work uses hooks:
es_essentials - connection of an automatic loader;
ps_start - initial settings of the parser;
ps_parse_message_start - parsing of messages to html;
ps_parse_signature_start - parsing of signatures to html;
ps_preparse_bbcode_start - verification of the entered messages, removal of empty bb-codes, auto detection of exiles, return of mistakes.
* Remaining hooks from include/parser.php (except hook from the handle_url_tag() and handle_img_tag() functions) shan't be executed as are left in the basket, in an old parser.
Two new hooks are added (at the moment):
parserus_start_vars - for installation of variables before start of the parser:
$smilies - original array of smiles
$smFolder - way to the folder with smiles (by default $base_url . '/img/smilies/')
$smTpl - template for display of smiles (by default '<img src="{url}" alt="{alt}">')
$whiteListForSign - array of bb-codes of the allowed in the signature (by default ['b', 'i', 'u', 'color', 'colour', 'email', 'img', 'url'])
parserus_start_set - for setup of the parser after its initialization (adding of new bb-codes, parser variables).
$parser - link to the parser (class ParserusEx)
Now the parser knows standard bb-codes (b, i, u, color, colour, h, quote, code, email, *, list, img, url) and spoiler bb-code (from my sva_spoiler extension).
It is easily possible to create difficult bb-codes.
Example (implementation of the table, 11 parameters in a bb-code):
[table align="right" border="1" bordercolor="#ccc" cellpadding="5" cellspacing="0" style="border-collapse:collapse; width:500px"]
[tr]
[th style=width:50%]Position[/th]
[th style=width:50%]Astronaut[/th]
[/tr]
[tr]
[td]Commander[/td]
[td]Neil A. Armstrong[/td]
[/tr]
[tr]
[td]Command Module Pilot[/td]
[td]Michael Collins[/td]
[/tr]
[tr]
[td]Lunar Module Pilot[/td]
[td]Edwin "Buzz" E. Aldrin, Jr.[/td]
[/tr]
[/table]
[url][img]http://localhost/punbb/img/avatars/2.gif[/img][b]picture link[/b][/url]
-->
<a href="http://localhost/punbb/img/avatars/2.gif"><span class="postimg"><img src="http://localhost/punbb/img/avatars/2.gif" alt="2.gif" /></span><strong>picture link</strong></a>
I speak only Russian :P