A coding idea based on Intermap
I have this simple markup to note TODO: and DONE: markup.
I do it via the following:
Markup("done", "inline", '/DONE:/', "%label label-success%DONE:%%"); # green
Markup("update", "inline", '/UPDATE:/', "%label label-info%UPDATE:%%"); # blue
But that's painful.
What if that sort of information could be defined like Site.InterMap entries are?
TAG: %markup%TAG:%%
Here's some relevant code from pmwiki.php
for parsing the intermap files:
"$FarmD/local/farmmap.txt", '$SiteGroup.InterMap', 'local/localmap.txt');
$f = FmtPageName($f, $pagename);
if (($v = @file($f)))
$v = preg_replace('/^\\s*(?>\\w[-\\w]*)(?!:)/m', '$0:', implode('', $v));
else if (PageExists($f)) {
$p = ReadPage($f, READPAGE_CURRENT);
$v = $p['text'];
} else continue;
if (!preg_match_all("/^\\s*(\\w[-\\w]*:)[^\\S\n]+(\\S*)/m", $v,
$match, PREG_SET_ORDER)) continue;
foreach($match as $m) {
if (strpos($m[2], '$1') === false) $m[2] .= '$1';
$LinkFunctions[$m[1]] = 'LinkIMap';
$IMap[$m[1]] = FmtPageName($m[2], $pagename);
}
}
Recent Comments