I added a new class in InlineParser.php (L:704):
// new pattern [diagram:myfirstdiagram.draw] recognition
class Markup_embedded_diagram extends SimpleMarkup {
function getMatchRegexp (){
return "/Diagram:([-a-z0-9]+\.)draw/i";
}
function markup ($match){
return new Cached_DiagramLink($match);
}
}
Then I added a class in CachedMarkup.php :
class Cached_DiagramLink extends Cached_Link {
function Cached_DiagramLink($match){
//extact the diagram file name
preg_match("/^(drawing):?(.*\.draw)/i", $match, $matches);
//construct the path for the editable filename of the diagram
$file = dirname(__FILE__) .
"../editeur/uploads/png/ARCHITECTURE.jpg" ;
if (file_exists($file))
//the linked diagram have a file uploaded on the server
//return an img tag with a link to launch the applet
return HTML::img(array('src' => $file));
else
//the linked diagram do not have an uploaded file on the server
//return a link to launch the applet
return HTML::a(array('href' => "../editeur.html"));
}
}
The parser then turns into trouble and I can not view wiki pages.
Is there something I should correct or add to ensure my new pattern
recognition.
Reguards
Sabri.
"Reini Rurban wrote:"
>See lib\InlineParser.php
>For example the recently added
>class Markup_color extends BalancedMarkup
>There are two kinds of parser helpers:
>* SimpleMarkup requires just one regex, which binds one pattern.
>* BalancedMarkup requires a start and an end regex
>2006/5/10, Sabri LABBENE <sab...@st...>:
>> Hi all,
>> I'm using phpwiki-1.3.12.
>> I want to add a new formating rule so that my wiki will recognize a
>> new pattern. I didn't found how to proced.
>>
>> Can any body explain the modifications I have to make in phpwiki
>> parser? Which programs I need to modify? Is there a posibility to add
>> the new pattern regexp to the existing ones?
>>
>> Reguards
>>
>> Sabri.
|