From: vincent@cubedesigners.com Date: Wed, 29 Jul 2020 17:18:13 +0000 (+0000) Subject: wip #3827 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=1eb1a139062f26f786b8513425d14f4b4cb302c5;p=cubeextranet.git wip #3827 @1 --- diff --git a/inc/ws/Metier/class.ws.book.parametres.php b/inc/ws/Metier/class.ws.book.parametres.php index 43e8e0409..dca24d2b0 100644 --- a/inc/ws/Metier/class.ws.book.parametres.php +++ b/inc/ws/Metier/class.ws.book.parametres.php @@ -488,7 +488,7 @@ class wsBookParametres extends wsParametres 'Open Sans (police du Fluidbook)' => 'OpenSans', 'Montserrat' => 'Montserrat'], 'editable' => 'true', 'grade' => 3]; $this->fields['articlesImages'] = ['type' => 'freefile', 'label' => __('Images des articles'), 'default' => '', 'hint' => __('Les noms des fichiers doivent être les même que ceux des balises du XML'), 'editable' => true, 'grade' => 3, 'dir' => 'articles']; $this->fields['articlesShare'] = ['type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Activer le partage'), 'grade' => 3]; - $this->fields['articlesStyle'] = ['type' => 'combo', 'default' => true, 'editable' => true, 'label' => __('Style'), 'grade' => 3, 'datas' => ['Défaut' => 'default', 'Atlantic' => 'atlantic', 'Harmonie Mutuelles' => 'harmonie-mutuelle']]; + $this->fields['articlesStyle'] = ['type' => 'combo', 'default' => true, 'editable' => true, 'label' => __('Style'), 'grade' => 3, 'datas' => ['Défaut' => 'default', 'Atlantic' => 'atlantic', 'Harmonie Mutuelle' => 'harmonie-mutuelle']]; $this->forms['articles'] = ['label' => __('Articles'), 'fieldsnames' => ['articlesFile', 'articlesShare', 'articlesImages', '|', 'articlesStyle', 'articlesFont']]; 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 4601935ea..5d94086e0 100644 --- a/inc/ws/Util/html5/master/class.ws.html5.compiler.php +++ b/inc/ws/Util/html5/master/class.ws.html5.compiler.php @@ -2437,13 +2437,30 @@ class wsHTML5Compiler public function addFontKit($font) { $path = 'style/fonts/' . $font; - $this->stylesheets[] = $path . '/font.css'; + $css = $path . '/font.css'; + if (in_array($css, $this->stylesheets)) { + return; + } + $this->stylesheets[] = $css; $this->vdir->copyDirectory($this->assets . '/' . $path, $path); return $path . '/font.css'; } + + public function SimpleXMLElement_innerXML($xml) + { + $innerXML = ''; + foreach (dom_import_simplexml($xml)->childNodes as $child) { + $innerXML .= $child->ownerDocument->saveXML($child); + } + return $innerXML; + } + + public function writeArticles() { + $mapFonts = ['OpenSans' => 'Open Sans']; + $this->lessVariables['articles-title-color'] = '#000000'; $this->lessVariables['articles-font'] = 'OpenSans'; @@ -2460,11 +2477,15 @@ class wsHTML5Compiler } $this->addLess('articles'); + if ($this->book->parametres->articlesStyle !== 'default') { + $this->lessVariables['articles-styles'] = $this->book->parametres->articlesStyle; + } $this->lessVariables['articles-title-color'] = '#565657'; - $this->lessVariables['articles-font'] = $this->book->parametres->articlesFont; + $this->lessVariables['articles-font'] = $mapFonts[$this->book->parametres->articlesFont] ?? $this->book->parametres->articlesFont; $fontPath = $this->addFontKit($this->book->parametres->articlesFont); + $svg = ' '; @@ -2491,7 +2512,7 @@ class wsHTML5Compiler $prevurl = $url; $specificStyles = '## h3, ## figure figcaption{background-color:' . $article['color'] . '}'; - $specificStyles .= '## .chapo, ## blockquote{color:' . $article['color'] . ';}'; + $specificStyles .= '## .chapo, ## blockquote, ## a{color:' . $article['color'] . ';}'; $inner = '
'; $inner .= ''; @@ -2519,7 +2540,7 @@ class wsHTML5Compiler $caption = $legend ? '
' . $legend . '
' : ''; $inner .= '
' . $legend . '' . $caption . '
'; } else { - $c = trim(((string)$child)); + $c = trim($this->SimpleXMLElement_innerXML($child)); if (!$c) { continue; }