Site Tools


wiki:pluginsyntax:bookcreator

BookCreator Plugin

The bookcreator plugin allow to select some pages from wiki and export to create a little book PDF or text (like a similar function of Wikipedia)

The component for syntax, displays the list of pages selected for exporting and manage selections; the component for action, handle the selection by a add/removing pages, show a toolbar (like a similar toolbar of Wikipedia).

On the list of selected pages, You can use drag and drop to change the order, save your selection for restore in a second time or share with other users.

To work, this plugin needs cookies; the PDF export required dw2pdf plugin; the TEXT ONLY export required text plugin.

Usage

To use this plugin, use these two simple ways:

~~BOOK~~

or

~~ARCHIVEBOOK:number&sort~~

in the page 'wiki:ebook' (create it first).

With ~~BOOK~~ You can show and manage your list of selected pages

  • Reset all selection
  • Exclude a page from list
  • View the excluded pages and “include” them back
  • Create the PDF book on selected pages
  • Create a printable version of selected pages
  • Extract only text of selected pages
  • Drag and drop to change exporting order of page (use Tool-Man JavaScript library )
  • Set a title for the PDF document
  • Save and restore selections on a specific namespace (use ACL's rights)


With ~~ARCHIVEBOOK:number&sort~~ You can show a list of saved selections (books) anywhere into your wiki

  • Restore a selection to manage/export again
  • sort by date/title
  • show only first number selections

Optionally you can specify the number of selections to display and the order. Default is 10 items ordered by date (first last updated). Each of selection is linked to book's page for it.

Installation

To add or remove a page to selection, you simply need to call the page passing it a “do=addtobook” PHP argument. The easiest way to implement this is to add a button or similar somewhere in your template design.

Default template

Use the following to add another button in the upper or bottom button row of the default template1)

1)
In /lib/tpl/default/main.php, there are two divs that contain some buttons:
and
''. Just insert the HTML code inside one of the two divs (left or right) ))
<form class="button" method="get" action="<?php wl($ID)?>">
  <div class="no">
    <input type="submit" value="Add/Remove selection" class="button" />
    <input type="hidden" name="do" value="addtobook" />
    <input type="hidden" name="id" value="<?php echo $ID?>" />
  </div>
</form>

Monobook

When using the template “monobook for DokuWiki”, to have an Add/Remove link, in /user/tabs.php, use this code
//pdfbook plugin: add/remove selection
if (file_exists(DOKU_PLUGIN."bookcreator/action.php") &&
    !plugin_isdisabled("bookcreator")){
    $_monobook_tabs["tab-bookcreator"]["text"] = "Add/Remove to selection";
    $_monobook_tabs["tab-bookcreator"]["href"] = wl(getID(), array("do" => "addtobook"), false, "&");
}

Changing the order of wiki pages

To change the order of wiki pages in your book, simply move the pages in the list. To do so, hover over the page title to move, click and drag it to the new location. Release the mouse button to finish moving the page to its new location.

Saving books

Format of stored book pages: when you save a book, it is stored in the format shown below.
====== MyBookName ======
  * [[:first_pages]]
  * [[:second_page]]
  * .....
  * [[:last_page]]
You can also manually create a book from scratch by using the same format. To create a book from scratch, start a new page such as wiki:ebook:mybookname (default). The namespace can be changed at admin side configuration.
wiki/pluginsyntax/bookcreator.txt · Last modified: 2018/05/28 22:29 by 127.0.0.1