GIT.Harvie.CZ
/
mirrors
/
DokuWiki-Plugin-SVGEdit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
32165dc
)
deduplicated and cleaned code
author
Harvie
<tomas@mudrunka.cz>
Sun, 20 Jun 2010 02:50:53 +0000
(
04:50
+0200)
committer
Harvie
<tomas@mudrunka.cz>
Sun, 20 Jun 2010 02:50:53 +0000
(
04:50
+0200)
syntax.php
patch
|
blob
|
blame
|
history
diff --git
a/syntax.php
b/syntax.php
index 17224c66d18444f94afaee935b32fe74807db8ea..456c8578004b62c4d954c6be5dce9586922cf897 100755
(executable)
--- a/
syntax.php
+++ b/
syntax.php
@@
-48,7
+48,11
@@
class syntax_plugin_svgedit extends DokuWiki_Syntax_Plugin {
return array($type, $match);
}
return array($type, $match);
}
- function format_svg_embed($svglink, $alt) {
+ function svg_base64_encode($svg) { //create base64 encoded svg for use as svglink in svg_format_embed
+ return 'data:image/svg+xml;base64,'.base64_encode($svg).'" type="image/svg+xml';
+ }
+
+ function svg_format_embed($svglink, $alt) { //create xhtml code for svg embeding
global $ID;
//detect image size for stupid browsers (like firefox) - ugly (fails if svg does not contain information about it's size)
global $ID;
//detect image size for stupid browsers (like firefox) - ugly (fails if svg does not contain information about it's size)
@@
-72,25
+76,20
@@
class syntax_plugin_svgedit extends DokuWiki_Syntax_Plugin {
$svg_wiki_page = trim(substr($data[1], 6, -2)); //name of wiki page containing SVG image
$svg_wiki_page = trim(substr($data[1], 6, -2)); //name of wiki page containing SVG image
-
-
-
if($data[0]==='<svg') {
if($data[0]==='<svg') {
- $svg
link = 'data:image/svg+xml;base64,'.base64_encode($data[1]).'" type="image/svg+xml'
;
- $renderer->doc .= $this->
format_svg_embed($svglink
, 'svg-image@'.$ID);
+ $svg
enc = $this->svg_base64_encode($data[1])
;
+ $renderer->doc .= $this->
svg_format_embed($svgenc
, 'svg-image@'.$ID);
return true;
}
if($data[0]==='{{sv') {
$svglink = exportlink($svg_wiki_page,'svg');
return true;
}
if($data[0]==='{{sv') {
$svglink = exportlink($svg_wiki_page,'svg');
- $renderer->doc .= $this->format_svg_embed($svglink, 'image:'.htmlspecialchars($svg_wiki_page));
- //$renderer->doc .= '<a href="'.$svglink.'" type="image/svg+xml" />'.$svgtag.$svglink.'" alt="image:'.htmlspecialchars($svg_wiki_page).'" type="image/svg+xml"/></a><br />';
+ $renderer->doc .= $this->svg_format_embed($svglink, 'image:'.htmlspecialchars($svg_wiki_page));
$renderer->doc .= html_wikilink($svg_wiki_page,'svg@'.$svg_wiki_page);
return true;
}
if($data[0]==='{{SV') {
$renderer->doc .= html_wikilink($svg_wiki_page,'svg@'.$svg_wiki_page);
return true;
}
if($data[0]==='{{SV') {
- $svglink = 'data:image/svg+xml;base64,'.base64_encode(rawWiki($svg_wiki_page)).'" type="image/svg+xml';
- $renderer->doc .= $this->format_svg_embed($svglink, 'image:'.htmlspecialchars($svg_wiki_page));
- //$renderer->doc .= '<a href="'.$svglink.'" type="image/svg+xml" />'.$svgtag.$svglink.'" alt="image:'.htmlspecialchars($svg_wiki_page).'" /></a><br />';
+ $svgenc = $this->svg_base64_encode(rawWiki($svg_wiki_page));
+ $renderer->doc .= $this->svg_format_embed($svgenc, 'image:'.htmlspecialchars($svg_wiki_page));
$renderer->doc .= html_wikilink($svg_wiki_page,'SVG@'.$svg_wiki_page);
return true;
}
$renderer->doc .= html_wikilink($svg_wiki_page,'SVG@'.$svg_wiki_page);
return true;
}
This page took
0.141434 seconds
and
4
git commands to generate.