Extension:DocBookExport

From MediaWiki.org
Jump to navigation Jump to search


MediaWiki extensions manualManual:Extensions
Crystal Clear action run.svg
DocBookExport

Release status:Extension status beta

ImplementationTemplate:Extension#type Parser function
DescriptionTemplate:Extension#description Lets you create DocBook from pages
Author(s)Template:Extension#username Nischay Nahata (Nischayn22talk)
MediaWikiTemplate:Extension#mediawiki 1.29+
PHPTemplate:Extension#php 5.5+
Database changesTemplate:Extension#needs-updatephp No
LicenseTemplate:Extension#license MIT License
Download
README
ParametersTemplate:Extension#parameters
  • $wgDocBookExportPandocPath
Hooks usedTemplate:Extension#hook
ParserFirstCallInitManual:Hooks/ParserFirstCallInit

Translate the DocBookExport extension if it is available at translatewiki.net

Check usage and version matrix.

The DocBookExport extension lets you create a DocBook from selected wiki pages. You can download the DocBook as an XML file or in PDF format.

Installation[edit]

Make sure that you installed all required dependencies on your server.
  • Download and place the file(s) in a directory called DocBookExport in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'DocBookExport' );
    
  • Configure as required
  • YesY Done - Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Configuration[edit]

$wgDocBookExportPandocPath
Set the absolute path to your Pandoc software, defaults to "pandoc"

Dependencies[edit]

For Ubuntu use the following commands, replace the version number as per the latest release:
sudo wget https://github.com/jgm/pandoc/releases/download/2.2.1/pandoc-2.2.1-1-amd64.deb
sudo dpkg -i pandoc-2.2.1-1-amd64.deb

Usage[edit]

To create a book define the page structure using the docbook parser function or tag extension. See examples below.

Parser function example:

{{#docbook:
page structure=
? Bowling Introduction
* How I buy shoes
* Testing page
** Buying clothes intro,Buying shoes(title=Buying the right clothes,header=section header)
? Appendix
|title=My Guide to Bowling
|cover page=Cover Contents
|header=My Guide to Bowling
|footer=My Guide to Bowling
|index term categories=index terms
|index terms=shoe,clothes
}}

On saving the page two links will be made available to download the DocBook: one to download the DocBook as XML files in a zip file and another to download in PDF format.

The parameters shown can be customized as follows:

  • page structure is used to defines the wiki pages that will be part of the docbook as cover, sections and chapters. The first line starts with a '?' and indicates the cover, * indicates a chapter and ** indicates a section of that chapter. Sub-sections can be defined using *** or **** and so on. The last line again starts with a '?' and indicates the wiki page to be used as the appendix. Sometimes you may want to merge contents of multiple wiki pages to one section/chapter. For that you can add a comma separated list of such pages as well. You can also customize the title of such a section by adding the following wikitext (title=) at the end of the line. Similarly you can customize the header for a specific section by using the (header=) syntax at the end of the line as shown in the example.
  • title This parameter defines the name of the Docbook. This doesn't relate to any wiki page and is only used to name the files and the title of the docbook.
  • cover page This parameter specifies the wiki page to be used as the cover page.
  • headerThis parameter specifies the header to be used for every page of the docbook.
  • footerThis parameter specifies the footer to be used for every page of the docbook.
  • index terms This parameter is a comma separated list of terms that should be indexed.
  • index term categories If you have wiki pages for all your index terms you can add them to a category and mention it here.

DocBook supports figures which are images or other media that can be referenced elsewhere in the document. A separate list of figures is also prepared. To define a figure you need to use the Figures extension.

Credits[edit]

This extension has been written by Wikiworks.com for NATO

Development and Help[edit]

Please contact wikiworks.com for consulting on further developments, feature requests or bug fixes on this extension.