]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - lib/InlineParser.php
Update comments for isImageLink
[SourceForge/phpwiki.git] / lib / InlineParser.php
1 <?php 
2 rcs_id('$Id$');
3 /* Copyright (C) 2002 Geoffrey T. Dairiki <dairiki@dairiki.org>
4  * Copyright (C) 2004-2008 Reini Urban
5  * Copyright (C) 2008 Marc-Etienne Vargenau, Alcatel-Lucent
6  *
7  * This file is part of PhpWiki.
8  * 
9  * PhpWiki is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  * 
14  * PhpWiki is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  * 
19  * You should have received a copy of the GNU General Public License
20  * along with PhpWiki; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23 /**
24  * This is the code which deals with the inline part of the (new-style)
25  * wiki-markup.
26  *
27  * @package Markup
28  * @author Geoffrey T. Dairiki, Reini Urban
29  */
30 /**
31  */
32
33 /**
34  * This is the character used in wiki markup to escape characters with
35  * special meaning.
36  */
37 define('ESCAPE_CHAR', '~');
38
39 require_once(dirname(__FILE__).'/HtmlElement.php');
40 require_once('lib/CachedMarkup.php');
41 require_once(dirname(__FILE__).'/stdlib.php');
42
43
44 function WikiEscape($text) {
45     return str_replace('#', ESCAPE_CHAR . '#', $text);
46 }
47
48 function UnWikiEscape($text) {
49     return preg_replace('/' . ESCAPE_CHAR . '(.)/', '\1', $text);
50 }
51
52 /**
53  * Return type from RegexpSet::match and RegexpSet::nextMatch.
54  *
55  * @see RegexpSet
56  */
57 class RegexpSet_match {
58     /**
59      * The text leading up the the next match.
60      */
61     var $prematch;
62     /**
63      * The matched text.
64      */
65     var $match;
66     /**
67      * The text following the matched text.
68      */
69     var $postmatch;
70     /**
71      * Index of the regular expression which matched.
72      */
73     var $regexp_ind;
74 }
75
76 /**
77  * A set of regular expressions.
78  *
79  * This class is probably only useful for InlineTransformer.
80  */
81 class RegexpSet
82 {
83     /** Constructor
84      *
85      * @param array $regexps A list of regular expressions.  The
86      * regular expressions should not include any sub-pattern groups
87      * "(...)".  (Anonymous groups, like "(?:...)", as well as
88      * look-ahead and look-behind assertions are okay.)
89      */
90     function RegexpSet ($regexps) {
91         assert($regexps);
92         $this->_regexps = array_unique($regexps);
93         if (!defined('_INLINE_OPTIMIZATION')) define('_INLINE_OPTIMIZATION',0);
94     }
95
96     /**
97      * Search text for the next matching regexp from the Regexp Set.
98      *
99      * @param string $text The text to search.
100      *
101      * @return RegexpSet_match  A RegexpSet_match object, or false if no match.
102      */
103     function match ($text) {
104         return $this->_match($text, $this->_regexps, '*?');
105     }
106
107     /**
108      * Search for next matching regexp.
109      *
110      * Here, 'next' has two meanings:
111      *
112      * Match the next regexp(s) in the set, at the same position as the last match.
113      *
114      * If that fails, match the whole RegexpSet, starting after the position of the
115      * previous match.
116      *
117      * @param string $text Text to search.
118      *
119      * @param RegexpSet_match $prevMatch A RegexpSet_match object.
120      * $prevMatch should be a match object obtained by a previous
121      * match upon the same value of $text.
122      *
123      * @return RegexpSet_match A RegexpSet_match object, or false if no match.
124      */
125     function nextMatch ($text, $prevMatch) {
126         // Try to find match at same position.
127         $pos = strlen($prevMatch->prematch);
128         $regexps = array_slice($this->_regexps, $prevMatch->regexp_ind + 1);
129         if ($regexps) {
130             $repeat = sprintf('{%d}', $pos);
131             if ( ($match = $this->_match($text, $regexps, $repeat)) ) {
132                 $match->regexp_ind += $prevMatch->regexp_ind + 1;
133                 return $match;
134             }
135             
136         }
137         
138         // Failed.  Look for match after current position.
139         $repeat = sprintf('{%d,}?', $pos + 1);
140         return $this->_match($text, $this->_regexps, $repeat);
141     }
142
143     // Syntax: http://www.pcre.org/pcre.txt
144     //   x - EXTENDED, ignore whitespace
145     //   s - DOTALL
146     //   A - ANCHORED
147     //   S - STUDY
148     function _match ($text, $regexps, $repeat) {
149         // If one of the regexps is an empty string, php will crash here: 
150         // sf.net: Fatal error: Allowed memory size of 8388608 bytes exhausted 
151         //         (tried to allocate 634 bytes)
152         if (_INLINE_OPTIMIZATION) { // disabled, wrong
153             // So we try to minize memory usage, by looping explicitly,
154             // and storing only those regexp which actually match. 
155             // There may be more than one, so we have to find the longest, 
156             // and match inside until the shortest is empty.
157             $matched = array(); $matched_ind = array();
158             for ($i=0; $i<count($regexps); $i++) {
159                 if (!trim($regexps[$i])) {
160                     trigger_error("empty regexp $i", E_USER_WARNING);
161                     continue;
162                 }
163                 $pat= "/ ( . $repeat ) ( " . $regexps[$i] . " ) /x";
164                 if (preg_match($pat, $text, $_m)) {
165                     $m = $_m; // FIXME: prematch, postmatch is wrong
166                     $matched[] = $regexps[$i];
167                     $matched_ind[] = $i;
168                     $regexp_ind = $i;
169                 }
170             }
171             // To overcome ANCHORED:
172             // We could sort by longest match and iterate over these.
173             if (empty($matched)) return false;
174         }
175         $match = new RegexpSet_match;
176         
177         // Optimization: if the matches are only "$" and another, then omit "$"
178         if (! _INLINE_OPTIMIZATION or count($matched) > 2) {
179             assert(!empty($repeat));
180             assert(!empty($regexps));
181             // We could do much better, if we would know the matching markup for the 
182             // longest regexp match:
183             $hugepat= "/ ( . $repeat ) ( (" . join(')|(', $regexps) . ") ) /Asx";
184             // Proposed premature optimization 1:
185             //$hugepat= "/ ( . $repeat ) ( (" . join(')|(', array_values($matched)) . ") ) /Asx";
186             if (! preg_match($hugepat, $text, $m)) {
187                 return false;
188             }
189             // Proposed premature optimization 1:
190             //$match->regexp_ind = $matched_ind[count($m) - 4];
191             $match->regexp_ind = count($m) - 4;
192         } else {
193             $match->regexp_ind = $regexp_ind;
194         }
195         
196         $match->postmatch = substr($text, strlen($m[0]));
197         $match->prematch = $m[1];
198         $match->match = $m[2];
199
200         /* DEBUGGING */
201         if (DEBUG & _DEBUG_PARSER) {
202           static $_already_dumped = 0;
203           if (!$_already_dumped) {
204             var_dump($regexps); 
205             if (_INLINE_OPTIMIZATION)
206                 var_dump($matched);
207             var_dump($matched_inc); 
208           }
209           $_already_dumped = 1;
210           PrintXML(HTML::dl(HTML::dt("input"),
211                           HTML::dd(HTML::pre($text)),
212                           HTML::dt("regexp"),
213                           HTML::dd(HTML::pre($match->regexp_ind, ":", $regexps[$match->regexp_ind])),
214                           HTML::dt("prematch"),
215                           HTML::dd(HTML::pre($match->prematch)),
216                           HTML::dt("match"),
217                           HTML::dd(HTML::pre($match->match)),
218                           HTML::dt("postmatch"),
219                           HTML::dd(HTML::pre($match->postmatch))
220                           ));
221         }
222         return $match;
223     }
224 }
225
226
227
228 /**
229  * A simple markup rule (i.e. terminal token).
230  *
231  * These are defined by a regexp.
232  *
233  * When a match is found for the regexp, the matching text is replaced.
234  * The replacement content is obtained by calling the SimpleMarkup::markup method.
235  */ 
236 class SimpleMarkup
237 {
238     var $_match_regexp;
239
240     /** Get regexp.
241      *
242      * @return string Regexp which matches this token.
243      */
244     function getMatchRegexp () {
245         return $this->_match_regexp;
246     }
247
248     /** Markup matching text.
249      *
250      * @param string $match The text which matched the regexp
251      * (obtained from getMatchRegexp).
252      *
253      * @return mixed The expansion of the matched text.
254      */
255     function markup ($match /*, $body */) {
256         trigger_error("pure virtual", E_USER_ERROR);
257     }
258 }
259
260 /**
261  * A balanced markup rule.
262  *
263  * These are defined by a start regexp, and an end regexp.
264  */ 
265 class BalancedMarkup
266 {
267     var $_start_regexp;
268
269     /** Get the starting regexp for this rule.
270      *
271      * @return string The starting regexp.
272      */
273     function getStartRegexp () {
274         return $this->_start_regexp;
275     }
276     
277     /** Get the ending regexp for this rule.
278      *
279      * @param string $match The text which matched the starting regexp.
280      *
281      * @return string The ending regexp.
282      */
283     function getEndRegexp ($match) {
284         return $this->_end_regexp;
285     }
286
287     /** Get expansion for matching input.
288      *
289      * @param string $match The text which matched the starting regexp.
290      *
291      * @param mixed $body Transformed text found between the starting
292      * and ending regexps.
293      *
294      * @return mixed The expansion of the matched text.
295      */
296     function markup ($match, $body) {
297         trigger_error("pure virtual", E_USER_ERROR);
298     }
299 }
300
301 class Markup_escape  extends SimpleMarkup
302 {
303     function getMatchRegexp () {
304         return ESCAPE_CHAR . '(?: [[:alnum:]]+ | .)';
305     }
306     
307     function markup ($match) {
308         assert(strlen($match) >= 2);
309         return substr($match, 1);
310     }
311 }
312
313 /**
314  * [image.jpg size=50% border=5], [image.jpg size=50x30]
315  * Support for the following attributes: see stdlib.php:LinkImage()
316  *   size=<precent>%, size=<width>x<height>
317  *   border=n, align=\w+, hspace=n, vspace=n
318  *   width=n, height=n
319  */
320 function isImageLink($link) {
321     if (!$link) return false;
322     assert(defined('INLINE_IMAGES'));
323     return preg_match("/\\.(" . INLINE_IMAGES . ")$/i", $link)
324         or preg_match("/\\.(" . INLINE_IMAGES . ")\s+(size|border|align|hspace|vspace|type|data|width|height)=/i", $link);
325 }
326
327 function LinkBracketLink($bracketlink) {
328
329     // $bracketlink will start and end with brackets; in between will
330     // be either a page name, a URL or both separated by a pipe.
331     
332    $wikicreolesyntax = false;
333
334    if (string_starts_with($bracketlink, "[[")) {
335        $wikicreolesyntax = true;
336        $bracketlink = str_replace("[[", "[", $bracketlink);
337        $bracketlink = str_replace("]]", "]", $bracketlink);
338    }
339   
340     // Strip brackets and leading space
341     // bug#1904088  Some brackets links on 2 lines cause the parser to crash
342     preg_match('/(\#?) \[\s* (?: (.*?) \s* (?<!' . ESCAPE_CHAR . ')(\|) )? \s* (.+?) \s*\]/x',
343                str_replace("\n", " ", $bracketlink), $matches);
344     if (count($matches) < 4) {
345         // "[ personal\ninformation manager | PhpWiki:PersonalWiki ]"
346         trigger_error(_("Invalid [] syntax ignored").": ".$bracketlink, E_USER_WARNING);
347         return new Cached_Link;
348     }
349     list (, $hash, $label, $bar, $rawlink) = $matches;
350
351     if ($wikicreolesyntax and $label) {
352         $temp = $label;
353         $label = $rawlink;
354         $rawlink = $temp;
355     }
356
357     $label = UnWikiEscape($label);
358     /*
359      * Check if the user has typed a explicit URL. This solves the
360      * problem where the URLs have a ~ character, which would be stripped away.
361      *   "[http:/server/~name/]" will work as expected
362      *   "http:/server/~name/"   will NOT work as expected, will remove the ~
363      */
364     if (   string_starts_with ($rawlink, "http://")
365         or string_starts_with ($rawlink, "https://") ) 
366     {
367         $link = $rawlink;
368         // Mozilla Browser URI Obfuscation Weakness 2004-06-14
369         //   http://www.securityfocus.com/bid/10532/
370         //   goodurl+"%2F%20%20%20."+badurl
371         if (preg_match("/%2F(%20)+\./i", $rawlink)) {
372             $rawlink = preg_replace("/%2F(%20)+\./i","%2F.",$rawlink);
373         }
374     } else
375         $link  = UnWikiEscape($rawlink);
376
377     /* Relatives links by Joel Schaubert.
378      * Recognize [../bla] or [/bla] as relative links, without needing http://
379      * but [ /link ] only if SUBPAGE_SEPERATOR is not "/". 
380      * Normally /Page links to the subpage /Page.
381      */
382     if (SUBPAGE_SEPARATOR == '/') {
383         if (preg_match('/^\.\.\//', $link)) {
384             return new Cached_ExternalLink($link, $label);
385         }
386     } else if (preg_match('/^(\.\.\/|\/)/', $link)) {
387         return new Cached_ExternalLink($link, $label);
388     }
389     // [label|link]
390     // If label looks like a url to an image or object, we want an image link.
391     if (isImageLink($label)) {
392         $imgurl = $label;
393         $intermap = getInterwikiMap();
394         if (preg_match("/^" . $intermap->getRegexp() . ":/", $label)) {
395             $imgurl = $intermap->link($label);
396             $imgurl = $imgurl->getAttr('href');
397         } elseif (! preg_match("#^(" . ALLOWED_PROTOCOLS . "):#", $imgurl)) {
398             // local theme linkname like 'images/next.gif'.
399             global $WikiTheme;
400             $imgurl = $WikiTheme->getImageURL($imgurl);
401         }
402         // for objects (non-images) the link is taken as alt tag, 
403         // which is in return taken as alternative img
404         $label = LinkImage($imgurl, $link);
405     }
406
407     if ($hash) {
408         // It's an anchor, not a link...
409         $id = MangleXmlIdentifier($link);
410         return HTML::a(array('name' => $id, 'id' => $id),
411                        $bar ? $label : $link);
412     }
413
414     if (preg_match("#^(" . ALLOWED_PROTOCOLS . "):#", $link)) {
415         // if it's an image, embed it; otherwise, it's a regular link
416         if (isImageLink($link) and empty($label)) // patch #1348996 by Robert Litwiniec
417             return LinkImage($link, $label);
418         else
419             return new Cached_ExternalLink($link, $label);
420     }
421     elseif (substr($link,0,8) == 'phpwiki:')
422         return new Cached_PhpwikiURL($link, $label);
423
424     /* Semantic relations and attributes. 
425      * Relation and attribute names must be word chars only, no space.
426      * Links and Attributes may contain everything. word, nums, units, space, groupsep, numsep, ...
427      */
428     elseif (preg_match("/^ (\w+) (:[:=]) (.*) $/x", $link) and !isImageLink($link))
429         return new Cached_SemanticLink($link, $label);
430
431     /* Do not store the link */    
432     elseif (substr($link,0,1) == ':')
433         return new Cached_WikiLink($link, $label);
434
435     /*
436      * Inline images in Interwiki urls's:
437      * [File:my_image.gif] inlines the image,
438      * File:my_image.gif shows a plain inter-wiki link,
439      * [what a pic|File:my_image.gif] shows a named inter-wiki link to the gif
440      * [File:my_image.gif|what a pic] shows a inlimed image linked to the page "what a pic"
441      *
442      * Note that for simplicity we will accept embedded object tags (non-images) 
443      * here also, and seperate them later in LinkImage()
444      */
445     elseif (strstr($link,':')
446             and ($intermap = getInterwikiMap()) 
447             and preg_match("/^" . $intermap->getRegexp() . ":/", $link)) 
448     {
449         // trigger_error("label: $label link: $link", E_USER_WARNING);
450         if (empty($label) and isImageLink($link)) {
451             // if without label => inlined image [File:xx.gif]
452             $imgurl = $intermap->link($link);
453             return LinkImage($imgurl->getAttr('href'), $link);
454         }
455         return new Cached_InterwikiLink($link, $label);
456     } else {
457         // Split anchor off end of pagename.
458         if (preg_match('/\A(.*)(?<!'.ESCAPE_CHAR.')#(.*?)\Z/', $rawlink, $m)) {
459             list(,$rawlink,$anchor) = $m;
460             $pagename = UnWikiEscape($rawlink);
461             $anchor = UnWikiEscape($anchor);
462             if (!$label)
463                 $label = $link;
464         }
465         else {
466             $pagename = $link;
467             $anchor = false;
468         }
469         return new Cached_WikiLink($pagename, $label, $anchor);
470     }
471 }
472
473 class Markup_bracketlink  extends SimpleMarkup
474 {
475     var $_match_regexp = "\\#? \\[ .*? [^]\\s] .*? \\]";
476     // TODO: include second ] in regexp
477     
478     function markup ($match) {
479         $link = LinkBracketLink($match);
480         assert($link->isInlineElement());
481         return $link;
482     }
483 }
484
485 class Markup_spellcheck extends SimpleMarkup
486 {
487     function Markup_spellcheck () {
488         $this->suggestions = $GLOBALS['request']->getArg('suggestions');
489     }
490     function getMatchRegexp () {
491         if (empty($this->suggestions))
492             return "(?# false )";
493         $words = array_keys($this->suggestions);
494         return "(?<= \W ) (?:" . join('|', $words) . ") (?= \W )";
495     }
496     
497     function markup ($match) {
498         if (empty($this->suggestions) or empty($this->suggestions[$match]))
499             return $match;
500         return new Cached_SpellCheck(UnWikiEscape($match), $this->suggestions[$match]);
501     }
502 }
503
504 class Markup_searchhighlight extends SimpleMarkup
505 {
506     function Markup_searchhighlight () {
507         $result = $GLOBALS['request']->_searchhighlight;
508         require_once("lib/TextSearchQuery.php");
509         $query = new TextSearchQuery($result['query']);
510         $this->hilight_re = $query->getHighlightRegexp();
511         $this->engine = $result['engine'];
512     }
513     function getMatchRegexp () {
514         return $this->hilight_re;
515     }
516     function markup ($match) {
517         return new Cached_SearchHighlight(UnWikiEscape($match), $this->engine);
518     }
519 }
520
521 class Markup_url extends SimpleMarkup
522 {
523     function getMatchRegexp () {
524         return "(?<![[:alnum:]]) (?:" . ALLOWED_PROTOCOLS . ") : [^\s<>\"']+ (?<![ ,.?; \] \) ])";
525     }
526     
527     function markup ($match) {
528         return new Cached_ExternalLink(UnWikiEscape($match));
529     }
530 }
531
532 class Markup_interwiki extends SimpleMarkup
533 {
534     function getMatchRegexp () {
535         $map = getInterwikiMap();
536         return "(?<! [[:alnum:]])" . $map->getRegexp(). ": [^:=]\S+ (?<![ ,.?;! \] \) \" \' ])";
537     }
538
539     function markup ($match) {
540         return new Cached_InterwikiLink(UnWikiEscape($match));
541     }
542 }
543
544 class Markup_semanticlink extends SimpleMarkup
545 {
546     // No units seperated by space allowed here
547     // For :: (relations) only words, no comma,
548     // but for := (attributes) comma and dots are allowed. Units with groupsep.
549     // Ending dots or comma are not part of the link.
550     var $_match_regexp = "(?: \w+:=\S+(?<![\.,]))|(?: \w+::[\w\.]+(?<!\.))"; 
551
552     function markup ($match) {
553         return new Cached_SemanticLink(UnWikiEscape($match));
554     }
555 }
556
557 class Markup_wikiword extends SimpleMarkup
558 {
559     function getMatchRegexp () {
560         global $WikiNameRegexp;
561         if (!trim($WikiNameRegexp)) return " " . WIKI_NAME_REGEXP;
562         return " $WikiNameRegexp";
563     }
564
565     function markup ($match) {
566         if (!$match) return false;
567         if ($this->_isWikiUserPage($match))
568             return new Cached_UserLink($match); //$this->_UserLink($match);
569         else
570             return new Cached_WikiLink($match);
571     }
572
573     // FIXME: there's probably a more useful place to put these two functions    
574     function _isWikiUserPage ($page) {
575         global $request;
576         $dbi = $request->getDbh();
577         $page_handle = $dbi->getPage($page);
578         if ($page_handle and $page_handle->get('pref'))
579             return true;
580         else
581             return false;
582     }
583
584     function _UserLink($PageName) {
585         $link = HTML::a(array('href' => $PageName));
586         $link->pushContent(PossiblyGlueIconToText('wikiuser', $PageName));
587         $link->setAttr('class', 'wikiuser');
588         return $link;
589     }
590 }
591
592 class Markup_linebreak extends SimpleMarkup
593 {
594     //var $_match_regexp = "(?: (?<! %) %%% (?! %) | <(?:br|BR)> | <(?:br|BR) \/> )";
595     var $_match_regexp = "(?: (?<! %) %%% (?! %) | \\\\\\\\ | <(?:br|BR)> )";
596
597     function markup ($match) {
598         return HTML::br();
599     }
600 }
601
602 class Markup_wikicreole_subscript extends BalancedMarkup
603 {
604     var $_start_regexp = ",,";
605  
606     function getEndRegexp ($match) {
607         return $match; 
608     }
609    
610     function markup ($match, $body) {
611         $tag = 'sub';
612         return new HtmlElement($tag, $body);
613     }
614 }
615
616 class Markup_old_emphasis  extends BalancedMarkup
617 {
618     var $_start_regexp = "''|__";
619
620     function getEndRegexp ($match) {
621         return $match;
622     }
623     
624     function markup ($match, $body) {
625         $tag = $match == "''" ? 'em' : 'strong';
626         return new HtmlElement($tag, $body);
627     }
628 }
629
630 class Markup_nestled_emphasis extends BalancedMarkup
631 {
632     function getStartRegexp() {
633         static $start_regexp = false;
634
635         if (!$start_regexp) {
636             // The three possible delimiters
637             // (none of which can be followed by itself.)
638             $i = "_ (?! _)";
639             $b = "\\* (?! \\*)";
640             $tt = "= (?! =)";
641
642             $any = "(?: ${i}|${b}|${tt})"; // any of the three.
643
644             // Any of [_*=] is okay if preceded by space or one of [-"'/:]
645             $start[] = "(?<= \\s|^|[-\"'\\/:]) ${any}";
646
647             // _ or * is okay after = as long as not immediately followed by =
648             $start[] = "(?<= =) (?: ${i}|${b}) (?! =)";
649             // etc...
650             $start[] = "(?<= _) (?: ${b}|${tt}) (?! _)";
651             $start[] = "(?<= \\*) (?: ${i}|${tt}) (?! \\*)";
652
653
654             // any delimiter okay after an opening brace ( [{<(] )
655             // as long as it's not immediately followed by the matching closing
656             // brace.
657             $start[] = "(?<= { ) ${any} (?! } )";
658             $start[] = "(?<= < ) ${any} (?! > )";
659             $start[] = "(?<= \\( ) ${any} (?! \\) )";
660             
661             $start = "(?:" . join('|', $start) . ")";
662             
663             // Any of the above must be immediately followed by non-whitespace.
664             $start_regexp = $start . "(?= \S)";
665         }
666
667         return $start_regexp;
668     }
669
670     function getEndRegexp ($match) {
671         $chr = preg_quote($match);
672         return "(?<= \S | ^ ) (?<! $chr) $chr (?! $chr) (?= \s | [-)}>\"'\\/:.,;!? _*=] | $)";
673     }
674     
675     function markup ($match, $body) {
676         switch ($match) {
677         case '*': return new HtmlElement('b', $body);
678         case '=': return new HtmlElement('tt', $body);
679         case '_': return new HtmlElement('i', $body);
680         }
681     }
682 }
683
684 class Markup_html_emphasis extends BalancedMarkup
685 {
686     var $_start_regexp = 
687         "<(?: b|big|i|small|tt|em|strong|cite|code|dfn|kbd|samp|s|strike|del|var|sup|sub )>";
688
689     function getEndRegexp ($match) {
690         return "<\\/" . substr($match, 1);
691     }
692     
693     function markup ($match, $body) {
694         $tag = substr($match, 1, -1);
695         return new HtmlElement($tag, $body);
696     }
697 }
698
699 class Markup_html_divspan extends BalancedMarkup
700 {
701     var $_start_regexp = 
702         "<(?: div|span )(?: \s[^>]*)?>";
703
704     function getEndRegexp ($match) {
705         if (substr($match,1,4) == 'span')
706             $tag = 'span';
707         else
708             $tag = 'div';
709         return "<\\/" . $tag . '>';
710     }
711     
712     function markup ($match, $body) {
713         if (substr($match,1,4) == 'span')
714             $tag = 'span';
715         else
716             $tag = 'div';
717         $rest = substr($match,1+strlen($tag),-1);
718         if (!empty($rest)) {
719             list($key,$val) = explode("=",$rest);
720             $args = array($key => $val);
721         } else $args = array();
722         return new HtmlElement($tag, $args, $body);
723     }
724 }
725
726
727 class Markup_html_abbr extends BalancedMarkup
728 {
729     //rurban: abbr|acronym need an optional title tag.
730     //sf.net bug #728595
731     var $_start_regexp = "<(?: abbr|acronym )(?: \stitle=[^>]*)?>";
732
733     function getEndRegexp ($match) {
734         if (substr($match,1,4) == 'abbr')
735             $tag = 'abbr';
736         else
737             $tag = 'acronym';
738         return "<\\/" . $tag . '>';
739     }
740     
741     function markup ($match, $body) {
742         if (substr($match,1,4) == 'abbr')
743             $tag = 'abbr';
744         else
745             $tag = 'acronym';
746         $rest = substr($match,1+strlen($tag),-1);
747         if (!empty($rest)) {
748             list($key,$val) = explode("=",$rest);
749             $args = array($key => $val);
750         } else $args = array();
751         return new HtmlElement($tag, $args, $body);
752     }
753 }
754
755 /** ENABLE_MARKUP_COLOR
756  *  See http://www.pmwiki.org/wiki/PmWiki/WikiStyles and
757  *      http://www.flexwiki.com/default.aspx/FlexWiki/FormattingRules.html
758  */
759 class Markup_color extends BalancedMarkup {
760     // %color=blue% blue text %% and back to normal
761     var $_start_regexp = "%color=(?: [^%]*)%";
762     var $_end_regexp = "%%";
763     
764     function markup ($match, $body) {
765         $color = strtoupper(substr($match, 7, -1));
766         if (strlen($color) != 7 
767             and in_array($color, array('RED', 'BLUE', 'GRAY', 'YELLOW', 'GREEN', 'CYAN', 'BLACK'))) 
768         {   // must be a valid color name
769             return new HtmlElement('font', array('color' => $color), $body);
770         } elseif ((substr($color,0,1) == '#') 
771                   and (strspn(substr($color,1),'0123456789ABCDEF') == strlen($color)-1)) {
772             return new HtmlElement('font', array('color' => $color), $body);
773         } else {
774             trigger_error(sprintf(_("unknown color %s ignored"), substr($match, 7, -1)), E_USER_WARNING);
775         }
776                 
777     }
778 }
779
780 // Special version for single-line plugins formatting, 
781 //  like: '<small>< ?plugin PopularNearby ? ></small>'
782 class Markup_plugin extends SimpleMarkup
783 {
784     var $_match_regexp = '<\?plugin(?:-form)?\s[^\n]+?\?>';
785
786     function markup ($match) {
787         //$xml = new Cached_PluginInvocation($match);
788         //$xml->setTightness(true,true);
789         return new Cached_PluginInvocation($match);
790     }
791 }
792
793 // Special version for plugins in xml syntax 
794 // <name arg=value>body</name> or <name /> => < ? plugin pluginname arg=value body ? >
795 // PLUGIN_MARKUP_MAP = "html:RawHtml dot:GraphViz toc:CreateToc amath:AsciiMath richtable:RichTable include:IncludePage tex:TexToPng"
796 class Markup_xml_plugin extends BalancedMarkup
797 {
798     //var $_start_regexp = "<(?: ".join('|',PLUGIN_MARKUP_MAP)." )(?: \s[^>]*)>";
799
800     function getStartRegexp () {
801         global $PLUGIN_MARKUP_MAP;
802         static $_start_regexp;
803         if ($_start_regexp) return $_start_regexp;
804         if (empty($PLUGIN_MARKUP_MAP))
805             return '';
806         //"<(?: html|dot|toc|amath|richtable|include|tex )(?: \s[^>]*)>"
807         $_start_regexp = "<(?: ".join('|',array_keys($PLUGIN_MARKUP_MAP))." )(?: \s[^>]* | / )>";
808         return $_start_regexp;
809     }
810     function getEndRegexp ($match) {
811         return "<\\/" . $match . '>';
812     }
813     function markup ($match, $body) {
814         global $PLUGIN_MARKUP_MAP;
815         $name = substr($match,2,-2); 
816         $vars = '';
817         if (preg_match('/^(\S+)\|(.*)$/', $name, $_m)) {
818             $name = $_m[1];
819             $vars = $_m[2]; //str_replace(' ', '&', $_m[2]);
820         }
821         if (!isset($PLUGIN_MARKUP_MAP[$name])) {
822             trigger_error("No plugin for $name $vars defined.", E_USER_WARNING);
823             return "";
824         }
825         $plugin = $PLUGIN_MARKUP_MAP[$name];
826         return new Cached_PluginInvocation("<"."?plugin $plugin $vars $body ?".">");
827     }
828 }
829
830 /**
831  *  Wikicreole preformatted
832  *  {{{
833  *  }}}
834  */
835 class Markup_wikicreole_preformatted extends SimpleMarkup
836 {
837     var $_match_regexp = '\{\{\{.*?\}\}\}';
838
839     function markup ($match) {
840         // Remove {{{ and }}}
841         return new HtmlElement('pre', substr($match, 3, -3));
842     }
843 }
844
845 /** ENABLE_MARKUP_TEMPLATE
846  *  Template syntax similar to Mediawiki
847  *  {{template}}
848  * => < ? plugin Template page=template ? >
849  *  {{template|var1=value1|var2=value|...}}
850  * => < ? plugin Template page=template var=value ... ? >
851  */
852 class Markup_template_plugin  extends SimpleMarkup
853 {
854     // patch #1732793: allow \n, mult. {{ }} in one line, and single letters
855     var $_match_regexp = '\{\{.*?\}\}';
856     
857     function markup ($match) {
858
859         $page = substr($match,2,-2);
860         if (strpos($page, "|") === false) {
861             $imagename = $page;
862             $alt = $page;
863         } else {
864             $imagename = substr($page, 0, strpos($page, "|"));
865             $alt = ltrim(strstr($page, "|"), "|");
866         }
867
868         // It's not a Mediawiki template, it's a Wikicreole image
869         if ((string_ends_with($imagename, ".jpg"))
870            or (string_ends_with($imagename, ".jpeg"))
871            or (string_ends_with($imagename, ".gif"))
872            or (string_ends_with($imagename, ".png"))) {
873             return LinkImage(UPLOAD_DATA_PATH . $imagename, $alt);
874         }
875
876         $page = str_replace("\n", "", $page); 
877         $vars = '';
878
879         if (preg_match('/^(\S+?)\|(.*)$/', $page, $_m)) {
880             $page = $_m[1];
881             $vars = '"' . preg_replace('/\|/', '" "', $_m[2]) . '"'; 
882             $vars = preg_replace('/"(\S+)=([^"]*)"/', '\\1="\\2"', $vars);
883         }
884  
885         // page may contain a version number
886         // {{foo?version=5}}
887         // in that case, output is "page=foo rev=5"
888         if (strstr($page, "?")) {
889             $page = str_replace("?version=", "\" rev=\"", $page);
890         }
891
892         if ($vars)
893             $s = '<'.'?plugin Template page="'.$page.'" '.$vars.' ?'.'>';
894         else
895             $s = '<'.'?plugin Template page="' . $page . '" ?'.'>';
896         return new Cached_PluginInvocation($s);
897     }
898 }
899
900 /** ENABLE_MARKUP_MEDIAWIKI_TABLE
901  *  Table syntax similar to Mediawiki
902  *  {|
903  * => <?plugin MediawikiTable
904  *  |}
905  * => ?>
906  */
907 class Markup_mediawikitable_plugin extends SimpleMarkup
908 {
909     var $_match_regexp = '\{\|.*?\|\}';
910
911     function markup ($match) {
912       $s = '<'.'?plugin MediawikiTable ' . $match . '?'.'>';
913       return new Cached_PluginInvocation($s);
914     }
915 }
916
917 class Markup_wikicreoletable_plugin extends SimpleMarkup
918 {
919     var $_match_regexp = '^\|=.*?\?>';
920
921     function markup ($match) {
922       $s = '<'.'?plugin WikicreoleTable ' . $match . '?'.'>';
923       return new Cached_PluginInvocation($s);
924     }
925 }
926
927 // "..." => "&#133;"  browser specific display (not cached?)
928 // Support some HTML::Entities: (C) for copy, --- for mdash, -- for ndash
929 // TODO: "--" => "&emdash;" browser specific display (not cached?)
930
931 class Markup_html_entities  extends SimpleMarkup {
932     //var $_match_regexp = '(: \.\.\.|\-\-|\-\-\-|\(C\) )';
933
934     function Markup_html_entities() {
935         $this->_entities = array('...'  => '&#133;',
936                                  '--'   => '&ndash;',
937                                  '---'  => '&mdash;',
938                                  '(C)'  => '&copy;',
939                                  '&copy;' => '&copy;',
940                                  '&trade;'  => '&trade;',
941                                  );
942         $this->_match_regexp = 
943             '(: ' . 
944             join('|', array_map('preg_quote', array_keys($this->_entities))) . 
945             ' )';
946     }
947    
948     function markup ($match) {
949         return HTML::Raw($this->_entities[$match]);
950     }
951 }
952
953 class Markup_isonumchars  extends SimpleMarkup {
954     var $_match_regexp = '\&\#\d{2,5};';
955     
956     function markup ($match) {
957         return HTML::Raw($match);
958     }
959 }
960
961 class Markup_isohexchars extends SimpleMarkup {
962     // hexnums, like &#x00A4; <=> &curren;
963     var $_match_regexp = '\&\#x[0-9a-fA-F]{2,4};';
964     
965     function markup ($match) {
966         return HTML::Raw($match);
967     }
968 }
969
970 // FIXME: Do away with magic phpwiki forms.  (Maybe phpwiki: links too?)
971 // FIXME: Do away with plugin-links.  They seem not to be used.
972 //Plugin link
973
974 class InlineTransformer
975 {
976     var $_regexps = array();
977     var $_markup = array();
978     
979     function InlineTransformer ($markup_types = false) {
980         global $request;
981         // We need to extend the inline parsers by certain actions, like SearchHighlight, 
982         // SpellCheck and maybe CreateToc.
983         if (!$markup_types) {
984             $non_default = false;
985             $markup_types = array
986                 ('escape', 'bracketlink', 'url',
987                  'interwiki',  'semanticlink', 'wikiword', 'linebreak',
988                  'wikicreole_subscript', 'old_emphasis', 'nestled_emphasis',
989                  'html_emphasis', 'html_abbr', 'plugin',
990                  'isonumchars', 'isohexchars', /*'html_entities'*/
991                  );
992             if (DISABLE_MARKUP_WIKIWORD)
993                 $markup_types = array_remove($markup_types, 'wikiword');
994
995             $action = $request->getArg('action');
996             if ($action == 'SpellCheck' and $request->getArg('suggestions'))
997             {   // insert it after url
998                 array_splice($markup_types, 2, 1, array('url','spellcheck'));
999             }
1000             if (isset($request->_searchhighlight))
1001             {   // insert it after url
1002                 array_splice($markup_types, 2, 1, array('url','searchhighlight'));
1003                 //$request->setArg('searchhighlight', false);
1004             }
1005         } else {
1006             $non_default = true;
1007         }
1008         foreach ($markup_types as $mtype) {
1009             $class = "Markup_$mtype";
1010             $this->_addMarkup(new $class);
1011         }
1012         if (ENABLE_MARKUP_DIVSPAN and !$non_default)
1013             $this->_addMarkup(new Markup_html_divspan);
1014         if (ENABLE_MARKUP_COLOR and !$non_default)
1015             $this->_addMarkup(new Markup_color);
1016         $this->_addMarkup(new Markup_wikicreoletable_plugin);
1017         // Markup_wikicreole_preformatted must be before Markup_template_plugin
1018         $this->_addMarkup(new Markup_wikicreole_preformatted);
1019         if (ENABLE_MARKUP_TEMPLATE and !$non_default)
1020             $this->_addMarkup(new Markup_template_plugin);
1021         if (ENABLE_MARKUP_MEDIAWIKI_TABLE)
1022             $this->_addMarkup(new Markup_mediawikitable_plugin);
1023         // This does not work yet
1024         if (0 and PLUGIN_MARKUP_MAP and !$non_default)
1025             $this->_addMarkup(new Markup_xml_plugin);
1026     }
1027
1028     function _addMarkup ($markup) {
1029         if (isa($markup, 'SimpleMarkup'))
1030             $regexp = $markup->getMatchRegexp();
1031         else
1032             $regexp = $markup->getStartRegexp();
1033
1034         assert( !isset($this->_markup[$regexp]) );
1035         assert( strlen(trim($regexp)) > 0 );
1036         $this->_regexps[] = $regexp;
1037         $this->_markup[] = $markup;
1038     }
1039         
1040     function parse (&$text, $end_regexps = array('$')) {
1041         $regexps = $this->_regexps;
1042
1043         // $end_re takes precedence: "favor reduce over shift"
1044         array_unshift($regexps, $end_regexps[0]);
1045         //array_push($regexps, $end_regexps[0]);
1046         $regexps = new RegexpSet($regexps);
1047         
1048         $input = $text;
1049         $output = new XmlContent;
1050
1051         $match = $regexps->match($input);
1052         
1053         while ($match) {
1054             if ($match->regexp_ind == 0) {
1055                 // No start pattern found before end pattern.
1056                 // We're all done!
1057                 if (isset($markup) and is_object($markup) 
1058                     and isa($markup,'Markup_plugin')) 
1059                 {
1060                     $current =& $output->_content[count($output->_content)-1];
1061                     $current->setTightness(true,true);
1062                 }
1063                 $output->pushContent($match->prematch);
1064                 $text = $match->postmatch;
1065                 return $output;
1066             }
1067
1068             $markup = $this->_markup[$match->regexp_ind - 1];
1069             $body = $this->_parse_markup_body($markup, $match->match, 
1070                                               $match->postmatch, $end_regexps);
1071             if (!$body) {
1072                 // Couldn't match balanced expression.
1073                 // Ignore and look for next matching start regexp.
1074                 $match = $regexps->nextMatch($input, $match);
1075                 continue;
1076             }
1077
1078             // Matched markup.  Eat input, push output.
1079             // FIXME: combine adjacent strings.
1080             if (isa($markup, 'SimpleMarkup'))
1081                 $current = $markup->markup($match->match);
1082             else
1083                 $current = $markup->markup($match->match, $body);
1084             $input = $match->postmatch;
1085             if (isset($markup) and is_object($markup) 
1086                 and isa($markup,'Markup_plugin')) 
1087             {
1088                 $current->setTightness(true,true);
1089             }
1090             $output->pushContent($match->prematch, $current);
1091
1092             $match = $regexps->match($input);
1093         }
1094
1095         // No pattern matched, not even the end pattern.
1096         // Parse fails.
1097         return false;
1098     }
1099
1100     function _parse_markup_body ($markup, $match, &$text, $end_regexps) {
1101         if (isa($markup, 'SimpleMarkup'))
1102             return true;        // Done. SimpleMarkup is simple.
1103
1104         if (!is_object($markup)) return false; // Some error: Should assert
1105         array_unshift($end_regexps, $markup->getEndRegexp($match));
1106
1107         // Optimization: if no end pattern in text, we know the
1108         // parse will fail.  This is an important optimization,
1109         // e.g. when text is "*lots *of *start *delims *with
1110         // *no *matching *end *delims".
1111         $ends_pat = "/(?:" . join(").*(?:", $end_regexps) . ")/xs";
1112         if (!preg_match($ends_pat, $text))
1113             return false;
1114         return $this->parse($text, $end_regexps);
1115     }
1116 }
1117
1118 class LinkTransformer extends InlineTransformer
1119 {
1120     function LinkTransformer () {
1121         $this->InlineTransformer(array('escape', 'bracketlink', 'url',
1122                                        'semanticlink', 'interwiki', 'wikiword', 
1123                                        ));
1124     }
1125 }
1126
1127 class NowikiTransformer extends InlineTransformer
1128 {
1129     function NowikiTransformer () {
1130         $this->InlineTransformer
1131             (array('linebreak',
1132                    'html_emphasis', 'html_abbr', 'plugin',
1133                    'isonumchars', 'isohexchars', /*'html_entities',*/
1134                    ));
1135     }
1136 }
1137
1138 function TransformInline($text, $markup = 2.0, $basepage=false) {
1139     static $trfm;
1140     $action = $GLOBALS['request']->getArg('action');
1141     if (empty($trfm) or $action == 'SpellCheck') {
1142         $trfm = new InlineTransformer;
1143     }
1144     
1145     if ($markup < 2.0) {
1146         $text = ConvertOldMarkup($text, 'inline');
1147     }
1148
1149     if ($basepage) {
1150         return new CacheableMarkup($trfm->parse($text), $basepage);
1151     }
1152     return $trfm->parse($text);
1153 }
1154
1155 function TransformLinks($text, $markup = 2.0, $basepage = false) {
1156     static $trfm;
1157     
1158     if (empty($trfm)) {
1159         $trfm = new LinkTransformer;
1160     }
1161
1162     if ($markup < 2.0) {
1163         $text = ConvertOldMarkup($text, 'links');
1164     }
1165     
1166     if ($basepage) {
1167         return new CacheableMarkup($trfm->parse($text), $basepage);
1168     }
1169     return $trfm->parse($text);
1170 }
1171
1172 /**
1173  * Transform only html markup and entities.
1174  */
1175 function TransformInlineNowiki($text, $markup = 2.0, $basepage=false) {
1176     static $trfm;
1177     
1178     if (empty($trfm)) {
1179         $trfm = new NowikiTransformer;
1180     }
1181     if ($basepage) {
1182         return new CacheableMarkup($trfm->parse($text), $basepage);
1183     }
1184     return $trfm->parse($text);
1185 }
1186
1187
1188 // $Log: not supported by cvs2svn $
1189 // Revision 1.106  2008/08/19 18:08:14  vargenau
1190 // Implement Wikicreole syntax for tables
1191 //
1192 // Revision 1.105  2008/08/19 18:05:40  vargenau
1193 // Implemented Wikicreole syntax for preformatted text
1194 //
1195 // Revision 1.104  2008/08/06 09:28:41  vargenau
1196 // Allow header syntax in Mediawiki tables
1197 //
1198 // Revision 1.103  2008/08/03 16:18:35  vargenau
1199 // Implement "{{foo?version=5}}" syntax for templates
1200 //
1201 // Revision 1.102  2008/08/03 16:03:47  vargenau
1202 // Implement Wikicreole syntax for links
1203 //
1204 // Revision 1.101  2008/08/03 15:56:20  vargenau
1205 // Implement Wikicreole syntax for line break
1206 //
1207 // Revision 1.100  2008/08/03 15:52:31  vargenau
1208 // Implement Wikicreole syntax for subscript
1209 //
1210 // Revision 1.99  2008/05/06 19:23:17  rurban
1211 // update (c)
1212 //
1213 // Revision 1.98  2008/03/21 20:35:52  rurban
1214 // Improve upon embedded ImgObject, such as [ *.mp3 ], objects.
1215 // Object tags now render as label correctly and param tags are also added.
1216 //
1217 // Revision 1.97  2008/03/18 20:25:49  rurban
1218 // Fixed "\n" => " " in [ link parsing ] by suggestion of Marc-Etienne
1219 //
1220 // Revision 1.96  2008/03/17 19:06:39  rurban
1221 // fix bug#1904088  Some brackets links with \n cause the parser to crash
1222 //
1223 // Revision 1.95  2008/02/15 20:02:49  vargenau
1224 // Allow <s> to strike; update Help for <s> and <strike>
1225 //
1226 // Revision 1.94  2008/01/31 20:40:10  vargenau
1227 // Implemented Mediawiki-like syntax for tables
1228 //
1229 // Revision 1.93  2007/09/26 16:54:34  rurban
1230 // Fix Bug#1802827 Template does not get expanded with {{ }} syntax.
1231 // by vargenau
1232 //
1233 // Revision 1.92  2007/08/10 21:58:01  rurban
1234 // Improve SemanticLink parsings:
1235 //   No units seperated by space allowed without []
1236 //   For :: (relations) only words, no comma,
1237 //   but for := (attributes) comma and dots are allowed. Units with groupsep.
1238 //   Ending dots or comma are not part of the link.
1239 //
1240 // Revision 1.91  2007/06/07 18:56:57  rurban
1241 // patch #1732793: allow \n, mult. {{ }} in one line, and single
1242 // letters (slightly improved) by AlJeux and ReiniUrban
1243 //
1244 // Revision 1.90  2007/03/18 17:35:14  rurban
1245 // Fix :DontStoreLink
1246 //
1247 // Revision 1.89  2007/02/17 14:16:28  rurban
1248 // fix color GREY to GRAY
1249 //
1250 // Revision 1.88  2007/01/21 13:15:50  rurban
1251 // Support spaces in attributes and relation links
1252 //
1253 // Revision 1.87  2007/01/20 15:53:51  rurban
1254 // Rewrite of SearchHighlight: through ActionPage and InlineParser
1255 //
1256 // Revision 1.86  2007/01/20 11:25:07  rurban
1257 // add SpellCheck support
1258 //
1259 // Revision 1.85  2007/01/07 18:42:49  rurban
1260 // Add support for non-bracket semantic relation parsing. Assert empty regex (interwikimap?) earlier. Change {{Template||}} vars handling to new style. Stricter interwikimap matching not to find semantic links
1261 //
1262 // Revision 1.84  2007/01/02 13:18:07  rurban
1263 // fix semantic attributes syntax :=, not :-, disable DIVSPAN and PLUGIN_MARKUP_MAP
1264 //
1265 // Revision 1.83  2006/12/22 00:23:24  rurban
1266 // Fix Bug #1540007 "hardened-php issue, crawlers related"
1267 // Broken str_replace with strings > 200 chars
1268 //
1269 // Revision 1.82  2006/12/02 19:53:05  rurban
1270 // Simplify DISABLE_MARKUP_WIKIWORD handling by adding the new function
1271 // stdlib: array_remove(). Hopefully PHP will not add this natively sooner
1272 // or later.
1273 //
1274 // Revision 1.81  2006/11/19 13:52:52  rurban
1275 // improve debug output: regex only once
1276 //
1277 // Revision 1.80  2006/10/12 06:32:30  rurban
1278 // Optionally support new tags <div>, <span> with ENABLE_MARKUP_DIVSPAN (in work)
1279 //
1280 // Revision 1.79  2006/10/08 12:38:11  rurban
1281 // New special interwiki link markup [:LinkTo] without storing the backlink
1282 //
1283 // Revision 1.78  2006/09/03 09:53:52  rurban
1284 // more colors, case-insensitive color names
1285 //
1286 // Revision 1.77  2006/08/25 19:02:02  rurban
1287 // patch #1348996 by Robert Litwiniec: fix show image semantics if label is given
1288 //
1289 // Revision 1.76  2006/08/19 11:02:35  rurban
1290 // add strike and del to html emphasis: Patch #1542894 by Kai Krakow
1291 //
1292 // Revision 1.75  2006/08/15 13:43:10  rurban
1293 // add Markup_xml_plugin (untested) and fix Markup_template_plugin
1294 //
1295 // Revision 1.74  2006/07/23 14:03:18  rurban
1296 // add new feature: DISABLE_MARKUP_WIKIWORD
1297 //
1298 // Revision 1.73  2006/04/15 12:20:36  rurban
1299 // fix relatives links patch by Joel Schaubert for [/
1300 //
1301 // Revision 1.72  2006/03/07 20:43:29  rurban
1302 // relative external link, if no internal subpage. by joel Schaubert
1303 //
1304 // Revision 1.71  2005/11/14 22:31:12  rurban
1305 // add SemanticWeb support
1306 //
1307 // Revision 1.70  2005/10/31 16:45:23  rurban
1308 // added cfg-able markups only for default TextTransformation, not for links and others
1309 //
1310 // Revision 1.69  2005/09/14 05:57:19  rurban
1311 // make ENABLE_MARKUP_TEMPLATE optional
1312 //
1313 // Revision 1.68  2005/09/10 21:24:32  rurban
1314 // optionally support {{Template|vars}} syntax
1315 //
1316 // Revision 1.67  2005/06/06 17:41:20  rurban
1317 // support new ENABLE_MARKUP_COLOR
1318 //
1319 // Revision 1.66  2005/04/23 11:15:49  rurban
1320 // handle allowed inlined objects within INLINE_IMAGES
1321 //
1322 // Revision 1.65  2005/03/27 18:24:17  rurban
1323 // add Log
1324 //
1325
1326 // (c-file-style: "gnu")
1327 // Local Variables:
1328 // mode: php
1329 // tab-width: 8
1330 // c-basic-offset: 4
1331 // c-hanging-comment-ender-p: nil
1332 // indent-tabs-mode: nil
1333 // End:   
1334 ?>