diff --git a/mod/book/locallib.php b/mod/book/locallib.php index 52cb3d4aac1..3005c70798b 100644 --- a/mod/book/locallib.php +++ b/mod/book/locallib.php @@ -52,7 +52,7 @@ define ('BOOK_LINK_TEXT', '2'); /** * Preload book chapters and fix toc structure if necessary. * - * Returns array of chapters with standard 'pagenum', 'id, pagenum, subchapter, title, hidden' + * Returns array of chapters with standard 'pagenum', 'id, pagenum, subchapter, title, content, contentformat, hidden' * and extra 'parent, number, subchapters, prev, next'. * Please note the content/text of chapters is not included. * @@ -61,7 +61,8 @@ define ('BOOK_LINK_TEXT', '2'); */ function book_preload_chapters($book) { global $DB; - $chapters = $DB->get_records('book_chapters', array('bookid'=>$book->id), 'pagenum', 'id, pagenum, subchapter, title, hidden'); + $chapters = $DB->get_records('book_chapters', array('bookid' => $book->id), 'pagenum', 'id, pagenum, + subchapter, title, content, contentformat, hidden'); if (!$chapters) { return array(); } diff --git a/mod/book/tool/print/classes/output/print_book_chapter_page.php b/mod/book/tool/print/classes/output/print_book_chapter_page.php new file mode 100644 index 00000000000..cd70be80dfe --- /dev/null +++ b/mod/book/tool/print/classes/output/print_book_chapter_page.php @@ -0,0 +1,106 @@ +. + +/** + * Class containing data for the view book page. + * + * @package booktool_print + * @copyright 2019 Mihail Geshoski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +namespace booktool_print\output; + +defined('MOODLE_INTERNAL') || die(); + +use renderable; +use renderer_base; +use stdClass; +use templatable; +use context_module; + +/** + * Class containing data for the print book page. + * + * @copyright 2019 Mihail Geshoski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class print_book_chapter_page implements renderable, templatable { + + /** + * @var object $book The book object. + */ + protected $book; + + /** + * @var object $cm The course module object. + */ + protected $cm; + + /** + * @var object $chapter The book chapter object. + */ + protected $chapter; + + /** + * Construct this renderable. + * + * @param object $book The book + * @param object $cm The course module + * @param object $chapter The book chapter + */ + public function __construct($book, $cm, $chapter) { + $this->book = $book; + $this->cm = $cm; + $this->chapter = $chapter; + } + + /** + * Export this data so it can be used as the context for a mustache template. + * + * @param renderer_base $output + * @return stdClass + */ + public function export_for_template(renderer_base $output) { + global $OUTPUT; + + $context = context_module::instance($this->cm->id); + $chapters = book_preload_chapters($this->book); + + $data = new stdClass(); + // Print dialog link. + $data->printdialoglink = $output->render_print_book_chapter_dialog_link(); + $data->booktitle = $OUTPUT->heading(format_string($this->book->name, true, + array('context' => $context)), 1); + if (!$this->book->customtitles) { + // If the current chapter is a subchapter, get the title of the parent chapter. + if ($this->chapter->subchapter) { + $parentchaptertitle = book_get_chapter_title($chapters[$this->chapter->id]->parent, $chapters, + $this->book, $context); + $data->parentchaptertitle = $OUTPUT->heading(format_string($parentchaptertitle, true, + array('context' => $context)), 2); + } + } + + list($chaptercontent, $chaptervisible) = $output->render_print_book_chapter($this->chapter, $chapters, + $this->book, $this->cm); + $chapter = new stdClass(); + $chapter->content = $chaptercontent; + $chapter->visible = $chaptervisible; + $data->chapter = $chapter; + + return $data; + } +} diff --git a/mod/book/tool/print/classes/output/print_book_page.php b/mod/book/tool/print/classes/output/print_book_page.php new file mode 100644 index 00000000000..3dd593678aa --- /dev/null +++ b/mod/book/tool/print/classes/output/print_book_page.php @@ -0,0 +1,102 @@ +. + +/** + * Class containing data for the view book page. + * + * @package booktool_print + * @copyright 2019 Mihail Geshoski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +namespace booktool_print\output; + +defined('MOODLE_INTERNAL') || die(); + +use moodle_url; +use renderable; +use renderer_base; +use stdClass; +use templatable; +use context_module; + +/** + * Class containing data for the print book page. + * + * @copyright 2019 Mihail Geshoski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class print_book_page implements renderable, templatable { + + /** + * @var object $book The book object. + */ + protected $book; + + /** + * @var object $cm The course module object. + */ + protected $cm; + + /** + * Construct this renderable. + * + * @param object $book The book + * @param object $cm The course module + */ + public function __construct($book, $cm) { + $this->book = $book; + $this->cm = $cm; + } + + /** + * Export this data so it can be used as the context for a mustache template. + * + * @param renderer_base $output + * @return stdClass + */ + public function export_for_template(renderer_base $output) { + global $OUTPUT, $CFG, $SITE, $USER; + + $context = context_module::instance($this->cm->id); + $chapters = book_preload_chapters($this->book); + $course = get_course($this->book->course); + + $data = new stdClass(); + // Print dialog link. + $data->printdialoglink = $output->render_print_book_dialog_link(); + $data->booktitle = $OUTPUT->heading(format_string($this->book->name, true, + array('context' => $context)), 1); + $data->bookintro = format_text($this->book->intro, $this->book->introformat, + array('noclean' => true, 'context' => $context)); + $data->sitelink = \html_writer::link(new moodle_url($CFG->wwwroot), + format_string($SITE->fullname, true, array('context' => $context))); + $data->coursename = format_string($course->fullname, true, array('context' => $context)); + $data->modulename = format_string($this->book->name, true, array('context' => $context)); + $data->username = fullname($USER, true); + $data->printdate = userdate(time()); + $data->toc = $output->render_print_book_toc($chapters, $this->book, $this->cm); + foreach ($chapters as $ch) { + list($chaptercontent, $chaptervisible) = $output->render_print_book_chapter($ch, $chapters, $this->book, + $this->cm); + $chapter = new stdClass(); + $chapter->content = $chaptercontent; + $chapter->visible = $chaptervisible; + $data->chapters[] = $chapter; + } + + return $data; + } +} diff --git a/mod/book/tool/print/classes/output/renderer.php b/mod/book/tool/print/classes/output/renderer.php new file mode 100644 index 00000000000..21c29325417 --- /dev/null +++ b/mod/book/tool/print/classes/output/renderer.php @@ -0,0 +1,210 @@ +. + +/** + * Defines the renderer for the book print tool. + * + * @package booktool_print + * @copyright 2019 Mihail Geshoski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace booktool_print\output; + +defined('MOODLE_INTERNAL') || die(); + +use plugin_renderer_base; +use html_writer; +use context_module; +use moodle_url; +use moodle_exception; + +/** + * The renderer for the book print tool. + * + * @copyright 2019 Mihail Geshoski + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +class renderer extends plugin_renderer_base { + + /** + * Render the print book page. + * + * @param print_book_page $page + * @return string html for the page + * @throws moodle_exception + */ + public function render_print_book_page(print_book_page $page) { + $data = $page->export_for_template($this); + return parent::render_from_template('booktool_print/print_book', $data); + } + + /** + * Render the print book chapter page. + * + * @param print_book_chapter_page $page + * @return string html for the page + * @throws moodle_exception + */ + public function render_print_book_chapter_page(print_book_chapter_page $page) { + $data = $page->export_for_template($this); + return parent::render_from_template('booktool_print/print_book_chapter', $data); + } + + /** + * Render the print book chapter link. + * + * @return string html for the link + */ + public function render_print_book_chapter_dialog_link() { + $printtext = get_string('printchapter', 'booktool_print'); + $printicon = $this->output->pix_icon('chapter', $printtext, 'booktool_print', + array('class' => 'icon')); + $printlinkatt = array('onclick' => 'window.print();return false;', 'class' => 'hidden-print'); + return html_writer::link('#', $printicon . $printtext, $printlinkatt); + } + + /** + * Render the print book link. + * + * @return string html for the link + */ + public function render_print_book_dialog_link() { + $printtext = get_string('printbook', 'booktool_print'); + $printicon = $this->output->pix_icon('book', $printtext, 'booktool_print', + array('class' => 'icon')); + $printlinkatt = array('onclick' => 'window.print();return false;', 'class' => 'hidden-print'); + return html_writer::link('#', $printicon . $printtext, $printlinkatt); + } + + /** + * Render the print book table of contents. + * + * @param array $chapters Array of book chapters + * @param object $book The book object + * @param object $cm The curse module object + * @return string html for the TOC + */ + public function render_print_book_toc($chapters, $book, $cm) { + + $first = true; + $titles = array(); + + $context = context_module::instance($cm->id); + + $toc = ''; // Representation of toc (HTML). + + switch ($book->numbering) { + case BOOK_NUM_NONE: + $toc .= html_writer::start_tag('div', array('class' => 'book_toc_none')); + break; + case BOOK_NUM_NUMBERS: + $toc .= html_writer::start_tag('div', array('class' => 'book_toc_numbered')); + break; + case BOOK_NUM_BULLETS: + $toc .= html_writer::start_tag('div', array('class' => 'book_toc_bullets')); + break; + case BOOK_NUM_INDENTED: + $toc .= html_writer::start_tag('div', array('class' => 'book_toc_indented')); + break; + } + + $toc .= html_writer::tag('a', '', array('name' => 'toc')); // Representation of toc (HTML). + + $toc .= html_writer::tag('h2', get_string('toc', 'mod_book'), ['class' => 'text-center p-b-2']); + $toc .= html_writer::start_tag('ul'); + foreach ($chapters as $ch) { + if (!$ch->hidden) { + $title = book_get_chapter_title($ch->id, $chapters, $book, $context); + if (!$ch->subchapter) { + + if ($first) { + $toc .= html_writer::start_tag('li'); + } else { + $toc .= html_writer::end_tag('ul'); + $toc .= html_writer::end_tag('li'); + $toc .= html_writer::start_tag('li'); + } + + } else { + + if ($first) { + $toc .= html_writer::start_tag('li'); + $toc .= html_writer::start_tag('ul'); + $toc .= html_writer::start_tag('li'); + } else { + $toc .= html_writer::start_tag('li'); + } + + } + $titles[$ch->id] = $title; + + if (!$ch->subchapter) { + $toc .= html_writer::link(new moodle_url('#ch' . $ch->id), $title, + array('title' => s($title), 'class' => 'font-weight-bold text-decoration-none')); + $toc .= html_writer::start_tag('ul'); + } else { + $toc .= html_writer::link(new moodle_url('#ch' . $ch->id), $title, + array('title' => s($title), 'class' => 'text-decoration-none')); + $toc .= html_writer::end_tag('li'); + } + $first = false; + } + } + + $toc .= html_writer::end_tag('ul'); + $toc .= html_writer::end_tag('li'); + $toc .= html_writer::end_tag('ul'); + $toc .= html_writer::end_tag('div'); + + $toc = str_replace('', '', $toc); // Cleanup of invalid structures. + + return $toc; + } + + /** + * Render the print book chapter. + * + * @param object $chapter The book chapter object + * @param array $chapters The array of book chapters + * @param object $book The book object + * @param object $cm The course module object + * @return array The array containing the content of the book chapter and visibility information + */ + public function render_print_book_chapter($chapter, $chapters, $book, $cm) { + global $OUTPUT; + + $context = context_module::instance($cm->id); + $title = book_get_chapter_title($chapter->id, $chapters, $book, $context); + + $chaptervisible = $chapter->hidden ? false : true; + + $bookchapter = ''; + $bookchapter .= html_writer::start_div('book_chapter p-t-1', ['id' => 'ch' . $chapter->id]); + if (!$book->customtitles) { + if (!$chapter->subchapter) { + $bookchapter .= $OUTPUT->heading($title, 2, 'text-center p-b-2'); + } else { + $bookchapter .= $OUTPUT->heading($title, 3, 'text-center p-b-2'); + } + } + + $bookchapter .= format_text($chapter->content, $chapter->contentformat, array('noclean' => true, 'context' => $context)); + $bookchapter .= html_writer::end_div(); + + return array($bookchapter, $chaptervisible); + } +} diff --git a/mod/book/tool/print/index.php b/mod/book/tool/print/index.php index ac86e912ece..a704d80fc07 100644 --- a/mod/book/tool/print/index.php +++ b/mod/book/tool/print/index.php @@ -33,8 +33,8 @@ $chapterid = optional_param('chapterid', 0, PARAM_INT); // Chapter ID // ========================================================================= $cm = get_coursemodule_from_id('book', $id, 0, false, MUST_EXIST); -$course = $DB->get_record('course', array('id'=>$cm->course), '*', MUST_EXIST); -$book = $DB->get_record('book', array('id'=>$cm->instance), '*', MUST_EXIST); +$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); +$book = $DB->get_record('book', array('id' => $cm->instance), '*', MUST_EXIST); require_course_login($course, true, $cm); @@ -45,13 +45,14 @@ require_capability('booktool/print:print', $context); // Check all variables. if ($chapterid) { // Single chapter printing - only visible! - $chapter = $DB->get_record('book_chapters', array('id'=>$chapterid, 'bookid'=>$book->id), '*', MUST_EXIST); + $chapter = $DB->get_record('book_chapters', array('id' => $chapterid, 'bookid' => $book->id), '*', + MUST_EXIST); } else { // Complete book. $chapter = false; } -$PAGE->set_url('/mod/book/print.php', array('id'=>$id, 'chapterid'=>$chapterid)); +$PAGE->set_url('/mod/book/print.php', array('id' => $id, 'chapterid' => $chapterid)); // Use "embedded" instead of "print" because Bootstrapbase shows top // header bar and navbar even on print style - which is inconsistent @@ -71,112 +72,28 @@ $strbook = get_string('modulename', 'mod_book'); $strtop = get_string('top', 'mod_book'); // Page header. -$strtitle = format_string($book->name, true, array('context'=>$context)); +$strtitle = format_string($book->name, true, array('context' => $context)); $PAGE->set_title($strtitle); $PAGE->set_heading($strtitle); $PAGE->requires->css('/mod/book/tool/print/print.css'); +$renderer = $PAGE->get_renderer('booktool_print'); + // Begin page output. echo $OUTPUT->header(); if ($chapter) { - if ($chapter->hidden) { require_capability('mod/book:viewhiddenchapters', $context); } \booktool_print\event\chapter_printed::create_from_chapter($book, $context, $chapter)->trigger(); - - // Print dialog link. - $printtext = get_string('printchapter', 'booktool_print'); - $printicon = $OUTPUT->pix_icon('chapter', $printtext, 'booktool_print', array('class' => 'icon')); - $printlinkatt = array('onclick' => 'window.print();return false;', 'class' => 'hidden-print'); - echo html_writer::link('#', $printicon.$printtext, $printlinkatt); - ?> - - heading(format_string($book->name, true, array('context'=>$context)), 1); - ?> -
- customtitles) { - if (!$chapter->subchapter) { - $currtitle = book_get_chapter_title($chapter->id, $chapters, $book, $context); - echo $OUTPUT->heading($currtitle); - } else { - $currtitle = book_get_chapter_title($chapters[$chapter->id]->parent, $chapters, $book, $context); - $currsubtitle = book_get_chapter_title($chapter->id, $chapters, $book, $context); - echo $OUTPUT->heading($currtitle); - echo $OUTPUT->heading($currsubtitle, 3); - } - } - - $chaptertext = file_rewrite_pluginfile_urls($chapter->content, 'pluginfile.php', $context->id, 'mod_book', 'chapter', $chapter->id); - echo format_text($chaptertext, $chapter->contentformat, array('noclean'=>true, 'context'=>$context)); - echo '
'; - + $page = new booktool_print\output\print_book_chapter_page($book, $cm, $chapter); } else { \booktool_print\event\book_printed::create_from_book($book, $context)->trigger(); - - $allchapters = $DB->get_records('book_chapters', array('bookid'=>$book->id), 'pagenum'); - $book->intro = file_rewrite_pluginfile_urls($book->intro, 'pluginfile.php', $context->id, 'mod_book', 'intro', null); - - // Print dialog link. - $printtext = get_string('printbook', 'booktool_print'); - $printicon = $OUTPUT->pix_icon('book', $printtext, 'booktool_print', array('class' => 'icon')); - $printlinkatt = array('onclick' => 'window.print();return false;', 'class' => 'hidden-print'); - echo html_writer::link('#', $printicon.$printtext, $printlinkatt); - ?> - - heading(format_string($book->name, true, array('context'=>$context)), 1); - ?> -

intro, $book->introformat, array('noclean'=>true, 'context'=>$context)) ?>

