|
|
ewiki_format() internalsWhen the function receives the input string (WikiSource+), it first escapes all html tags using & < > to replace the & < > chars (because HTML is not allowed within Wiki, initially). Then it runs optional ["format_source"] plugins on the whole wiki page (still one source string). Afterwards ewiki_format() starts to split that wikisource into fragments meant to get handled by ["format_block"] plugins AND/OR the Wiki -> HTML transformation code inside of it. It creates an array called $iii[] from it - each fragment being an array on its own: $iii0+ = array( 0 => "WikiSource+ ...", 1 => 0x0FFF, 2 => "core", ); Initially we here just have one fragment 0+ - and often this remains the only one (if no block plugin activates for the current WikiPage+). The 0=> entry contains the body (wiki source) of a fragment, while at the 1=> index you'll find the block flags and 2=> is just the name of the block plugin to handle that fragment. If there is some block code, like <htm>...</htm> or <pre>... in the WikiPage+, you'll end up with a larger $iii[] input array: $iii0+ = array("WikiSource+...",0xFFFF,"core"),
$iii1+ = array("<b>....",0x0002,"html"),
$iii2+ = array("text",0x0FFF,""),
Besides the $iii[] input array, we'll also have an array containing rendering status variables called $s[]. The most important entry there is $s["in"], which is the index into the currently accessed $iii[] wiki page source or block fragment. And ewiki_format() then uses various alias variable names for entries of the status var $s[] array - for example $in and $s["in"] are the same index number. After ewiki_format() separated the input source into the block fragments of $iii[], it will then run the actual ["fragment_block"] plugins on it. These can then apply regexs on them, or strip the fragments completely out of $iii[] or transform then into regular wiki source. Then the large wiki transform loop comes into action, but only for $iii[] fragments, whose flags (in the $iii...+1+ number) have the bit 0x0001 set. Other blocks/fragments of $iii[] remain untouched. While transforming the $iii[] arrays WikiSource+ a new fragments array will be created, called $ooo[] - the output array, which has exactly the same layout. And every $iii$in+ directly maps to the $ooo$in+ - same index number! But the later then already contains <html> instead of wiki source. Inside of the transformation loop, two other plugin types are activated (besides applying the $ewiki_config["wm_..."] ruleset): the ["format_line"] and ["format_para"] plugin groups. After all $iii[] blocks have been transformed into $ooo[], a second loop will check the flags (this time $ooo...+1+) for the bit 0x0002 which tells, if WikiWords+ should be transformed into html <a href=> links. After link conversion (on the selected fragments), all blocks (the content entries $ooo...+0+ of course) of $ooo[] are merged together into one <html> string. After the ["format_final"] plugins run over this, ewiki_format() returns the resulting <html> page. </pre> prev << "format_* / rendering plugins"next >> "the format_ plugin hooks" You cannot modify the INTERNALS file, but anyhow any ideas or suggestion should as usually get filed on BugReports, UserSuggestions or even better the INTERNALS.Discussion. |