Wikisource:WS Export
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: https://ws-export.wmcloud.org/ (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.
History
[edit]The tool was created by user Tpt for French Wikisource, but it's also available for the other Wikisource subdomains.
For books
[edit]Microformat
[edit]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
[edit]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
[edit]WS Export uses a cache system, you must follow this URL when you change the following files: https://ws-export.wmcloud.org/?refresh=true&lang=YOUR_LANG_CODE
CSS
[edit]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
. CSS style from the book's styles.css
page in the index namespace is also exported in the ePub file.
Translation
[edit]To translate the interface's messages, create MediaWiki:Wsexport i18n.ini (follow this file as example).
About
[edit]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
[edit]Please report any issues via Phabricator, with the project tag #ws_export. Alternatively, you can add them on the talk page here.
Subpages
[edit]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
[edit]- Source code on github
- Dumps of log SQL can be found at https://ws-export.wmcloud.org/logs/
- Deployment documentation: wikitech:Nova Resource:Wikisource
Known bugs
[edit]- The internal links don't work if there is a redirection in Wikisource.