Extension:EPubExport

From MediaWiki.org
Jump to: navigation, search
MediaWiki extensions manual
Crystal Clear action run.png
ePubExport

Release status: beta

px
Implementation Page action, Special page
Description Generate ebook file from a Wikmedia page or group of pages, in epub format
Author(s) nahshtalk
Latest version 0.5.4 (2010-05-16)
MediaWiki tested on 1.15.2
PHP 5.2.11
License GNU Lesser General Public License
Download https://sourceforge.net/projects/epubexport/
Example http://epubexport.sourceforge.net
Tags
epub, ebbok, e-book, e-reader, ereader
Hooks used
SkinTemplateBuildNavUrlsNav_urlsAfterPermalink

SkinTemplateToolboxEnd

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

Check usage and version matrix; code metrics

ePubExport is based on Pdf Export extension. ePubExport adds a new link to the left nav menu named "export ePub". Clicking this link generates an epub file to read offline in electronic book or tablet. In addition, a new special page is added, "ePub Export". This special page enable to create an epub file from group of Wikimedia pages.

The extension uses the epub PHP library. epub library uses the Zip PHP library both libraries are by by Asbjorn Grandt. Both are included in the ePubExport download.

Download[edit | edit source]

Download of the preferred archive file can be done from here. Currently there are tar.gz, bz2, rar and zip archives.

SVN is also available. Trunk is in https://epubexport.svn.sourceforge.net/svnroot/epubexport/trunk/ePubExport

Installation[edit | edit source]

To install this extension, extract the file in the extensions folder, then add the following to LocalSettings.php:

require_once("extensions/ePubExport/ePubExport.php");

Directory tree should be as follow:

extensions
      |
      +->ePubExport
                 |
                 +-->epub
                 |     |
                 |     +-> EPub.php
                 |     +-> EPubChapterSplitter.php
                 |     +-> Zip.php
                 |
                 +-->fonts
                 |     |
                 |     +-> LICENSE
                 |     +-> DejaVuSans.ttf
                 |     +-> DejaVuSans-Bold.ttf
                 |     +-> DejaVuSans-BoldOblique.ttf
                 |     +-> DejaVuSans-Oblique.ttf
                 |
                 +-> ePubExport.i18n.alias.php
                 +-> ePubExport.i18n.php
                 +-> ePubExport.php
                 +-> ePubExport_body.php

User-defined CSS file[edit | edit source]

Site administrator may change the default epub CSS to another file. In LocalSettings.php, just bellow the "require_once("$IP/extensions/ePubExport/ePubExport.php");" line, add $wgePubExportProperties['css_file'] = your_css_file_name.

For example:

require_once("$IP/extensions/ePubExport/ePubExport.php");
$wgePubExportProperties['css_file'] = $IP . "/ebook.css";

Embedding Fonts[edit | edit source]

For non-english wiki sites, as there is no way to know what will be the reading device, and if it has the font for the specific language or not, it is always a good idea to embed the fonts in the epub file. It does increase the size of the file, but it is readable.

ePubExport come with DejaVuSans fonts that support many languages. In order to embed these fonts in the epub file, the following configuration is required, because the font will not be embedded by default.

In LocalSettings.php, just below the "require_once("$IP/extensions/ePubExport/ePubExport.php");" line, add

$wgePubExportProperties['embed_fonts'] = true;
Fonts Supported Languages[edit | edit source]

