From 3be463d8dd3f420391c1dfa16f17a6de6f794cb0 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Mon, 24 Aug 2020 16:06:05 +0000 Subject: [PATCH] wip #3826 @0.5 --- .../html5/master/class.ws.html5.compiler.php | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/inc/ws/Util/html5/master/class.ws.html5.compiler.php b/inc/ws/Util/html5/master/class.ws.html5.compiler.php index 4a902a009..f80a20f37 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -216,6 +216,7 @@ class wsHTML5Compiler public $lessVariables = []; protected $_indexVars = null; public $accessibleTexts = []; + protected $_svgSymbols = []; public $_signature; /** @@ -1040,6 +1041,10 @@ class wsHTML5Compiler die($svgfile . ' does not exist'); } } + if (count($this->_svgSymbols)) { + $svg .= '' . implode('', $this->_svgSymbols) . '' . "\n"; + + } if ($this->phonegap) { $csp = "securityPolicyWhitelist)) . "; img-src * data:\">"; @@ -1295,11 +1300,26 @@ class wsHTML5Compiler for ($i = 1; $i <= 5; $i++) { $ic = $this->book->parametres->{'navExtraIcon' . $i}; if ($ic != '') { - $this->vdir->copy($this->wdir . '/' . $ic, 'data/images/' . $ic); + if (stristr($ic, '.svg')) { + $e = explode('.', $ic); + $sname = 'external-' . $e[0]; + $this->addSVGSymbolFromFile($this->wdir . '/' . $ic, $sname); + $this->config->{'navExtraIcon' . $i} = $sname; + } else { + $this->vdir->copy($this->wdir . '/' . $ic, 'data/images/' . $ic); + } } } } + protected function addSVGSymbolFromFile($svg, $symbolName) + { + $xml = simplexml_load_string(file_get_contents($svg)); + $viewBox = (string)$xml['viewBox']; + + $this->_svgSymbols[] = '' . $this->SimpleXMLElement_innerXML($xml) . ''; + } + protected function writeLinks() { global $core; -- 2.39.5