From d22c73b14f9269f5785961b8593d3d924df3711d Mon Sep 17 00:00:00 2001 From: quenousimporte Date: Mon, 8 Jul 2024 15:07:27 +0200 Subject: [PATCH] implement cafeyn --- epub.php | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/epub.php b/epub.php index d2580cf..2c89575 100644 --- a/epub.php +++ b/epub.php @@ -136,7 +136,47 @@ $articleurl = str_replace('material', 'article/' . $entry->hash . '.json', $url); $articlejson = file_get_contents($articleurl); $article = json_decode($articlejson); - $epub->AddPage($article->title, false, $article->title); + + $content = '

' . $article->title . '

'; + $content .= '' . $article->abstract . ''; + + if (count($article->rubrics)) + { + $content .= '
Rubriques: ' . implode(',', $article->rubrics) . '
'; + } + if (count($article->authors)) + { + $content .= '
Auteurs: ' . implode(',', $article->authors) . '
'; + } + + foreach ($article->content->sections as $section) + { + foreach ($section->items as $item) + { + if ($item->type == 'text') + { + if ($item->class == 'quote') + { + $content .= '
' .$item->content . '
'; + } + else if ($item->class == 'paragraphTitle') + { + $content .= '

' .$item->content . '

'; + } + else + { + $content .= '

' .$item->content . '

'; + } + } + } + } + + /*if ($article->imageUrl) + { + $epub->AddPage('', false, 'Page ' . $article->page, true); + }*/ + $epub->AddPage($content, false, $article->title); + } write_epub($epub); }