$esc
$esc : string
Escape string to try to prevent incorrect nesting of div for some of the substitutions;
Class with methods to parse mediawiki documents, both within Yioop, and when Yioop indexes mediawiki dumps as from Wikipedia.
__construct(string $base_address = "", array $add_substitutions = array(), boolean $minimal = false)
Used to initialize the arrays of match/replacements used to format wikimedia syntax into HTML (not perfectly since we are only doing regexes)
string | $base_address | base url for link substitutions |
array | $add_substitutions | additional wiki rule subsitutions in addition to the default ones that should be used by this wiki parser |
boolean | $minimal | substitution list is shorter - suitable for posting to discussion |
parse(string $document, boolean $parse_head_vars = true, boolean $handle_big_files = false) : string
Parses a mediawiki document to produce an HTML equivalent
string | $document | a document which might have mediawiki markup |
boolean | $parse_head_vars | header variables are an extension of mediawiki syntax used to add meta variable and titles to the head tag of an html document. This flag controls whether to support this extension or not |
boolean | $handle_big_files | for indexing purposes Yioop by default truncates long documents before indexing them. If true, this method does not do this default truncation. The true value is more useful when using Yioop's built-in wiki. |
HTML document obtained by parsing mediawiki markup in $document
processRegexes(string $document) : string
Applies all the wiki subsitutions of this WikiParser to the document to create an html document makes use of @see processProvidedRegexes
string | $document | a document with wiki syntax |
result of subistutions to make html
processProvidedRegexes(array $matches, array $replaces, string $document) : string
Applies a set of transformations from wiki syntax to html to a document
array | $matches | an array of things to match for |
array | $replaces | what to replace matches with |
string | $document | wiki document to fix |
document after substitutions
insertTableOfContents(string $page, string $toc) : string
After regex processing has been done on a wiki page this function inserts into the resulting page a table of contents just before the first h2 tag, then returns the result page
string | $page | page in which to insert table of contents |
string | $toc | HTML table of contents |
resulting page after insert
insertReferences(string $page, string $references) : string
After regex processing has been done on a wiki page this function inserts into the resulting page a reference at {{reflist locations, then returns the result page
string | $page | page in which to insert the reference lists |
string | $references | HTML table of contents |
resulting page after insert