From 74bd005c2482020680870d55ba5768db13d87997 Mon Sep 17 00:00:00 2001 From: Ventricule Date: Wed, 7 Aug 2019 17:19:48 +0200 Subject: [PATCH] Fix .odt download --- libreto/libreto.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libreto/libreto.php b/libreto/libreto.php index 81c020f..8a3decf 100644 --- a/libreto/libreto.php +++ b/libreto/libreto.php @@ -172,19 +172,21 @@ class Libreto public function export(){ $title = $this->name(); - $introduction = $this->pads()->find('about')->html(); + //$introduction = $this->pads()->find('about') ? $this->pads()->find('about')->html() : false; $pads = $this->pads()->children(); $chapters = array(); foreach($pads as $pad) : $name = $pad->name(); $html = $pad->html(); - $chapters[] = array("title" => $name, "html" => $html); + if( !in_array($name, array('style.css', 'book.js')) && !$pad->isEmpty() ) : + $chapters[] = array("title" => $name, "html" => $html); + endif; endforeach; $odt = new \CatoTH\HTML2OpenDocument\Text(); $odt->addHtmlTextBlock('

' . $title . '

'); - $odt->addHtmlTextBlock($introduction); + //$odt->addHtmlTextBlock($introduction); foreach ($chapters as $chapter) { $odt->addHtmlTextBlock('

' . $chapter['title'] . '

'); $odt->addHtmlTextBlock($chapter['html']);