users:werner:modirenden
Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen RevisionVorhergehende Überarbeitung | |||
users:werner:modirenden [2007-01-13 1759] – quotation statt quote werner | users:werner:modirenden [2007-01-13 1803] (aktuell) – typo werner | ||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
+ | ====== A Renderer Plugin for DokuWiki ====== | ||
+ | |||
+ | ...which does not run :-( | ||
+ | |||
+ | I find it annoying that the quotation marks are hardcoded in DokuWiki' | ||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | ob_start(); | ||
+ | tpl_content(); | ||
+ | $myhtml = ob_get_contents(); | ||
+ | ob_end_clean(); | ||
+ | echo wfModiOut(' | ||
+ | ?> | ||
+ | </ | ||
+ | |||
+ | Here '' | ||
+ | |||
+ | <code php> | ||
+ | $retval = str_replace('& | ||
+ | $retval = str_replace('& | ||
+ | </ | ||
+ | |||
+ | I thought that a renderer plugin would replace this, and so I started to work around my workaround by the following code: | ||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | |||
+ | /** | ||
+ | MODIfied RENDerer for XHTML output | ||
+ | @license | ||
+ | @author Werner Flamme \< | ||
+ | **/ | ||
+ | // the following lines are stolen from the s5 plugin of Harry Fuecks and Andi Gohr | ||
+ | // must be run within Dokuwiki | ||
+ | if(!defined(' | ||
+ | |||
+ | // we inherit from the XHTML renderer instead directly of the base renderer | ||
+ | require_once DOKU_INC.' | ||
+ | // stolen code ends here | ||
+ | |||
+ | if (!defined(' | ||
+ | define(' | ||
+ | require_once DOKU_PLUGIN . ' | ||
+ | |||
+ | /** | ||
+ | This class allow to change the double and single quotation marks, | ||
+ | something I always wanted but what never got implemented. | ||
+ | Instead of modifying 4 lines in DokuWikis source code | ||
+ | I have to write a plugin :-( | ||
+ | **/ | ||
+ | class Doku_Renderer_modirend extends Doku_Renderer_xhtml { | ||
+ | |||
+ | /** | ||
+ | Return some info | ||
+ | **/ | ||
+ | function getInfo(){ | ||
+ | return array( | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | } // function getInfo | ||
+ | |||
+ | /** | ||
+ | add opening single quote to document' | ||
+ | **/ | ||
+ | function singlequoteopening() | ||
+ | { | ||
+ | global $conf; | ||
+ | $this-> | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | add closing single quote to document' | ||
+ | **/ | ||
+ | function singlequoteclosing() | ||
+ | { | ||
+ | global $conf; | ||
+ | $this-> | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | add opening double quote to document' | ||
+ | **/ | ||
+ | function doublequoteopening() | ||
+ | { | ||
+ | global $conf; | ||
+ | $this-> | ||
+ | } | ||
+ | |||
+ | /** | ||
+ | add closing double quote to document' | ||
+ | **/ | ||
+ | function doublequoteclosing() | ||
+ | { | ||
+ | global $conf; | ||
+ | $this-> | ||
+ | } | ||
+ | } | ||
+ | |||
+ | //Setup VIM: ex: et ts=4 enc=utf-8 : | ||
+ | </ | ||
+ | |||
+ | So I use the standard XHTML renderer of DokuWiki and overwrite 4 of its methods. When I append ''& | ||
+ | |||
+ | Practically, | ||
+ | |||
+ | Next, my Apache didn't show my pages correctly at all -- only fragments of them were shown, whether or not I added ''& | ||
+ | |||
+ | Question: why don't I get the expected result -- a text (or a page) looking exactly like the other one, except for the modified quotation marks? How can I use the renderer plugin correctly? | ||
users/werner/modirenden.txt · Zuletzt geändert: 2007-01-13 1803 von werner