Wikisource:WS Export

From Wikisource
(Redirected from Wikisource:WSexport)
Jump to navigation Jump to search
Translate this page; This page contains changes which are not marked for translation.

WS Export is a tool for exporting Wikisource's texts in EPUB, PDF and other file formats.

It can be used directly from its page on Toolforge: (for texts in all languages; use "www" for Multilingual Wikisource, or "beta" for Beta Wikisource).

This page explains how to configure a Wikisource project in order to get the best results from WS Export. For most of these operations you will need admin access.



The tool was created by user Tpt for French Wikisource, but it's also available for the other Wikisource subdomains.

For books




When exporting a page, WS Export looks for the page's metadata (title, author, year, etc.) using the Microformat specification. In order to see these informations in the exported EPUBs, you must implement Microformat on your subdomain, in the template that you're using as header for your texts. You can find an example at the bottom of fr:Modèle:Proofreadpage header template.

Hide unwanted elements


You may want to hide certain elements in your EPUBs, like the header box, or the page numbers generated by MediaWiki:Proofreadpage pagenum template. Assign class="ws-noexport" to each HTML element that you want to be excluded from the export.

For the wiki


WS Export uses a cache system, you must follow this URL when you change the following files:



If you need to include some custom CSS style, you can create MediaWiki:Epub.css and put them there. No CSS from Mediawiki:Common.css or CSS provided by MediaWiki are injected in the generated ePub file. If you want to keep certain content from appearing in the exported text, you can use the CSS class ws-noexport.



To translate the interface's messages, create MediaWiki:Wsexport i18n.ini (follow this file as example).



You can provide your about file by creating MediaWiki:Wsexport about (follow fr:MediaWiki:Wsexport about as example). The list of contributors, bots excepted, is included by the "{CONTRIBUTORS}" tag. For the bots list, use "{BOT-CONTRIBUTORS}" tag.

Bug reports


Please report any issues via Phabricator, with the project tag #ws_export. Alternatively, you can add them on the talk page here.



The current algorithm used in WS Export to extract the table of content (TOC) of the book (and so, include the other pages of the book) is:

  • look for nodes in the pages with class="ws-summary" (it could be directly MY_TOC in the page wikitext of an equivalent thing done using templates)
  • if such nodes are found, use the list of links in them to build the TOC
  • if not look for all links to subpages and use the returned list as TOC

See also


Known bugs

  • The internal links don't work if there is a redirection in Wikisource.