The DejaVuSans fonts cover the following languages:

  Afar, Abkhazia, Afrikaans, Akan, Aragonese, Arabic, Asturian/Bable/Leonese/Asturleonese, Avaric, Aymara, 
  Azerbaijani in Azerbaijan, Azerbaijani in Iran, Bashkir, Byelorussian, Berber in Algeria,  Berber in Morocco, 
  Bulgarian, Bislama, Edo or Bini, Bambara, Breton, Bosnian, Buriat (Buryat), Catalan, Chechen, Chamorro, 
  Mari (Lower Cheremis / Upper Cheremis), Corsican, Crimean Tatar/Crimean Turkish, Czech, Kashubian, 
  Old Church Slavonic, Chuvash, Welsh, Danish, German, Ewe, Greek, English, Esperanto, Spanish, Estonian, Basque, 
  Persian, Fanti, Fulah (Fula), Finnish, Filipino, Fijian, Faroese, French, Friulian, Frisian, Irish, Scots Gaelic, 
  Galician, Guarani, Manx Gaelic, Hausa, Hawaiian, Hebrew, Hiri Motu, Croatian, Upper Sorbian, Haitian/Haitian Creole, 
  Hungarian, Armenian, Herero, Interlingua, Indonesian, Interlingue, Igbo, Inupiaq (Inupiak, Eskimo), Ido, Icelandic, 
  Italian, Inuktitut, Javanese, Georgian, Kara-Kalpak (Karakalpak), Kabyle, Kikuyu, Kuanyama/Kwanyama, Kazakh, Greenlandic, 
  Kanuri, Kurdish in Armenia, Kurdish in Iraq, Kurdish in Iran, Kurdish in Turkey, Kumyk, Komi (Komi-Permyak/Komi-Siryan), 
  Cornish, Kwambi, Kirgiz, Latin, Luxembourgish (Letzeburgesch), Lezghian (Lezgian), Ganda, Limburgan/Limburger/Limburgish, 
  Lingala, Lao, Lithuanian, Latvian, Malagasy, Marshallese, Maori, Macedonian, Mongolian in Mongolia, Moldavian, Malay, 
  Maltese, Nauru, Norwegian Bokmal, Low Saxon, Ndonga, Dutch, Norwegian Nynorsk, Norwegian (Bokmal), Ndebele, South, 
  Northern Sotho, Navajo/Navaho, Chichewa, Occitan, Oromo or Galla, Ossetic, Papiamento in Netherlands Antilles, 
  Papiamento in Aruba, Polish, Portuguese, Quechua, Rhaeto-Romance (Romansch), Rundi, Romanian, Russian, Kinyarwanda, Yakut, 
  Sardinian, Scots, North Sami, Selkup (Ostyak-Samoyed), Sango, Serbo-Croatian, Secwepemctsin, Slovak, Slovenian, Samoan, 
  South Sami, Lule Sami, Inari Sami, Skolt Sami, Shona, Somali, Albanian, Serbian, Swati, Sotho, Southern, Sundanese, Swedish, 
  Swahili, Tajik, Turkmen, Tagalog, Tswana, Tonga, Turkish, Tsonga, Tatar, Twi, Tahitian, Tuvinian, Uighur, Ukrainian, Uzbek, 
  Venda, Vietnamese, Volapuk, Votic, Walloon, Sorbian languages (lower and upper), Wolof, Xhosa, Yapese, Yiddish, Yoruba, 
  Zhuang/Chuang and Zulu

User-defined fonts[edit | edit source]

If the default fonts ars not fit or not support the wiki language, it is possible to embed another fonts. To do so, the $wgePubExportProperties['embed_fonts'] property must be set to true.

Then, specify the fonts source as follows:

$wgePubExportProperties['fonts'][] = _font_1_src_;
$wgePubExportProperties['fonts'][] = _font_2_src_;
$wgePubExportProperties['fonts'][] = _font_3_src_;

Font license is embedded as follows:

$wgePubExportProperties['font_license'] = _license_src_;

For example:

   require_once("extensions/ePubExport/ePubExport.php");
   $wgePubExportProperties['embed_fonts'] = true;
   $wgePubExportProperties['css_file'] = "$IP/ebook.css";
   $wgePubExportProperties['fonts'][] = 'extensions/ePubExport/fonts/DejaVuSans.ttf';
   $wgePubExportProperties['fonts'][] = 'extensions/ePubExport/fonts/DejaVuSans-Bold.ttf';
   $wgePubExportProperties['fonts'][] = 'extensions/ePubExport/fonts/DejaVuSans-BoldOblique.ttf';
   $wgePubExportProperties['fonts'][] = 'extensions/ePubExport/fonts/DejaVuSans-Oblique.ttf';
   $wgePubExportProperties['font_license'] = 'extensions/ePubExport/fonts/LICENSE';

NOTE: Using user-defined font require user-defined CSS. ePubExport does not enforce that, but it won't work without CSS that defines and use the user-defined fonts.

Supported Languages[edit | edit source]

Full Support[edit | edit source]

These languages are used both in the Mediawiki text and menus as well as in the epub file itself.

  • English
  • Hebrew
  • Russian
  • Dutch
  • French
  • German
  • Italian
  • Portuguese

Partial Support[edit | edit source]

These languages are used both in the Mediawiki text and menus as well as in the epub file itself. However, there are still several texts here and there that are not yet updated.

  • Polish

Will Maybe Work[edit | edit source]

All the languages listed in the Fonts Supported Languages section have no support in Mediawiki text and menus, but the epub file will probably created successfully.

Screenshots[edit | edit source]

New menu item "Export as ePub"[edit | edit source]

Export as ePub.jpg

"ePub Export" Special Page[edit | edit source]

EPubExport SpecialPage.jpg

See also[edit | edit source]