'js/libs/fluidbook/fluidbook.print.js',
'js/libs/fluidbook/fluidbook.secure.js',
'js/libs/fluidbook/fluidbook.tabs.js',
+ 'js/libs/fluidbook/fluidbook.articles.js',
'js/libs/fluidbook/fluidbook.widget.js',
'js/libs/fluidbook/fluidbook.js',
'js/main.js'],
$this->log('Links written');
$this->writeLangs();
$this->log('Langs written');
+ $this->writeArticles();
+ $this->log('Articles written');
$this->writeSEO();
$this->log('SEO written');
$this->writeWidget();
$this->writeSounds();
$this->log('Sound written');
$this->writeAccessibility();
- $this->log('Sound accessibility');
+ $this->log('Accessibility writter');
$this->writeTexts();
$this->log('Texts written');
$this->writeExtras();
$this->log('Files Synced');
}
+
protected function loadPlugins()
{
$e = explode("\n", $this->book->parametres->mobilePlugins);
return $res;
}
+ public function writeArticles()
+ {
+ $list = [];
+ $f = $this->book->parametres->articlesFile;
+ if ($f === '') {
+ $this->config->articlesList = $list;
+ return;
+ }
+ $f = $this->wdir . '/' . $f;
+ if (!file_exists($f)) {
+ $this->config->articlesList = $list;
+ return;
+ }
+
+ $markupMap = ['category' => 'h3', 'subtitle' => 'h2', 'title' => 'h1', 'lead' => 'div.chapo', 'paragraph' => 'p', 'note' => 'div.note', 'quote' => 'blockquote', 'signature' => 'div.author'];
+
+ $x = simplexml_load_string(file_get_contents($f));
+ foreach ($x->xpath('/articles/article') as $k => $a) {
+ $article = ['id' => (string)$a['id'],
+ 'url' => (string)$a['url'],
+ 'color' => (string)$a['color'],
+ 'contents' => ''];
+
+ $id = 'article_' . $k;
+
+ $content = '<article id="' . $id . '">';
+ foreach ($a->children() as $child) {
+ $tag = $child->getName();
+ if ($tag === 'image') {
+ $file = (string)$child['file'];
+ $legend = (string)$child;
+ $content .= '<figure><img src="data/articles/' . $file . '" alt="' . $legend . '"><figcation>' . $legend . '</figcation></figure>';
+ } else {
+ $m = $markupMap[$tag] ?? $tag;
+ $e = explode('.', $m);
+ $markup = $e[0];
+ $class = '';
+ if (count($e) === 2) {
+ $class = ' class="' . $e[1] . '"';
+ }
+ $content .= '<' . $markup . $class . '>' . ((string)$child) . '</' . $markup . '>';
+ }
+ }
+ $content .= '</article>';
+ $article['contents'] = $content;
+ $list[] = $article;
+ }
+
+ $this->config->articlesList = $list;
+ }
+
}
if (!function_exists('is_countable')) {