-
- - - - - - - - - - - - - - - - -
:fullname, true, array('context'=>$context)) ?>
:fullname, true, array('context'=>$context)) ?>
:name, true, array('context'=>$context)) ?>
:
:
- - wwwroot.'/mod/book/view.php?id='.$course->id.'&chapterid='; - $link2 = $CFG->wwwroot.'/mod/book/view.php?id='.$course->id; - foreach ($chapters as $ch) { - $chapter = $allchapters[$ch->id]; - if ($chapter->hidden) { - continue; - } - echo '
'; - if (!$book->customtitles) { - if (!$chapter->subchapter) { - echo $OUTPUT->heading($titles[$ch->id]); - } else { - echo $OUTPUT->heading($titles[$ch->id], 3); - } - } - $content = str_replace($link1, '#ch', $chapter->content); - $content = str_replace($link2, '#top', $content); - $content = file_rewrite_pluginfile_urls($content, 'pluginfile.php', $context->id, 'mod_book', 'chapter', $ch->id); - echo format_text($content, $chapter->contentformat, array('noclean'=>true, 'context'=>$context)); - echo '
'; - // echo ''.$strtop.''; - } + $page = new booktool_print\output\print_book_page($book, $cm); } +echo $renderer->render($page); + // Finish page output. echo $OUTPUT->footer(); \ No newline at end of file diff --git a/mod/book/tool/print/locallib.php b/mod/book/tool/print/locallib.php index b8d06705f4f..169caf3dc11 100644 --- a/mod/book/tool/print/locallib.php +++ b/mod/book/tool/print/locallib.php @@ -30,12 +30,16 @@ require_once($CFG->dirroot.'/mod/book/locallib.php'); /** * Generate toc structure and titles * + * @deprecated since Moodle 3.7 * @param array $chapters * @param stdClass $book * @param stdClass $cm * @return array */ function booktool_print_get_toc($chapters, $book, $cm) { + debugging('booktool_print_get_toc() is deprecated. Please use booktool_print renderer + function render_print_book_toc().', DEBUG_DEVELOPER); + $first = true; $titles = array(); diff --git a/mod/book/tool/print/print.css b/mod/book/tool/print/print.css index 7b733c0c884..c28fe487b6d 100644 --- a/mod/book/tool/print/print.css +++ b/mod/book/tool/print/print.css @@ -1,48 +1,3 @@ -#page-mod-book-print { - color: #000; - background-color: #fff; - font-family: "Times New Roman", Times, serif; - font-size: 1em; - font-weight: normal; - text-decoration: none; -} - -#page-mod-book-print { - margin-left: 50px; - margin-right: 10px; -} - -#page-mod-book-print h1, -#page-mod-book-print h2, -#page-mod-book-print h3, -#page-mod-book-print h4, -#page-mod-book-print h5, -#page-mod-book-print h6 { - page-break-after: avoid; - page-break-inside: avoid; - margin-left: 0; -} - -/* just some hack - ignore user defined */ -#page-mod-book-print font { - color: #000; - background-color: #eee; - font-family: "Times New Roman", Times, serif; - font-size: 1em; - font-weight: normal; - text-decoration: none; -} - -#page-mod-book-print .book_summary { - text-align: center; - margin-bottom: 120px; - margin-left: -40px; -} - -#page-mod-book-print .book_chapter { - page-break-before: always; -} - /* ===== TOC numbering styles ===== */ /* numbering == NONE */ @@ -136,11 +91,21 @@ padding-left: 0; } +#page-mod-book-print .book .book_chapter, +#page-mod-book-print .book .book_description { + page-break-before: always; +} + +#page-mod-book-print { + padding-top: 0; +} /* Exclude elements from printing. */ - @media print { .hidden-print { display: none !important; /* stylelint-disable-line declaration-no-important */ } + .book .book_title { + margin-top: 45%; + } } diff --git a/mod/book/tool/print/templates/print_book.mustache b/mod/book/tool/print/templates/print_book.mustache new file mode 100644 index 00000000000..b6a0214b69b --- /dev/null +++ b/mod/book/tool/print/templates/print_book.mustache @@ -0,0 +1,137 @@ +{{! + This file is part of Moodle - http://moodle.org/ + + Moodle is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Moodle is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more comments. + + You should have received a copy of the GNU General Public License + along with Moodle. If not, see . +}} +{{! + @template booktool_print/print_book + + Print book page. + + Classes required for JS: + * none + + Data attributes required for JS: + * none + + * printdialoglink string The URL pointing to the print book chapter popup window. + * booktitle string The HTML of the book title. + * bookintro string The book description. + * sitelink string The HTML link pointing to the site's dashboard. + * coursename string The name of the course. + * modulename string The name of the module. + * username string The user name. + * printdate string The print date. + * chaptertitle string The title of the chapter. + * toc object The HTML of the table of contents. + * chapters array The array of book chapters, their content and visibility information. + + Example context (json): + { + "printdialoglink": "Print book", + "booktitle": "

Book title

", + "bookintro": "Book description", + "sitelink" : "Site title", + "coursename" : "Course name", + "modulename" : "Module name", + "username" : "User name", + "printdate" : "Tuesday, 22 January 2019, 10:17 AM", + "chaptertitle": "Chapter title", + "toc" : "
Table of contents
", + "chapters": [ + { + "content": "
Chapter1 content
", + "visible": "true" + }, + { + "content": "
Chapter2 content
", + "visible": "false" + } + ] + } +}} +
+
{{{ printdialoglink }}}
+
{{{ booktitle }}}
+
+
+ + + + + + + + + + + + + +
+ {{# str }} site {{/ str }}: + + {{{ sitelink }}} +
+ {{# str }} course {{/ str }}: + + {{{ coursename }}} +
+ {{# str }} modulename, mod_book {{/ str }}: + + {{{ modulename }}} +
+
+
+ + + + + + + + + +
+ {{# str }} printedby, booktool_print {{/ str }}: + + {{{ username }}} +
+ {{# str }} printdate, booktool_print {{/ str }}: + + {{{ printdate }}} +
+
+
+ {{#bookintro}} +
+
+

{{#str}} description {{/str}}

+

{{{ bookintro }}}

+
+
+ {{/bookintro}} +
+
{{{ toc }}}
+
+
+ {{#chapters}} + {{#visible }} +
+ {{{ content }}} +
+ {{/visible}} + {{/chapters}} +
+
diff --git a/mod/book/tool/print/templates/print_book_chapter.mustache b/mod/book/tool/print/templates/print_book_chapter.mustache new file mode 100644 index 00000000000..bfcc41dd0dc --- /dev/null +++ b/mod/book/tool/print/templates/print_book_chapter.mustache @@ -0,0 +1,56 @@ +{{! + This file is part of Moodle - http://moodle.org/ + + Moodle is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Moodle is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more comments. + + You should have received a copy of the GNU General Public License + along with Moodle. If not, see . +}} +{{! + @template booktool_print/print_book_chapter + + Print book chapter page. + + Classes required for JS: + * none + + Data attributes required for JS: + * none + + Context variables required for this template: + * printdialoglink string The URL pointing to the print book chapter popup window. + * booktitle string The HTML of the book title. + * parentchaptertitle string The HTML of the parent chapter title (if exists). + * chapter object The object containing the HTML of the chapter content and chapter's visibility. + + Example context (json): + { + "printdialoglink": "Print book", + "booktitle": "

Book title

", + "parentchaptertitle": "

Parent chapter title

", + "chapter": { + "content": "
Chapter content
", + "visible": "true" + } + } +}} +
+
{{{ printdialoglink }}}
+
{{{ booktitle }}}
+
+ {{#parentchaptertitle}} +
+ {{{parentchaptertitle}}} +
+ {{/parentchaptertitle}} + {{{chapter.content}}} +
+