'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 <image> 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']];
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';
}
$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 = '<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><symbol id="nav-print" viewBox="0 0 512 512">
<path d="m424 186l-39 0 0-114c0-9-6-15-14-15l-230 0c-8 0-14 6-14 15l0 114-39 0c-22 0-41 19-41 41l0 121c0 23 19 41 41 41l39 0 0 49c0 8 6 15 14 15l230 0c8 0 14-7 14-15l0-49 39 0c22 0 41-18 41-41l0-121c0-22-19-41-41-41z m-268-100l200 0 0 100-200 0z m200 340l-200 0 0-88 200 0z m80-76c0 6-6 12-12 12l-39 0 0-38c0-9-6-15-14-15l-230 0c-8 0-14 6-14 15l0 38-39 0c-6 0-12-6-12-12l0-121c0-6 6-12 12-12l336 0c6 0 12 6 12 12z m-278-96l-33 0c-8 0-14 6-14 14 0 8 6 15 14 15l35 0c8 0 14-7 14-15 0-8-8-14-16-14z m32 139l132 0c8 0 14-6 14-14 0-8-6-14-14-14l-132 0c-8 0-14 6-14 14 0 8 6 14 14 14z"/>
</symbol></svg>';
$prevurl = $url;
$specificStyles = '## h3, ## figure figcaption{background-color:' . $article['color'] . '}';
- $specificStyles .= '## .chapo, ## blockquote{color:' . $article['color'] . ';}';
+ $specificStyles .= '## .chapo, ## blockquote, ## a{color:' . $article['color'] . ';}';
$inner = '<article data-id="' . $article['id'] . '" class="menu-article" id="article_' . $article['id'] . '">';
$inner .= '<style type="text/css">' . str_replace('##', '#article_' . $article['id'], $specificStyles) . '</style>';
$caption = $legend ? '<figcaption>' . $legend . '</figcaption>' : '';
$inner .= '<figure><img src="data/articles/' . $file . '" alt="' . $legend . '">' . $caption . '</figure>';
} else {
- $c = trim(((string)$child));
+ $c = trim($this->SimpleXMLElement_innerXML($child));
if (!$c) {
continue;
}