[pmwiki-users] How to embed SVG as editable text

Lars Eighner surname at larseighner.com
Wed Aug 16 16:08:50 CDT 2017


Thanks so much, it works like a charm in 2.2.102. Any yes, it does let me 
edit the svg code -- which is just flat text -- in the page edit, and 
displays it as an image when the page is viewed. I use it to compose 
simple geometry figures, Feynman diagrams, circuit schematics, and 
illustrations for classical mechanics, and also to pretty up plots from 
Gnuplot.

On Wed, 16 Aug 2017, Petko Yotov wrote:

> Here is your markup rule and function, the 4 changed lines are marked with 
> #changed or #added:
>
>  Markup('svgtag','fulltext','/\\{\\*(.*?)\\*\\}/s',"litsvg"); #changed
>
>  function litsvg($m){ #changed
>    $string = $m[1]; #added
>    $out = '';
>    $string = str_replace(array('>', '<', '&'),
>      array('>', '<', '&'), $string);
>    $string = str_replace(array('</p>','<pre>','</pre>',
>      "<p class='vspace'>",'\\"'), array('','','','','"'),$string);
>    $out = $out . $string;
>    return Keep($out); #changed
>  }
>
> Note, this requires at least PmWiki 2.2.56 (latest recommended). You may have 
> to upgrade.
>
> Petko
>
>

-- 
Lars Eighner
surname at larseighner.com



More information about the pmwiki-users mailing list