ebook-convert 4.13.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ebook_convert/__init__.py +6 -0
- ebook_convert/constants.py +59 -0
- ebook_convert/constants_old.py +109 -0
- ebook_convert/css_selectors/__init__.py +8 -0
- ebook_convert/css_selectors/errors.py +17 -0
- ebook_convert/css_selectors/ordered_set.py +129 -0
- ebook_convert/css_selectors/parser.py +790 -0
- ebook_convert/css_selectors/select.py +689 -0
- ebook_convert/css_selectors/tests.py +841 -0
- ebook_convert/customize/__init__.py +663 -0
- ebook_convert/customize/builtins.py +1110 -0
- ebook_convert/customize/conversion.py +320 -0
- ebook_convert/customize/profiles.py +878 -0
- ebook_convert/customize/ui.py +528 -0
- ebook_convert/data/default_tweaks.py +563 -0
- ebook_convert/data/fb2.xsl +448 -0
- ebook_convert/data/html.css +404 -0
- ebook_convert/data/iso_639-3.json +48688 -0
- ebook_convert/data/jacket/stylesheet.css +149 -0
- ebook_convert/data/jacket/template.xhtml +58 -0
- ebook_convert/data/lrf.xsl +210 -0
- ebook_convert/data/mime.types +1390 -0
- ebook_convert/data/new_nav.html +9 -0
- ebook_convert/data/rtf.xsl +491 -0
- ebook_convert/devices/__init__.py +0 -0
- ebook_convert/devices/interface.py +764 -0
- ebook_convert/ebooks/BeautifulSoup.py +32 -0
- ebook_convert/ebooks/__init__.py +256 -0
- ebook_convert/ebooks/chardet.py +183 -0
- ebook_convert/ebooks/compression/__init__.py +0 -0
- ebook_convert/ebooks/compression/palmdoc.py +91 -0
- ebook_convert/ebooks/conversion/__init__.py +0 -0
- ebook_convert/ebooks/conversion/cli.py +404 -0
- ebook_convert/ebooks/conversion/plugins/__init__.py +0 -0
- ebook_convert/ebooks/conversion/plugins/azw4_input.py +28 -0
- ebook_convert/ebooks/conversion/plugins/chm_input.py +202 -0
- ebook_convert/ebooks/conversion/plugins/comic_input.py +304 -0
- ebook_convert/ebooks/conversion/plugins/djvu_input.py +63 -0
- ebook_convert/ebooks/conversion/plugins/docx_input.py +33 -0
- ebook_convert/ebooks/conversion/plugins/docx_output.py +86 -0
- ebook_convert/ebooks/conversion/plugins/epub_input.py +464 -0
- ebook_convert/ebooks/conversion/plugins/epub_output.py +544 -0
- ebook_convert/ebooks/conversion/plugins/fb2_input.py +186 -0
- ebook_convert/ebooks/conversion/plugins/fb2_output.py +197 -0
- ebook_convert/ebooks/conversion/plugins/html_input.py +292 -0
- ebook_convert/ebooks/conversion/plugins/html_output.py +230 -0
- ebook_convert/ebooks/conversion/plugins/htmlz_input.py +126 -0
- ebook_convert/ebooks/conversion/plugins/htmlz_output.py +125 -0
- ebook_convert/ebooks/conversion/plugins/lit_input.py +62 -0
- ebook_convert/ebooks/conversion/plugins/lit_output.py +38 -0
- ebook_convert/ebooks/conversion/plugins/lrf_input.py +81 -0
- ebook_convert/ebooks/conversion/plugins/lrf_output.py +193 -0
- ebook_convert/ebooks/conversion/plugins/mobi_input.py +59 -0
- ebook_convert/ebooks/conversion/plugins/mobi_output.py +330 -0
- ebook_convert/ebooks/conversion/plugins/odt_input.py +23 -0
- ebook_convert/ebooks/conversion/plugins/oeb_output.py +121 -0
- ebook_convert/ebooks/conversion/plugins/pdb_input.py +34 -0
- ebook_convert/ebooks/conversion/plugins/pdb_output.py +63 -0
- ebook_convert/ebooks/conversion/plugins/pdf_input.py +75 -0
- ebook_convert/ebooks/conversion/plugins/pdf_output.py +249 -0
- ebook_convert/ebooks/conversion/plugins/pml_input.py +157 -0
- ebook_convert/ebooks/conversion/plugins/pml_output.py +74 -0
- ebook_convert/ebooks/conversion/plugins/rb_input.py +26 -0
- ebook_convert/ebooks/conversion/plugins/rb_output.py +43 -0
- ebook_convert/ebooks/conversion/plugins/recipe_input.py +160 -0
- ebook_convert/ebooks/conversion/plugins/rtf_input.py +333 -0
- ebook_convert/ebooks/conversion/plugins/rtf_output.py +38 -0
- ebook_convert/ebooks/conversion/plugins/snb_input.py +129 -0
- ebook_convert/ebooks/conversion/plugins/snb_output.py +268 -0
- ebook_convert/ebooks/conversion/plugins/tcr_input.py +38 -0
- ebook_convert/ebooks/conversion/plugins/tcr_output.py +54 -0
- ebook_convert/ebooks/conversion/plugins/txt_input.py +320 -0
- ebook_convert/ebooks/conversion/plugins/txt_output.py +167 -0
- ebook_convert/ebooks/conversion/plumber.py +1257 -0
- ebook_convert/ebooks/conversion/preprocess.py +687 -0
- ebook_convert/ebooks/conversion/utils.py +880 -0
- ebook_convert/ebooks/covers.py +93 -0
- ebook_convert/ebooks/docx/__init__.py +6 -0
- ebook_convert/ebooks/docx/block_styles.py +474 -0
- ebook_convert/ebooks/docx/char_styles.py +299 -0
- ebook_convert/ebooks/docx/cleanup.py +231 -0
- ebook_convert/ebooks/docx/container.py +283 -0
- ebook_convert/ebooks/docx/dump.py +39 -0
- ebook_convert/ebooks/docx/fields.py +270 -0
- ebook_convert/ebooks/docx/fonts.py +193 -0
- ebook_convert/ebooks/docx/footnotes.py +61 -0
- ebook_convert/ebooks/docx/images.py +336 -0
- ebook_convert/ebooks/docx/index.py +269 -0
- ebook_convert/ebooks/docx/names.py +140 -0
- ebook_convert/ebooks/docx/numbering.py +384 -0
- ebook_convert/ebooks/docx/settings.py +17 -0
- ebook_convert/ebooks/docx/styles.py +500 -0
- ebook_convert/ebooks/docx/tables.py +696 -0
- ebook_convert/ebooks/docx/theme.py +25 -0
- ebook_convert/ebooks/docx/to_html.py +891 -0
- ebook_convert/ebooks/docx/toc.py +136 -0
- ebook_convert/ebooks/docx/writer/__init__.py +0 -0
- ebook_convert/ebooks/docx/writer/container.py +308 -0
- ebook_convert/ebooks/docx/writer/fonts.py +74 -0
- ebook_convert/ebooks/docx/writer/from_html.py +617 -0
- ebook_convert/ebooks/docx/writer/images.py +216 -0
- ebook_convert/ebooks/docx/writer/links.py +169 -0
- ebook_convert/ebooks/docx/writer/lists.py +164 -0
- ebook_convert/ebooks/docx/writer/styles.py +762 -0
- ebook_convert/ebooks/docx/writer/tables.py +367 -0
- ebook_convert/ebooks/docx/writer/utils.py +55 -0
- ebook_convert/ebooks/epub/__init__.py +48 -0
- ebook_convert/ebooks/fb2/__init__.py +44 -0
- ebook_convert/ebooks/fb2/fb2ml.py +623 -0
- ebook_convert/ebooks/html/__init__.py +0 -0
- ebook_convert/ebooks/html/input.py +253 -0
- ebook_convert/ebooks/html/to_zip.py +119 -0
- ebook_convert/ebooks/html_entities.py +2147 -0
- ebook_convert/ebooks/htmlz/__init__.py +0 -0
- ebook_convert/ebooks/htmlz/oeb2html.py +453 -0
- ebook_convert/ebooks/lrf/__init__.py +109 -0
- ebook_convert/ebooks/lrf/fonts.py +41 -0
- ebook_convert/ebooks/lrf/html/__init__.py +0 -0
- ebook_convert/ebooks/lrf/html/color_map.py +114 -0
- ebook_convert/ebooks/lrf/html/convert_from.py +2121 -0
- ebook_convert/ebooks/lrf/html/table.py +381 -0
- ebook_convert/ebooks/lrf/input.py +396 -0
- ebook_convert/ebooks/lrf/lrfparser.py +168 -0
- ebook_convert/ebooks/lrf/meta.py +766 -0
- ebook_convert/ebooks/lrf/objects.py +1281 -0
- ebook_convert/ebooks/lrf/pylrs/__init__.py +0 -0
- ebook_convert/ebooks/lrf/pylrs/elements.py +76 -0
- ebook_convert/ebooks/lrf/pylrs/pylrf.py +769 -0
- ebook_convert/ebooks/lrf/pylrs/pylrfopt.py +41 -0
- ebook_convert/ebooks/lrf/pylrs/pylrs.py +2442 -0
- ebook_convert/ebooks/lrf/tags.py +255 -0
- ebook_convert/ebooks/metadata/__init__.py +429 -0
- ebook_convert/ebooks/metadata/archive.py +200 -0
- ebook_convert/ebooks/metadata/book/__init__.py +122 -0
- ebook_convert/ebooks/metadata/book/base.py +831 -0
- ebook_convert/ebooks/metadata/book/formatter.py +43 -0
- ebook_convert/ebooks/metadata/book/json_codec.py +64 -0
- ebook_convert/ebooks/metadata/fb2.py +464 -0
- ebook_convert/ebooks/metadata/html.py +409 -0
- ebook_convert/ebooks/metadata/meta.py +240 -0
- ebook_convert/ebooks/metadata/odt.py +297 -0
- ebook_convert/ebooks/metadata/opf2.py +1905 -0
- ebook_convert/ebooks/metadata/opf3.py +1186 -0
- ebook_convert/ebooks/metadata/pdf.py +163 -0
- ebook_convert/ebooks/metadata/rtf.py +247 -0
- ebook_convert/ebooks/metadata/toc.py +302 -0
- ebook_convert/ebooks/metadata/txt.py +38 -0
- ebook_convert/ebooks/metadata/utils.py +103 -0
- ebook_convert/ebooks/metadata/xmp.py +690 -0
- ebook_convert/ebooks/mobi/__init__.py +12 -0
- ebook_convert/ebooks/mobi/huffcdic.py +103 -0
- ebook_convert/ebooks/mobi/langcodes.py +353 -0
- ebook_convert/ebooks/mobi/mobiml.py +617 -0
- ebook_convert/ebooks/mobi/reader/__init__.py +0 -0
- ebook_convert/ebooks/mobi/reader/containers.py +46 -0
- ebook_convert/ebooks/mobi/reader/headers.py +352 -0
- ebook_convert/ebooks/mobi/reader/index.py +273 -0
- ebook_convert/ebooks/mobi/reader/markup.py +374 -0
- ebook_convert/ebooks/mobi/reader/mobi6.py +1000 -0
- ebook_convert/ebooks/mobi/reader/mobi8.py +603 -0
- ebook_convert/ebooks/mobi/reader/ncx.py +94 -0
- ebook_convert/ebooks/mobi/tweak.py +106 -0
- ebook_convert/ebooks/mobi/utils.py +637 -0
- ebook_convert/ebooks/mobi/writer2/__init__.py +8 -0
- ebook_convert/ebooks/mobi/writer2/indexer.py +887 -0
- ebook_convert/ebooks/mobi/writer2/main.py +471 -0
- ebook_convert/ebooks/mobi/writer2/resources.py +164 -0
- ebook_convert/ebooks/mobi/writer2/serializer.py +392 -0
- ebook_convert/ebooks/mobi/writer8/__init__.py +0 -0
- ebook_convert/ebooks/mobi/writer8/cleanup.py +35 -0
- ebook_convert/ebooks/mobi/writer8/exth.py +224 -0
- ebook_convert/ebooks/odt/__init__.py +0 -0
- ebook_convert/ebooks/odt/input.py +309 -0
- ebook_convert/ebooks/oeb/__init__.py +0 -0
- ebook_convert/ebooks/oeb/base.py +1984 -0
- ebook_convert/ebooks/oeb/normalize_css.py +449 -0
- ebook_convert/ebooks/oeb/parse_utils.py +383 -0
- ebook_convert/ebooks/oeb/polish/__init__.py +0 -0
- ebook_convert/ebooks/oeb/polish/container.py +1542 -0
- ebook_convert/ebooks/oeb/polish/css.py +424 -0
- ebook_convert/ebooks/oeb/polish/errors.py +21 -0
- ebook_convert/ebooks/oeb/polish/opf.py +50 -0
- ebook_convert/ebooks/oeb/polish/parsing.py +105 -0
- ebook_convert/ebooks/oeb/polish/pretty.py +267 -0
- ebook_convert/ebooks/oeb/polish/replace.py +400 -0
- ebook_convert/ebooks/oeb/polish/split.py +517 -0
- ebook_convert/ebooks/oeb/polish/toc.py +922 -0
- ebook_convert/ebooks/oeb/polish/utils.py +239 -0
- ebook_convert/ebooks/oeb/reader.py +739 -0
- ebook_convert/ebooks/oeb/stylizer.py +812 -0
- ebook_convert/ebooks/oeb/transforms/__init__.py +0 -0
- ebook_convert/ebooks/oeb/transforms/cover.py +132 -0
- ebook_convert/ebooks/oeb/transforms/data_url.py +53 -0
- ebook_convert/ebooks/oeb/transforms/filenames.py +180 -0
- ebook_convert/ebooks/oeb/transforms/flatcss.py +683 -0
- ebook_convert/ebooks/oeb/transforms/guide.py +47 -0
- ebook_convert/ebooks/oeb/transforms/htmltoc.py +100 -0
- ebook_convert/ebooks/oeb/transforms/jacket.py +74 -0
- ebook_convert/ebooks/oeb/transforms/manglecase.py +121 -0
- ebook_convert/ebooks/oeb/transforms/metadata.py +217 -0
- ebook_convert/ebooks/oeb/transforms/page_margin.py +184 -0
- ebook_convert/ebooks/oeb/transforms/rasterize.py +248 -0
- ebook_convert/ebooks/oeb/transforms/rescale.py +80 -0
- ebook_convert/ebooks/oeb/transforms/split.py +503 -0
- ebook_convert/ebooks/oeb/transforms/structure.py +345 -0
- ebook_convert/ebooks/oeb/transforms/subset.py +308 -0
- ebook_convert/ebooks/oeb/transforms/trimmanifest.py +69 -0
- ebook_convert/ebooks/oeb/transforms/unsmarten.py +28 -0
- ebook_convert/ebooks/oeb/writer.py +77 -0
- ebook_convert/ebooks/pdb/__init__.py +103 -0
- ebook_convert/ebooks/pdb/ereader/__init__.py +28 -0
- ebook_convert/ebooks/pdb/ereader/reader.py +34 -0
- ebook_convert/ebooks/pdb/ereader/reader132.py +212 -0
- ebook_convert/ebooks/pdb/ereader/reader202.py +161 -0
- ebook_convert/ebooks/pdb/formatreader.py +15 -0
- ebook_convert/ebooks/pdb/haodoo/__init__.py +0 -0
- ebook_convert/ebooks/pdb/haodoo/reader.py +148 -0
- ebook_convert/ebooks/pdb/header.py +87 -0
- ebook_convert/ebooks/pdb/palmdoc/__init__.py +0 -0
- ebook_convert/ebooks/pdb/palmdoc/reader.py +72 -0
- ebook_convert/ebooks/pdb/pdf/__init__.py +0 -0
- ebook_convert/ebooks/pdb/pdf/reader.py +38 -0
- ebook_convert/ebooks/pdb/plucker/__init__.py +0 -0
- ebook_convert/ebooks/pdb/plucker/reader.py +739 -0
- ebook_convert/ebooks/pdb/ztxt/__init__.py +7 -0
- ebook_convert/ebooks/pdb/ztxt/reader.py +90 -0
- ebook_convert/ebooks/pdf/__init__.py +0 -0
- ebook_convert/ebooks/pdf/pdftohtml.py +161 -0
- ebook_convert/ebooks/pdf/render/__init__.py +0 -0
- ebook_convert/ebooks/pdf/render/common.py +243 -0
- ebook_convert/ebooks/rtf/__init__.py +0 -0
- ebook_convert/ebooks/rtf/input.py +37 -0
- ebook_convert/ebooks/rtf2xml/ParseRtf.py +571 -0
- ebook_convert/ebooks/rtf2xml/__init__.py +10 -0
- ebook_convert/ebooks/rtf2xml/add_brackets.py +230 -0
- ebook_convert/ebooks/rtf2xml/body_styles.py +83 -0
- ebook_convert/ebooks/rtf2xml/border_parse.py +190 -0
- ebook_convert/ebooks/rtf2xml/char_set.py +16708 -0
- ebook_convert/ebooks/rtf2xml/check_brackets.py +61 -0
- ebook_convert/ebooks/rtf2xml/check_encoding.py +37 -0
- ebook_convert/ebooks/rtf2xml/colors.py +257 -0
- ebook_convert/ebooks/rtf2xml/combine_borders.py +92 -0
- ebook_convert/ebooks/rtf2xml/convert_to_tags.py +283 -0
- ebook_convert/ebooks/rtf2xml/copy.py +62 -0
- ebook_convert/ebooks/rtf2xml/default_encoding.py +187 -0
- ebook_convert/ebooks/rtf2xml/delete_info.py +211 -0
- ebook_convert/ebooks/rtf2xml/field_strings.py +815 -0
- ebook_convert/ebooks/rtf2xml/fields_large.py +377 -0
- ebook_convert/ebooks/rtf2xml/fields_small.py +459 -0
- ebook_convert/ebooks/rtf2xml/fonts.py +225 -0
- ebook_convert/ebooks/rtf2xml/footnote.py +262 -0
- ebook_convert/ebooks/rtf2xml/get_char_map.py +61 -0
- ebook_convert/ebooks/rtf2xml/group_borders.py +305 -0
- ebook_convert/ebooks/rtf2xml/group_styles.py +251 -0
- ebook_convert/ebooks/rtf2xml/header.py +260 -0
- ebook_convert/ebooks/rtf2xml/headings_to_sections.py +226 -0
- ebook_convert/ebooks/rtf2xml/hex_2_utf8.py +587 -0
- ebook_convert/ebooks/rtf2xml/info.py +284 -0
- ebook_convert/ebooks/rtf2xml/inline.py +426 -0
- ebook_convert/ebooks/rtf2xml/line_endings.py +55 -0
- ebook_convert/ebooks/rtf2xml/list_numbers.py +200 -0
- ebook_convert/ebooks/rtf2xml/list_table.py +444 -0
- ebook_convert/ebooks/rtf2xml/make_lists.py +463 -0
- ebook_convert/ebooks/rtf2xml/old_rtf.py +143 -0
- ebook_convert/ebooks/rtf2xml/output.py +119 -0
- ebook_convert/ebooks/rtf2xml/override_table.py +207 -0
- ebook_convert/ebooks/rtf2xml/paragraph_def.py +761 -0
- ebook_convert/ebooks/rtf2xml/paragraphs.py +262 -0
- ebook_convert/ebooks/rtf2xml/pict.py +180 -0
- ebook_convert/ebooks/rtf2xml/preamble_div.py +589 -0
- ebook_convert/ebooks/rtf2xml/preamble_rest.py +156 -0
- ebook_convert/ebooks/rtf2xml/process_tokens.py +835 -0
- ebook_convert/ebooks/rtf2xml/sections.py +536 -0
- ebook_convert/ebooks/rtf2xml/styles.py +722 -0
- ebook_convert/ebooks/rtf2xml/table.py +566 -0
- ebook_convert/ebooks/rtf2xml/table_info.py +87 -0
- ebook_convert/ebooks/rtf2xml/tokenize.py +216 -0
- ebook_convert/ebooks/textile/__init__.py +0 -0
- ebook_convert/ebooks/textile/functions.py +1083 -0
- ebook_convert/ebooks/textile/unsmarten.py +127 -0
- ebook_convert/ebooks/txt/__init__.py +0 -0
- ebook_convert/ebooks/txt/markdownml.py +279 -0
- ebook_convert/ebooks/txt/newlines.py +30 -0
- ebook_convert/ebooks/txt/processor.py +337 -0
- ebook_convert/ebooks/txt/textileml.py +497 -0
- ebook_convert/ebooks/txt/txtml.py +265 -0
- ebook_convert/ebooks/unihandecode/__init__.py +49 -0
- ebook_convert/ebooks/unihandecode/jacodepoints.py +5248 -0
- ebook_convert/ebooks/unihandecode/jadecoder.py +41 -0
- ebook_convert/ebooks/unihandecode/krcodepoints.py +5248 -0
- ebook_convert/ebooks/unihandecode/krdecoder.py +21 -0
- ebook_convert/ebooks/unihandecode/unicodepoints.py +1796 -0
- ebook_convert/ebooks/unihandecode/unidecoder.py +107 -0
- ebook_convert/ebooks/unihandecode/vncodepoints.py +5248 -0
- ebook_convert/ebooks/unihandecode/vndecoder.py +21 -0
- ebook_convert/ebooks/unihandecode/zhcodepoints.py +5248 -0
- ebook_convert/library/__init__.py +85 -0
- ebook_convert/library/field_metadata.py +698 -0
- ebook_convert/logging.py +82 -0
- ebook_convert/main.py +90 -0
- ebook_convert/polyglot.py +59 -0
- ebook_convert/ptempfile.py +275 -0
- ebook_convert/spell/__init__.py +59 -0
- ebook_convert/tinycss/__init__.py +52 -0
- ebook_convert/tinycss/color3.py +379 -0
- ebook_convert/tinycss/css21.py +827 -0
- ebook_convert/tinycss/decoding.py +252 -0
- ebook_convert/tinycss/fonts3.py +221 -0
- ebook_convert/tinycss/media3.py +98 -0
- ebook_convert/tinycss/page3.py +160 -0
- ebook_convert/tinycss/parsing.py +161 -0
- ebook_convert/tinycss/token_data.py +446 -0
- ebook_convert/tinycss/tokenizer.py +212 -0
- ebook_convert/tinycss/version.py +1 -0
- ebook_convert/utils/__init__.py +0 -0
- ebook_convert/utils/cleantext.py +78 -0
- ebook_convert/utils/config.py +283 -0
- ebook_convert/utils/config_base.py +620 -0
- ebook_convert/utils/date.py +505 -0
- ebook_convert/utils/directory.py +20 -0
- ebook_convert/utils/encoding.py +20 -0
- ebook_convert/utils/entities.py +98 -0
- ebook_convert/utils/filenames.py +385 -0
- ebook_convert/utils/fonts/__init__.py +0 -0
- ebook_convert/utils/fonts/metadata.py +118 -0
- ebook_convert/utils/fonts/scanner.py +388 -0
- ebook_convert/utils/fonts/sfnt/__init__.py +77 -0
- ebook_convert/utils/fonts/sfnt/cff/__init__.py +0 -0
- ebook_convert/utils/fonts/sfnt/cff/constants.py +178 -0
- ebook_convert/utils/fonts/sfnt/cff/dict_data.py +307 -0
- ebook_convert/utils/fonts/sfnt/cff/table.py +217 -0
- ebook_convert/utils/fonts/sfnt/cmap.py +282 -0
- ebook_convert/utils/fonts/sfnt/common.py +248 -0
- ebook_convert/utils/fonts/sfnt/container.py +167 -0
- ebook_convert/utils/fonts/sfnt/errors.py +12 -0
- ebook_convert/utils/fonts/sfnt/glyf.py +91 -0
- ebook_convert/utils/fonts/sfnt/gsub.py +187 -0
- ebook_convert/utils/fonts/sfnt/head.py +209 -0
- ebook_convert/utils/fonts/sfnt/kern.py +85 -0
- ebook_convert/utils/fonts/sfnt/loca.py +87 -0
- ebook_convert/utils/fonts/sfnt/maxp.py +42 -0
- ebook_convert/utils/fonts/sfnt/subset.py +371 -0
- ebook_convert/utils/fonts/utils.py +504 -0
- ebook_convert/utils/formatter.py +409 -0
- ebook_convert/utils/formatter_functions.py +1672 -0
- ebook_convert/utils/html2text.py +36 -0
- ebook_convert/utils/html5.py +146 -0
- ebook_convert/utils/icu.py +269 -0
- ebook_convert/utils/img.py +712 -0
- ebook_convert/utils/imghdr.py +255 -0
- ebook_convert/utils/iso8601.py +49 -0
- ebook_convert/utils/localization.py +136 -0
- ebook_convert/utils/localunzip.py +320 -0
- ebook_convert/utils/mreplace.py +44 -0
- ebook_convert/utils/resources.py +94 -0
- ebook_convert/utils/serialize.py +120 -0
- ebook_convert/utils/shared_file.py +49 -0
- ebook_convert/utils/short_uuid.py +53 -0
- ebook_convert/utils/smartypants.py +884 -0
- ebook_convert/utils/speedups.py +198 -0
- ebook_convert/utils/terminal.py +265 -0
- ebook_convert/utils/titlecase.py +87 -0
- ebook_convert/utils/unsmarten.py +40 -0
- ebook_convert/utils/wordcount.py +90 -0
- ebook_convert/utils/xml_parse.py +67 -0
- ebook_convert/utils/zipfile.py +1690 -0
- ebook_convert-4.13.0.dist-info/METADATA +210 -0
- ebook_convert-4.13.0.dist-info/RECORD +372 -0
- ebook_convert-4.13.0.dist-info/WHEEL +5 -0
- ebook_convert-4.13.0.dist-info/entry_points.txt +2 -0
- ebook_convert-4.13.0.dist-info/licenses/LICENSE +674 -0
- ebook_convert-4.13.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
VERSION = '0.1.0'
|
|
2
|
+
CALIBRE_NS = 'http://calibre.kovidgoyal.net/2009/metadata'
|
|
3
|
+
DC09_NS = 'http://purl.org/metadata/dublin_core'
|
|
4
|
+
DC10_NS = 'http://purl.org/dc/elements/1.0/'
|
|
5
|
+
DC11_NS = 'http://purl.org/dc/elements/1.1/'
|
|
6
|
+
DCTERMS_NS = 'http://purl.org/dc/terms/'
|
|
7
|
+
EPUB_NS = 'http://www.idpf.org/2007/ops'
|
|
8
|
+
MATHML_NS = 'http://www.w3.org/1998/Math/MathML'
|
|
9
|
+
MBP_NS = 'http://www.mobipocket.com'
|
|
10
|
+
NCX_NS = 'http://www.daisy.org/z3986/2005/ncx/'
|
|
11
|
+
OEB_DOC_NS = 'http://openebook.org/namespaces/oeb-document/1.0/'
|
|
12
|
+
OPF1_NS = 'http://openebook.org/namespaces/oeb-package/1.0/'
|
|
13
|
+
OPF2_NS = 'http://www.idpf.org/2007/opf'
|
|
14
|
+
RE_NS = 'http://exslt.org/regular-expressions'
|
|
15
|
+
SVG_NS = 'http://www.w3.org/2000/svg'
|
|
16
|
+
XHTML_NS = 'http://www.w3.org/1999/xhtml'
|
|
17
|
+
XLINK_NS = 'http://www.w3.org/1999/xlink'
|
|
18
|
+
XMLNS_NS = 'http://www.w3.org/2000/xmlns/'
|
|
19
|
+
XML_NS = 'http://www.w3.org/XML/1998/namespace'
|
|
20
|
+
XSI_NS = 'http://www.w3.org/2001/XMLSchema-instance'
|
|
21
|
+
|
|
22
|
+
DC_NSES = {DC09_NS, DC10_NS, DC11_NS}
|
|
23
|
+
OPF_NAMESPACES = {'opf': OPF2_NS, 'dc': DC11_NS}
|
|
24
|
+
OPF_NSES = {OPF1_NS, OPF2_NS}
|
|
25
|
+
|
|
26
|
+
XHTML_BLOCK_TAGS = {'{%s}%s' % (XHTML_NS, x)
|
|
27
|
+
for x in ('address', 'article', 'aside', 'audio',
|
|
28
|
+
'blockquote', 'body', 'canvas', 'col',
|
|
29
|
+
'colgroup', 'dd', 'div', 'dl', 'dt', 'fieldset',
|
|
30
|
+
'figcaption', 'figure', 'footer', 'form', 'h1',
|
|
31
|
+
'h2', 'h3', 'h4', 'h5', 'h6', 'header',
|
|
32
|
+
'hgroup', 'hr', 'li', 'noscript', 'ol',
|
|
33
|
+
'output', 'p', 'pre', 'script', 'section',
|
|
34
|
+
'style', 'svg', 'table', 'tbody', 'td', 'tfoot',
|
|
35
|
+
'th', 'thead', 'tr', 'ul', 'video', 'img')}
|
|
36
|
+
|
|
37
|
+
OPF1_NSMAP = {'dc': DC11_NS,
|
|
38
|
+
'oebpackage': OPF1_NS}
|
|
39
|
+
OPF2_NSMAP = {'calibre': CALIBRE_NS,
|
|
40
|
+
'dc': DC11_NS,
|
|
41
|
+
'dcterms': DCTERMS_NS,
|
|
42
|
+
'opf': OPF2_NS,
|
|
43
|
+
'xsi': XSI_NS}
|
|
44
|
+
XPNSMAP = {'calibre': CALIBRE_NS,
|
|
45
|
+
'd09': DC09_NS,
|
|
46
|
+
'd10': DC10_NS,
|
|
47
|
+
'd11': DC11_NS,
|
|
48
|
+
'dt': DCTERMS_NS,
|
|
49
|
+
'epub': EPUB_NS,
|
|
50
|
+
'h': XHTML_NS,
|
|
51
|
+
'mathml': MATHML_NS,
|
|
52
|
+
'mbp': MBP_NS,
|
|
53
|
+
'ncx': NCX_NS,
|
|
54
|
+
'o1': OPF1_NS,
|
|
55
|
+
'o2': OPF2_NS,
|
|
56
|
+
're': RE_NS,
|
|
57
|
+
'svg': SVG_NS,
|
|
58
|
+
'xl': XLINK_NS,
|
|
59
|
+
'xsi': XSI_NS}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import atexit
|
|
2
|
+
import collections
|
|
3
|
+
import importlib
|
|
4
|
+
import locale
|
|
5
|
+
import os
|
|
6
|
+
import shutil
|
|
7
|
+
import sys
|
|
8
|
+
import tempfile
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
__appname__ = 'ebook-convert'
|
|
12
|
+
numeric_version = (4, 13, 0)
|
|
13
|
+
__version__ = '.'.join([str(x) for x in numeric_version])
|
|
14
|
+
__author__ = "foobar"
|
|
15
|
+
|
|
16
|
+
"""
|
|
17
|
+
Various run time constants.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
FAKE_PROTOCOL = 'ebco'
|
|
22
|
+
preferred_encoding = locale.getpreferredencoding()
|
|
23
|
+
filesystem_encoding = sys.getfilesystemencoding() or 'utf-8'
|
|
24
|
+
DEBUG = os.getenv('CALIBRE_DEBUG') is not None
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def debug():
|
|
28
|
+
global DEBUG
|
|
29
|
+
DEBUG = True
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# plugins {{{
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class Plugins(collections.abc.Mapping):
|
|
36
|
+
|
|
37
|
+
def __init__(self):
|
|
38
|
+
self._plugins = {}
|
|
39
|
+
self.plugins = frozenset([])
|
|
40
|
+
|
|
41
|
+
def load_plugin(self, name):
|
|
42
|
+
if name in self._plugins:
|
|
43
|
+
return
|
|
44
|
+
# sys.path.insert(0, plugins_loc)
|
|
45
|
+
try:
|
|
46
|
+
del sys.modules[name]
|
|
47
|
+
except KeyError:
|
|
48
|
+
pass
|
|
49
|
+
plugin_err = ''
|
|
50
|
+
try:
|
|
51
|
+
p = importlib.import_module(name)
|
|
52
|
+
except Exception as err:
|
|
53
|
+
p = None
|
|
54
|
+
plugin_err = str(err)
|
|
55
|
+
self._plugins[name] = p, plugin_err
|
|
56
|
+
|
|
57
|
+
def __iter__(self):
|
|
58
|
+
return iter(self.plugins)
|
|
59
|
+
|
|
60
|
+
def __len__(self):
|
|
61
|
+
return len(self.plugins)
|
|
62
|
+
|
|
63
|
+
def __contains__(self, name):
|
|
64
|
+
return name in self.plugins
|
|
65
|
+
|
|
66
|
+
def __getitem__(self, name):
|
|
67
|
+
if name not in self.plugins:
|
|
68
|
+
raise KeyError('No plugin named %r' % name)
|
|
69
|
+
self.load_plugin(name)
|
|
70
|
+
return self._plugins[name]
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
plugins = Plugins()
|
|
74
|
+
# }}}
|
|
75
|
+
|
|
76
|
+
# config_dir {{{
|
|
77
|
+
|
|
78
|
+
CONFIG_DIR_MODE = 0o700
|
|
79
|
+
|
|
80
|
+
bdir = os.path.abspath(os.path.expanduser(os.getenv('XDG_CONFIG_HOME',
|
|
81
|
+
'~/.config')))
|
|
82
|
+
config_dir = os.path.join(bdir, 'ebook-convert')
|
|
83
|
+
try:
|
|
84
|
+
os.makedirs(config_dir, mode=CONFIG_DIR_MODE)
|
|
85
|
+
except IOError:
|
|
86
|
+
pass
|
|
87
|
+
|
|
88
|
+
if not os.path.exists(config_dir) or \
|
|
89
|
+
not os.access(config_dir, os.W_OK) or not \
|
|
90
|
+
os.access(config_dir, os.X_OK):
|
|
91
|
+
print('No write acces to', config_dir, 'using a temporary dir instead')
|
|
92
|
+
config_dir = tempfile.mkdtemp(prefix='ec-config-')
|
|
93
|
+
|
|
94
|
+
def cleanup_cdir():
|
|
95
|
+
try:
|
|
96
|
+
shutil.rmtree(config_dir)
|
|
97
|
+
except OSError:
|
|
98
|
+
pass
|
|
99
|
+
atexit.register(cleanup_cdir)
|
|
100
|
+
# }}}
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def get_version():
|
|
104
|
+
'''Return version string for display to user '''
|
|
105
|
+
v = __version__
|
|
106
|
+
if numeric_version[-1] == 0:
|
|
107
|
+
v = v[:-2]
|
|
108
|
+
|
|
109
|
+
return v
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
from ebook_convert.css_selectors.parser import parse
|
|
2
|
+
from ebook_convert.css_selectors.select import Select, INAPPROPRIATE_PSEUDO_CLASSES
|
|
3
|
+
from ebook_convert.css_selectors.errors import SelectorError, SelectorSyntaxError, ExpressionError
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
__license__ = 'GPL v3'
|
|
7
|
+
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
|
8
|
+
__all__ = ['parse', 'Select', 'INAPPROPRIATE_PSEUDO_CLASSES', 'SelectorError', 'SelectorSyntaxError', 'ExpressionError']
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
__license__ = 'GPL v3'
|
|
2
|
+
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class SelectorError(ValueError):
|
|
6
|
+
|
|
7
|
+
"""Common parent for SelectorSyntaxError and ExpressionError"""
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class SelectorSyntaxError(SelectorError):
|
|
11
|
+
|
|
12
|
+
"""Parsing a selector that does not match the grammar."""
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ExpressionError(SelectorError):
|
|
16
|
+
|
|
17
|
+
"""Unknown or unsupported selector (eg. pseudo-class)."""
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import collections
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
__license__ = 'GPL v3'
|
|
5
|
+
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
|
6
|
+
|
|
7
|
+
SLICE_ALL = slice(None)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def is_iterable(obj):
|
|
11
|
+
"""
|
|
12
|
+
Are we being asked to look up a list of things, instead of a single thing?
|
|
13
|
+
We check for the `__iter__` attribute so that this can cover types that
|
|
14
|
+
don't have to be known by this module, such as NumPy arrays.
|
|
15
|
+
|
|
16
|
+
Strings, however, should be considered as atomic values to look up, not
|
|
17
|
+
iterables.
|
|
18
|
+
"""
|
|
19
|
+
return hasattr(obj, '__iter__') and not isinstance(obj, (str, bytes))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class OrderedSet(collections.abc.MutableSet):
|
|
23
|
+
"""
|
|
24
|
+
An OrderedSet is a custom MutableSet that remembers its order, so that
|
|
25
|
+
every entry has an index that can be looked up.
|
|
26
|
+
"""
|
|
27
|
+
def __init__(self, iterable=None):
|
|
28
|
+
self.items = []
|
|
29
|
+
self.map = {}
|
|
30
|
+
if iterable is not None:
|
|
31
|
+
for item in iterable:
|
|
32
|
+
idx = self.map.get(item)
|
|
33
|
+
if idx is None:
|
|
34
|
+
self.map[item] = len(self.items)
|
|
35
|
+
self.items.append(item)
|
|
36
|
+
|
|
37
|
+
def __len__(self):
|
|
38
|
+
return len(self.items)
|
|
39
|
+
|
|
40
|
+
def __getitem__(self, index):
|
|
41
|
+
"""
|
|
42
|
+
Get the item at a given index.
|
|
43
|
+
|
|
44
|
+
If `index` is a slice, you will get back that slice of items. If it's
|
|
45
|
+
the slice [:], exactly the same object is returned. (If you want an
|
|
46
|
+
independent copy of an OrderedSet, use `OrderedSet.copy()`.)
|
|
47
|
+
|
|
48
|
+
If `index` is an iterable, you'll get the OrderedSet of items
|
|
49
|
+
corresponding to those indices. This is similar to NumPy's
|
|
50
|
+
"fancy indexing".
|
|
51
|
+
"""
|
|
52
|
+
if index == SLICE_ALL:
|
|
53
|
+
return self
|
|
54
|
+
elif hasattr(index, '__index__') or isinstance(index, slice):
|
|
55
|
+
result = self.items[index]
|
|
56
|
+
if isinstance(result, list):
|
|
57
|
+
return OrderedSet(result)
|
|
58
|
+
else:
|
|
59
|
+
return result
|
|
60
|
+
elif is_iterable(index):
|
|
61
|
+
return OrderedSet([self.items[i] for i in index])
|
|
62
|
+
else:
|
|
63
|
+
raise TypeError("Don't know how to index an OrderedSet by %r" %
|
|
64
|
+
index)
|
|
65
|
+
|
|
66
|
+
def copy(self):
|
|
67
|
+
return OrderedSet(self)
|
|
68
|
+
|
|
69
|
+
def __getstate__(self):
|
|
70
|
+
return tuple(self)
|
|
71
|
+
|
|
72
|
+
def __setstate__(self, state):
|
|
73
|
+
self.__init__(state)
|
|
74
|
+
|
|
75
|
+
def __contains__(self, key):
|
|
76
|
+
return key in self.map
|
|
77
|
+
|
|
78
|
+
def add(self, key):
|
|
79
|
+
"""
|
|
80
|
+
Add `key` as an item to this OrderedSet, then return its index.
|
|
81
|
+
|
|
82
|
+
If `key` is already in the OrderedSet, return the index it already
|
|
83
|
+
had.
|
|
84
|
+
"""
|
|
85
|
+
index = self.map.get(key)
|
|
86
|
+
if index is None:
|
|
87
|
+
self.map[key] = index = len(self.items)
|
|
88
|
+
self.items.append(key)
|
|
89
|
+
return index
|
|
90
|
+
|
|
91
|
+
def index(self, key):
|
|
92
|
+
"""
|
|
93
|
+
Get the index of a given entry, raising an IndexError if it's not
|
|
94
|
+
present.
|
|
95
|
+
|
|
96
|
+
`key` can be an iterable of entries that is not a string, in which case
|
|
97
|
+
this returns a list of indices.
|
|
98
|
+
"""
|
|
99
|
+
if is_iterable(key):
|
|
100
|
+
return [self.index(subkey) for subkey in key]
|
|
101
|
+
return self.map[key]
|
|
102
|
+
|
|
103
|
+
def discard(self, key):
|
|
104
|
+
index = self.map.get(key)
|
|
105
|
+
if index is not None:
|
|
106
|
+
self.items.pop(index)
|
|
107
|
+
for item in self.items[index:]:
|
|
108
|
+
self.map[item] -= 1
|
|
109
|
+
return True
|
|
110
|
+
return False
|
|
111
|
+
|
|
112
|
+
def __iter__(self):
|
|
113
|
+
return iter(self.items)
|
|
114
|
+
|
|
115
|
+
def __reversed__(self):
|
|
116
|
+
return reversed(self.items)
|
|
117
|
+
|
|
118
|
+
def __repr__(self):
|
|
119
|
+
if not self:
|
|
120
|
+
return '%s()' % (self.__class__.__name__,)
|
|
121
|
+
return '%s(%r)' % (self.__class__.__name__, list(self))
|
|
122
|
+
|
|
123
|
+
def __eq__(self, other):
|
|
124
|
+
if isinstance(other, OrderedSet):
|
|
125
|
+
return len(self) == len(other) and self.items == other.items
|
|
126
|
+
try:
|
|
127
|
+
return type(other)(self.map) == other
|
|
128
|
+
except TypeError:
|
|
129
|
+
return False
|