diff --git a/README.md b/README.md
index ee1b0ae..e70b13a 100644
--- a/README.md
+++ b/README.md
@@ -2,8 +2,8 @@
**Penelope** is a multi-tool for creating, editing and converting dictionaries, especially for eReader devices.
-* Version: 3.0.1
-* Date: 2015-11-22
+* Version: 3.1.0
+* Date: 2015-11-29
* Developer: [Alberto Pettarin](http://www.albertopettarin.it/)
* License: the MIT License (MIT)
* Contact: [click here](http://www.albertopettarin.it/contact.html)
@@ -78,7 +78,7 @@ You might need to install `dictzip` (StarDict output) and `kindlegen` (MOBI out
$ python -m penelope
```
-This procedure will not any dependencies, see below.
+This procedure will not install any dependencies: you will need to do that manually, see below.
### Dependencies
@@ -97,9 +97,9 @@ This procedure will not any dependencies, see below.
$ [sudo] pip install marisa-trie
```
- or [`MARISA`](https://code.google.com/p/marisa-trie/) executables available in your `$PATH` or specified with `--marisa-bin-path`
+ or [MARISA](https://code.google.com/p/marisa-trie/) executables available in your `$PATH` or specified with `--marisa-bin-path`
-* to write MOBI Kindle dictionaries: the [`kindlegen`](https://www.amazon.com/gp/feature.html?docId=1000765211) executable, available in your `$PATH` or specified with `--kindlegen-path`
+* to write MOBI Kindle dictionaries: the [kindlegen](https://www.amazon.com/gp/feature.html?docId=1000765211) executable, available in your `$PATH` or specified with `--kindlegen-path`
* to read/write XML dictionaries: the Python module `lxml`:
@@ -154,6 +154,8 @@ optional arguments:
--title TITLE title string
--website WEBSITE website string
--year YEAR year string
+ --apply-css APPLY_CSS
+ apply the given CSS file (epub and mobi output only)
--bookeen-collation-function BOOKEEN_COLLATION_FUNCTION
use the specified collation function
--bookeen-install-file
@@ -165,29 +167,36 @@ optional arguments:
--csv-ls CSV_LS CSV line separator (default: '\n')
--dictzip-path DICTZIP_PATH
path to dictzip executable
- --epub-escape-strings
- escape HTML strings (default: False)
- --epub-group-prefix-length EPUB_GROUP_PREFIX_LENGTH
- group headwords by prefix of given length (default: 3)
- --epub-merge-group-size EPUB_MERGE_GROUP_SIZE
- merge headword groups with less than this number of
- headwords (default: 128)
- --epub-output-definitions
- output definitions in addition to the headwords
- (default: False)
+ --epub-no-compress do not create the compressed container (epub output
+ only, default: False)
+ --escape-strings escape HTML strings (default: False)
--flatten-synonyms flatten synonyms, creating a new entry with
headword=synonym and using the definition of the
original headword (default: False)
+ --group-by-prefix-function GROUP_BY_PREFIX_FUNCTION
+ compute the prefix of headwords using the given prefix
+ function file
+ --group-by-prefix-length GROUP_BY_PREFIX_LENGTH
+ group headwords by prefix of given length (default: 2)
+ --group-by-prefix-merge-across-first
+ merge headword groups even when the first character
+ changes (default: False)
+ --group-by-prefix-merge-min-size GROUP_BY_PREFIX_MERGE_MIN_SIZE
+ merge headword groups until the given minimum number
+ of headwords is reached (default: 0, meaning no merge
+ will take place)
+ --ignore-case ignore headword case, all headwords will be lowercased
+ (default: False)
+ --ignore-synonyms ignore synonyms, not reading/writing them if present
+ (default: False)
+ --include-index-page include an index page (epub and mobi output only,
+ default: False)
--input-file-encoding INPUT_FILE_ENCODING
use the specified encoding for reading the raw
contents of input file(s) (default: 'utf-8')
--input-parser INPUT_PARSER
use the specified parser function after reading the
raw contents of input file(s)
- --ignore-case ignore headword case, all headwords will be lowercased
- (default: False)
- --ignore-synonyms ignore synonyms, not reading/writing them if present
- (default: False)
--kindlegen-path KINDLEGEN_PATH
path to kindlegen executable
--marisa-bin-path MARISA_BIN_PATH
@@ -201,6 +210,8 @@ optional arguments:
| ')
--mobi-no-kindlegen do not run kindlegen, keep .opf and .html files
(default: False)
+ --no-definitions do not output definitions for EPUB and MOBI formats
+ (default: False)
--sd-ignore-sametypesequence
ignore the value of sametypesequence in StarDict .ifo
files (default: False)
@@ -253,7 +264,6 @@ examples:
$ penelope -i dict.xml -j xml -f en -t it -p mobi -o output.epub --epub-output-definitions
As above, but also output definitions
-
```
You can find ISO 639-1 language codes [here](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes).
@@ -338,6 +348,8 @@ were released under the GNU GPL 3 License.
* Reading EPUB (3) dictionaries is not supported; the writing part needs polishing/refactoring
* Reading PRC/MOBI (Kindle) dictionaries is not supported
* There are some limitations on StarDict files that can be read (see comments in `format_stardict.py`)
+* Documentation is not complete
+* Unit tests are missing
## Acknowledgments
diff --git a/README.rst b/README.rst
index 1217bb5..0e733d7 100644
--- a/README.rst
+++ b/README.rst
@@ -4,8 +4,8 @@ Penelope
**Penelope** is a multi-tool for creating, editing and converting
dictionaries, especially for eReader devices.
-- Version: 3.0.1
-- Date: 2015-11-22
+- Version: 3.1.0
+- Date: 2015-11-29
- Developer: `Alberto Pettarin `__
- License: the MIT License (MIT)
- Contact: `click here `__
@@ -96,7 +96,8 @@ From source code
$ python -m penelope
-This procedure will not any dependencies, see below.
+This procedure will not install any dependencies: you will need to do
+that manually, see below.
Dependencies
~~~~~~~~~~~~
@@ -116,11 +117,11 @@ Dependencies
$ [sudo] pip install marisa-trie
-or ```MARISA`` `__ executables
+or `MARISA `__ executables
available in your ``$PATH`` or specified with ``--marisa-bin-path``
- to write MOBI Kindle dictionaries: the
- ```kindlegen`` `__
+ `kindlegen `__
executable, available in your ``$PATH`` or specified with
``--kindlegen-path``
@@ -178,6 +179,8 @@ Usage
--title TITLE title string
--website WEBSITE website string
--year YEAR year string
+ --apply-css APPLY_CSS
+ apply the given CSS file (epub and mobi output only)
--bookeen-collation-function BOOKEEN_COLLATION_FUNCTION
use the specified collation function
--bookeen-install-file
@@ -189,29 +192,36 @@ Usage
--csv-ls CSV_LS CSV line separator (default: '\n')
--dictzip-path DICTZIP_PATH
path to dictzip executable
- --epub-escape-strings
- escape HTML strings (default: False)
- --epub-group-prefix-length EPUB_GROUP_PREFIX_LENGTH
- group headwords by prefix of given length (default: 3)
- --epub-merge-group-size EPUB_MERGE_GROUP_SIZE
- merge headword groups with less than this number of
- headwords (default: 128)
- --epub-output-definitions
- output definitions in addition to the headwords
- (default: False)
+ --epub-no-compress do not create the compressed container (epub output
+ only, default: False)
+ --escape-strings escape HTML strings (default: False)
--flatten-synonyms flatten synonyms, creating a new entry with
headword=synonym and using the definition of the
original headword (default: False)
+ --group-by-prefix-function GROUP_BY_PREFIX_FUNCTION
+ compute the prefix of headwords using the given prefix
+ function file
+ --group-by-prefix-length GROUP_BY_PREFIX_LENGTH
+ group headwords by prefix of given length (default: 2)
+ --group-by-prefix-merge-across-first
+ merge headword groups even when the first character
+ changes (default: False)
+ --group-by-prefix-merge-min-size GROUP_BY_PREFIX_MERGE_MIN_SIZE
+ merge headword groups until the given minimum number
+ of headwords is reached (default: 0, meaning no merge
+ will take place)
+ --ignore-case ignore headword case, all headwords will be lowercased
+ (default: False)
+ --ignore-synonyms ignore synonyms, not reading/writing them if present
+ (default: False)
+ --include-index-page include an index page (epub and mobi output only,
+ default: False)
--input-file-encoding INPUT_FILE_ENCODING
use the specified encoding for reading the raw
contents of input file(s) (default: 'utf-8')
--input-parser INPUT_PARSER
use the specified parser function after reading the
raw contents of input file(s)
- --ignore-case ignore headword case, all headwords will be lowercased
- (default: False)
- --ignore-synonyms ignore synonyms, not reading/writing them if present
- (default: False)
--kindlegen-path KINDLEGEN_PATH
path to kindlegen executable
--marisa-bin-path MARISA_BIN_PATH
@@ -225,6 +235,8 @@ Usage
| ')
--mobi-no-kindlegen do not run kindlegen, keep .opf and .html files
(default: False)
+ --no-definitions do not output definitions for EPUB and MOBI formats
+ (default: False)
--sd-ignore-sametypesequence
ignore the value of sametypesequence in StarDict .ifo
files (default: False)
@@ -277,7 +289,6 @@ Usage
$ penelope -i dict.xml -j xml -f en -t it -p mobi -o output.epub --epub-output-definitions
As above, but also output definitions
-
You can find ISO 639-1 language codes
`here `__.
@@ -384,6 +395,8 @@ Limitations and Missing Features
- Reading PRC/MOBI (Kindle) dictionaries is not supported
- There are some limitations on StarDict files that can be read (see
comments in ``format_stardict.py``)
+- Documentation is not complete
+- Unit tests are missing
Acknowledgments
---------------
diff --git a/VERSION b/VERSION
index cb2b00e..fd2a018 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.0.1
+3.1.0
diff --git a/bin/penelope b/bin/penelope
index b810d23..7421518 100755
--- a/bin/penelope
+++ b/bin/penelope
@@ -14,7 +14,7 @@ from penelope import main as package_main
__author__ = "Alberto Pettarin"
__copyright__ = "Copyright 2012-2015, Alberto Pettarin (www.albertopettarin.it)"
__license__ = "MIT"
-__version__ = "3.0.1"
+__version__ = "3.1.0"
__email__ = "alberto@albertopettarin.it"
__status__ = "Production"
diff --git a/penelope/__init__.py b/penelope/__init__.py
index e54bbe4..d4a9326 100644
--- a/penelope/__init__.py
+++ b/penelope/__init__.py
@@ -32,7 +32,7 @@
__author__ = "Alberto Pettarin"
__copyright__ = "Copyright 2012-2015, Alberto Pettarin (www.albertopettarin.it)"
__license__ = "MIT"
-__version__ = "3.0.1"
+__version__ = "3.1.0"
__email__ = "alberto@albertopettarin.it"
__status__ = "Production"
diff --git a/penelope/__main__.py b/penelope/__main__.py
index bbda8b9..596e443 100644
--- a/penelope/__main__.py
+++ b/penelope/__main__.py
@@ -31,7 +31,7 @@
__author__ = "Alberto Pettarin"
__copyright__ = "Copyright 2012-2015, Alberto Pettarin (www.albertopettarin.it)"
__license__ = "MIT"
-__version__ = "3.0.1"
+__version__ = "3.1.0"
__email__ = "alberto@albertopettarin.it"
__status__ = "Production"
diff --git a/penelope/collation_default.py b/penelope/collation_default.py
index a5d7059..ae4b587 100644
--- a/penelope/collation_default.py
+++ b/penelope/collation_default.py
@@ -2,19 +2,21 @@
# -*- coding: utf-8 -*-
"""
-This is the default collation function (IcuNoCase) for bookeen output format.
+This is the default collation function (IcuNoCase).
"""
__author__ = "Alberto Pettarin"
__copyright__ = "Copyright 2012-2015, Alberto Pettarin (www.albertopettarin.it)"
__license__ = "MIT"
-__version__ = "3.0.1"
+__version__ = "3.1.0"
__email__ = "alberto@albertopettarin.it"
__status__ = "Production"
def collate_function(string1, string2):
"""
- Implement IcuNoCase collation.
+ Implement default IcuNoCase collation,
+ by simply lowercasing the UTF-8 encoded versions
+ of the two strings.
:param string1: first string
:type string1: unicode
diff --git a/penelope/collation_german.py b/penelope/collation_german.py
index 3c5e2c5..d647f7b 100644
--- a/penelope/collation_german.py
+++ b/penelope/collation_german.py
@@ -2,19 +2,27 @@
# -*- coding: utf-8 -*-
"""
-This is a sample collation function (IcuNoCase) for German.
+This is a collation function (IcuNoCase) for German.
"""
__author__ = "Alberto Pettarin"
__copyright__ = "Copyright 2012-2015, Alberto Pettarin (www.albertopettarin.it)"
__license__ = "MIT"
-__version__ = "3.0.1"
+__version__ = "3.1.0"
__email__ = "alberto@albertopettarin.it"
__status__ = "Production"
+REPLACEMENTS = [
+ [u"ä", u"a"],
+ [u"ö", u"o"],
+ [u"ü", u"u"],
+ [u"ß", u"ss"]
+]
+
def collate_function(string1, string2):
"""
Implement IcuNoCase collation for German.
+ (I do not remember where the procedure comes from.)
:param string1: first string
:type string1: unicode
@@ -26,10 +34,9 @@ def collate_function(string1, string2):
b2 = string2.lower()
c1 = b1
c2 = b2
- for f in [[u"ä", u"a"], [u"ö", u"o"], [u"ü", u"u"], [u"ß", u"ss"]]:
- b1 = b1.replace(f[0], f[1])
- b2 = b2.replace(f[0], f[1])
-
+ for repl in REPLACEMENTS:
+ b1 = b1.replace(repl[0], repl[1])
+ b2 = b2.replace(repl[0], repl[1])
if b1.encode("utf-16") == b2.encode("utf-16"):
if c1.encode("utf-16") == c2.encode("utf-16"):
return 0
diff --git a/penelope/command_line.py b/penelope/command_line.py
index 6e46d47..f2fa6f6 100644
--- a/penelope/command_line.py
+++ b/penelope/command_line.py
@@ -15,7 +15,7 @@
__author__ = "Alberto Pettarin"
__copyright__ = "Copyright 2012-2015, Alberto Pettarin (www.albertopettarin.it)"
__license__ = "MIT"
-__version__ = "3.0.1"
+__version__ = "3.1.0"
__email__ = "alberto@albertopettarin.it"
__status__ = "Production"
@@ -154,6 +154,12 @@
"action": "store"
},
+ {
+ "short": None,
+ "long": "--apply-css",
+ "help": "apply the given CSS file (epub and mobi output only)",
+ "action": "store"
+ },
{
"short": None,
"long": "--bookeen-collation-function",
@@ -192,44 +198,44 @@
},
{
"short": None,
- "long": "--epub-escape-strings",
- "help": "escape HTML strings (default: False)",
+ "long": "--epub-no-compress",
+ "help": "do not create the compressed container (epub output only, default: False)",
"action": "store_true"
},
{
"short": None,
- "long": "--epub-group-prefix-length",
- "help": "group headwords by prefix of given length (default: 3)",
- "action": "store"
+ "long": "--escape-strings",
+ "help": "escape HTML strings (default: False)",
+ "action": "store_true"
},
{
"short": None,
- "long": "--epub-merge-group-size",
- "help": "merge headword groups with less than this number of headwords (default: 128)",
- "action": "store"
+ "long": "--flatten-synonyms",
+ "help": "flatten synonyms, creating a new entry with headword=synonym and using the definition of the original headword (default: False)",
+ "action": "store_true"
},
{
"short": None,
- "long": "--epub-output-definitions",
- "help": "output definitions in addition to the headwords (default: False)",
- "action": "store_true"
+ "long": "--group-by-prefix-function",
+ "help": "compute the prefix of headwords using the given prefix function file",
+ "action": "store"
},
{
"short": None,
- "long": "--flatten-synonyms",
- "help": "flatten synonyms, creating a new entry with headword=synonym and using the definition of the original headword (default: False)",
- "action": "store_true"
+ "long": "--group-by-prefix-length",
+ "help": "group headwords by prefix of given length (default: 2)",
+ "action": "store"
},
{
"short": None,
- "long": "--input-file-encoding",
- "help": "use the specified encoding for reading the raw contents of input file(s) (default: 'utf-8')",
- "action": "store"
+ "long": "--group-by-prefix-merge-across-first",
+ "help": "merge headword groups even when the first character changes (default: False)",
+ "action": "store_true"
},
{
"short": None,
- "long": "--input-parser",
- "help": "use the specified parser function after reading the raw contents of input file(s)",
+ "long": "--group-by-prefix-merge-min-size",
+ "help": "merge headword groups until the given minimum number of headwords is reached (default: 0, meaning no merge will take place)",
"action": "store"
},
{
@@ -244,6 +250,24 @@
"help": "ignore synonyms, not reading/writing them if present (default: False)",
"action": "store_true"
},
+ {
+ "short": None,
+ "long": "--include-index-page",
+ "help": "include an index page (epub and mobi output only, default: False)",
+ "action": "store_true"
+ },
+ {
+ "short": None,
+ "long": "--input-file-encoding",
+ "help": "use the specified encoding for reading the raw contents of input file(s) (default: 'utf-8')",
+ "action": "store"
+ },
+ {
+ "short": None,
+ "long": "--input-parser",
+ "help": "use the specified parser function after reading the raw contents of input file(s)",
+ "action": "store"
+ },
{
"short": None,
"long": "--kindlegen-path",
@@ -280,6 +304,12 @@
"help": "do not run kindlegen, keep .opf and .html files (default: False)",
"action": "store_true"
},
+ {
+ "short": None,
+ "long": "--no-definitions",
+ "help": "do not output definitions for EPUB and MOBI formats (default: False)",
+ "action": "store_true"
+ },
{
"short": None,
"long": "--sd-ignore-sametypesequence",
@@ -442,6 +472,7 @@ def set_default_values(args):
def set_default_value(key, value):
if not args.__contains__(key):
args.__dict__[key] = value
+ set_default_value("apply_css", None)
set_default_value("bookeen_collation_function", None)
set_default_value("bookeen_install_file", False)
set_default_value("csv_fs", ",")
@@ -449,13 +480,16 @@ def set_default_value(key, value):
set_default_value("csv_ls", "\n")
set_default_value("debug", False)
set_default_value("dictzip_path", None)
- set_default_value("epub_escape_strings", False)
- set_default_value("epub_group_prefix_length", 3)
- set_default_value("epub_merge_group_size", 100)
- set_default_value("epub_output_definitions", False)
+ set_default_value("epub_no_compress", False)
+ set_default_value("escape_strings", False)
set_default_value("flatten_synonyms", False)
+ set_default_value("group_by_prefix_length", 2)
+ set_default_value("group_by_prefix_function", None)
+ set_default_value("group_by_prefix_merge_across_first", False)
+ set_default_value("group_by_prefix_merge_min_size", 0)
set_default_value("ignore_case", False)
set_default_value("ignore_synonyms", False)
+ set_default_value("include_index_page", False)
set_default_value("input_file_encoding", "utf-8")
set_default_value("input_parser", None)
set_default_value("keep", False)
@@ -465,6 +499,7 @@ def set_default_value(key, value):
set_default_value("merge_definitions", False)
set_default_value("merge_separator", " | ")
set_default_value("mobi_no_kindlegen", False)
+ set_default_value("no_definitions", False)
set_default_value("sd_ignore_sametypesequence", False)
set_default_value("sd_no_dictzip", False)
set_default_value("sort_after", False)
diff --git a/penelope/dictionary.py b/penelope/dictionary.py
index 81c9320..386e9da 100644
--- a/penelope/dictionary.py
+++ b/penelope/dictionary.py
@@ -16,15 +16,17 @@
from __future__ import absolute_import
from io import open
+import imp
import os
+from penelope.prefix_default import get_prefix as get_prefix_default
from penelope.utilities import get_uuid
from penelope.utilities import print_error
__author__ = "Alberto Pettarin"
__copyright__ = "Copyright 2012-2015, Alberto Pettarin (www.albertopettarin.it)"
__license__ = "MIT"
-__version__ = "3.0.1"
+__version__ = "3.1.0"
__email__ = "alberto@albertopettarin.it"
__status__ = "Production"
@@ -425,5 +427,95 @@ def default_merge_function(headword, definitions):
# not needed, since we called self.clear()
#self.sort(False, False, False, False)
+ def group(
+ self,
+ prefix_function=None,
+ prefix_function_path=None,
+ prefix_length=2,
+ merge_min_size=0,
+ merge_across_first=False
+ ):
+ """
+ Group headwords by prefix, returning a dictionary containing
+ the prefixes as keys (possibly, with a "SPECIAL" key) and
+ the dictionary entries as elements of the list associated with a key.
+
+ :param prefix_function_path: the path to a source file containing
+ a get_prefix function, mapping a headword
+ and the prefix_length to the prefix;
+ if None, a default function will be used
+ :type prefix_function_path: path
+ :param prefix_function: the function, mapping a headword
+ and the prefix_length to the prefix;
+ if None, a default function will be used
+ :type prefix_function: function
+ :param prefix_length: the lenght of the prefixes
+ :type prefix_length: int
+ :param merge_min_size: merge headword groups until the given minimum
+ number of headwords is reached; if 0, does not merge
+ :type merge_min_size: int
+ :param merge_across_first: if True, merge groups even when
+ the first character changes
+ :type merge_across_first: False
+ :rtype: (list, list, dict)
+ """
+ def return_triple(groups):
+ """
+ Return a (list_special, list, dict),
+ where the list contains the sorted keys of dict,
+ and list_special contains the list of SPECIAL entries.
+ """
+ spec = None
+ if u"SPECIAL" in groups:
+ spec = groups[u"SPECIAL"]
+ del groups[u"SPECIAL"]
+ keys = sorted(groups.keys())
+ return (spec, keys, groups)
+
+ # load the prefix function
+ get_prefix = get_prefix_default
+ if prefix_function is not None:
+ get_prefix = prefix_function
+ elif prefix_function_path is not None:
+ try:
+ get_prefix = imp.load_source("", prefix_function).get_prefix
+ except:
+ pass
+
+ # create groups
+ raw_groups = {}
+ for index in self.entries_index_sorted:
+ entry = self.entries[index]
+ prefix = get_prefix(entry.headword, prefix_length)
+ if not prefix in raw_groups:
+ raw_groups[prefix] = []
+ raw_groups[prefix].append(self.entries[index])
+
+ # if no merge is requested, return
+ if merge_min_size == 0:
+ return return_triple(raw_groups)
+
+ # merge small groups
+ merged_groups = {}
+ if u"SPECIAL" in raw_groups:
+ # special is never merged
+ merged_groups[u"SPECIAL"] = raw_groups[u"SPECIAL"]
+ del raw_groups[u"SPECIAL"]
+ keys = sorted(raw_groups.keys())
+ accumulator_key = keys[0]
+ accumulator = raw_groups[accumulator_key]
+ for key in keys[1:]:
+ if (
+ (len(accumulator) >= merge_min_size) or
+ ((not merge_across_first) and (key[0] != accumulator_key[0]))
+ ):
+ merged_groups[accumulator_key] = accumulator
+ accumulator_key = key
+ accumulator = raw_groups[accumulator_key]
+ else:
+ accumulator += raw_groups[key]
+ merged_groups[accumulator_key] = accumulator
+ return return_triple(merged_groups)
+
diff --git a/penelope/dictionary_ebook.py b/penelope/dictionary_ebook.py
new file mode 100644
index 0000000..8c9ca3a
--- /dev/null
+++ b/penelope/dictionary_ebook.py
@@ -0,0 +1,523 @@
+#!/usr/bin/env python
+# coding=utf-8
+
+"""
+DictionaryEbook represents a dictionary ebook
+in EPUB 2 and MOBI format.
+"""
+
+from __future__ import absolute_import
+from __future__ import print_function
+from io import open
+import os
+import zipfile
+
+from penelope.utilities import create_temp_directory
+from penelope.utilities import delete_directory
+
+__author__ = "Alberto Pettarin"
+__copyright__ = "Copyright 2012-2015, Alberto Pettarin (www.albertopettarin.it)"
+__license__ = "MIT"
+__version__ = "3.1.0"
+__email__ = "alberto@albertopettarin.it"
+__status__ = "Production"
+
+class DictionaryEbook():
+ """
+ A class representing a generic ebook containing a dictionary.
+
+ It can be used to output a MOBI or an EPUB 2 container.
+
+ The ebook must have an OPF, and one or more group XHTML files.
+
+ Optionally, it can have a cover image, an NCX TOC, an index XHTML file.
+
+ The actual file templates are provided by the caller.
+ """
+
+ EPUB2 = u"epub2"
+
+ #EPUB3 = u"epub3"
+
+ MOBI = u"mobi"
+
+ GROUP_START_INDEX = 2
+
+ MIMETYPE_CONTENTS = u"application/epub+zip"
+
+ CONTAINER_XML_CONTENTS = u"""
+
+
+
+
+"""
+
+ EPUB_CSS_CONTENTS = u"""@charset "UTF-8";
+body {
+ margin: 10px 25px 10px 25px;
+}
+h1 {
+ font-size: 200%;
+}
+h2 {
+ font-size: 150%;
+}
+p {
+ margin-left: 0em;
+ margin-right: 0em;
+ margin-top: 0em;
+ margin-bottom: 0em;
+ line-height: 2em;
+ text-align: justify;
+}
+a, a:focus, a:active, a:visited {
+ color: black;
+ text-decoration: none;
+}
+body.indexPage {}
+h1.indexTitle {}
+p.indexGroups {
+ font-size: 150%;
+}
+span.indexGroup {}
+body.groupPage {}
+h1.groupTitle {}
+div.groupNavigation {}
+span.groupHeadword {}
+div.groupEntry {
+ margin-top: 0;
+ margin-bottom: 1em;
+}
+h2.groupHeadword {
+ margin-left: 5%;
+}
+p.groupDefinition {
+ margin-left: 10%;
+ margin-right: 10%;
+}
+"""
+
+ MOBI_CSS_CONTENTS = u""""@charset "UTF-8";"""
+
+ INDEX_XHTML_TEMPLATE = u"""
+
+
+
+ %s
+
+
+
+