<?php if (!defined('PmWiki')) exit(); /* -[Feral:104/07@04:51]--------------------------------------------------- * With many MANY thanks to Hans (= ;) * * I claim no copyright for my work; -- [Feral:104/07@04:53] * * 2007-04-18 -- Initial * --------------------------------------------------------------------- */ // Feral Formatted Entry, or FFE ;) $RecipeInfo['FeralFormattedEntry']['Version'] = '2007-04-18'; SDV($FFETemplate, 'FFETemplate'); /* -[Feral:107/07@03:26]--------------------------------------------------- (:ffe template=FFEDisplayTemplate:) First line\\ Second line\\ Third line (:ffeend:) * This is BROKEN with: Markup('feralformattedentry','<split', * But works with: Markup('feralformattedentry','>!vspace', * on non IIS boxes; As close as Hans and I can tell this is a IIS issue. * So, if you were wondering why we are at >!vspace, that is why. * * Note that <split seems more standard for our (:ffe:)...(:ffeend:) style * directive AND it would seem to work with both \\ line continuations both in * the posts AND the templates; Where as the >!vspace method works only with * posts, but does work on all tested servers. -- [Feral:108/07@03:00] * --------------------------------------------------------------------- */ //Markup('feralformattedentry','<split', // DOES work on IIS, but aparently not anything else. Markup('feralformattedentry','>!vspace', "/\\(:ffe\\s*(.*?)\\s*:\\)(.*?)[\n]?\\(:ffe?end:\\)/se", "FeralFormattedEntry(\$pagename, PSS('$1'), PSS('$2') )"); function FeralFormattedEntry($pagename, $opts, $text) { // {{{ global $FFETemplate; $defaults = array( 'template' => $FFETemplate ); $opts = array_merge($defaults, ParseArgs($opts) ); $opts['text'] = $text; $template_page = $opts['template']; if ( $template_page == '') { $template_page = $FFETemplate; } $template_page = MakePageName($pagename, $template_page); if ( PageExists($template_page) ) { $page = RetrieveAuthPage($template_page,"read"); } if ( $page) { $template = $page['text']; // > && < are already converted, this musses things up so undo this. $template = str_replace('<', '<', $template); $template = str_replace('>', '>', $template); } else { return "<h5>(FFE)ERROR: template page '[[$template_page]]' is not accessible!</h5>"; } //replace {$$name} variables with values -- From Fox return preg_replace("/\\{\\$\\$([A-Za-z][-_:.\\w\\[\\]]*)\\}/e","stripmagic(\$opts[PSS('$1')])",$template); } // }}} // /// EOF //