mirror of
https://github.com/gryf/ebook-converter.git
synced 2026-04-20 21:21:35 +02:00
Removing unneeded from __future__ import statements.
Since we are on Python 3.6 and up, we don't need those anymore.
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
from ebook_converter.css_selectors.parser import parse
|
||||
from ebook_converter.css_selectors.select import Select, INAPPROPRIATE_PSEUDO_CLASSES
|
||||
from ebook_converter.css_selectors.errors import SelectorError, SelectorSyntaxError, ExpressionError
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
__all__ = ['parse', 'Select', 'INAPPROPRIATE_PSEUDO_CLASSES', 'SelectorError', 'SelectorSyntaxError', 'ExpressionError']
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
class SelectorError(ValueError):
|
||||
|
||||
"""Common parent for SelectorSyntaxError and ExpressionError"""
|
||||
|
||||
|
||||
class SelectorSyntaxError(SelectorError):
|
||||
|
||||
"""Parsing a selector that does not match the grammar."""
|
||||
|
||||
|
||||
class ExpressionError(SelectorError):
|
||||
|
||||
"""Unknown or unsupported selector (eg. pseudo-class)."""
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
import collections
|
||||
|
||||
from ebook_converter.polyglot.builtins import string_or_bytes
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import collections
|
||||
from ebook_converter.polyglot.builtins import string_or_bytes
|
||||
|
||||
SLICE_ALL = slice(None)
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import re, itertools
|
||||
from collections import OrderedDict, defaultdict
|
||||
from functools import wraps
|
||||
@@ -18,6 +11,10 @@ from ebook_converter.css_selectors.ordered_set import OrderedSet
|
||||
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
PARSE_CACHE_SIZE = 200
|
||||
parse_cache = OrderedDict()
|
||||
XPATH_CACHE_SIZE = 30
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import unittest, sys, argparse
|
||||
|
||||
from lxml import etree, html
|
||||
@@ -14,6 +7,10 @@ from ebook_converter.css_selectors.parser import tokenize, parse
|
||||
from ebook_converter.css_selectors.select import Select
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
class TestCSSSelectors(unittest.TestCase):
|
||||
|
||||
# Test data {{{
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import os, sys, zipfile, importlib
|
||||
|
||||
from ebook_converter.constants import numeric_version, iswindows, isosx
|
||||
from ebook_converter.ptempfile import PersistentTemporaryFile
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
platform = 'linux'
|
||||
if iswindows:
|
||||
platform = 'windows'
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import os, glob, re
|
||||
|
||||
from ebook_converter import guess_type
|
||||
from ebook_converter.customize import (FileTypePlugin, MetadataReaderPlugin,
|
||||
MetadataWriterPlugin, PreferencesPlugin, InterfaceActionBase, StoreBase)
|
||||
@@ -12,6 +7,10 @@ from ebook_converter.constants import numeric_version
|
||||
from ebook_converter.ebooks.metadata.archive import ArchiveExtract, KPFExtract, get_comic_metadata
|
||||
from ebook_converter.ebooks.html.to_zip import HTML2ZIP
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
plugins = []
|
||||
|
||||
# To archive plugins {{{
|
||||
@@ -1945,7 +1944,6 @@ if __name__ == '__main__':
|
||||
try:
|
||||
subprocess.check_call(['python', '-c', textwrap.dedent(
|
||||
'''
|
||||
from __future__ import print_function
|
||||
import time, sys, init_calibre
|
||||
st = time.time()
|
||||
import ebook_converter.customize.builtins
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
'''
|
||||
"""
|
||||
Defines the plugin system for conversions.
|
||||
'''
|
||||
"""
|
||||
import re, os, shutil, numbers
|
||||
|
||||
from ebook_converter import CurrentDir
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
from ebook_converter.customize import Plugin as _Plugin
|
||||
from ebook_converter.polyglot.builtins import zip
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
from ebook_converter.customize import Plugin as _Plugin
|
||||
from ebook_converter.polyglot.builtins import zip
|
||||
|
||||
FONT_SIZES = [('xx-small', 1),
|
||||
('x-small', None),
|
||||
('small', 2),
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import os, shutil, traceback, functools, sys
|
||||
from collections import defaultdict
|
||||
from itertools import chain
|
||||
@@ -24,6 +20,10 @@ from ebook_converter.utils.config import (make_config_dir, Config, ConfigProxy,
|
||||
from ebook_converter.constants import DEBUG, numeric_version
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues, unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
builtin_names = frozenset(p.name for p in builtin_plugins)
|
||||
BLACKLISTED_PLUGINS = frozenset({'Marvin XD', 'iOS reader applications'})
|
||||
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
"""
|
||||
PEP 302 based plugin loading mechanism, works around the bug in zipimport in
|
||||
python 2.x that prevents importing from zip files in locations whose paths
|
||||
have non ASCII characters
|
||||
"""
|
||||
import os, zipfile, posixpath, importlib, threading, re, imp, sys
|
||||
from collections import OrderedDict
|
||||
from functools import partial
|
||||
@@ -17,9 +14,10 @@ from ebook_converter.customize import (Plugin, numeric_version, platform,
|
||||
from ebook_converter.polyglot.builtins import (itervalues, map, string_or_bytes,
|
||||
unicode_type, reload)
|
||||
|
||||
# PEP 302 based plugin loading mechanism, works around the bug in zipimport in
|
||||
# python 2.x that prevents importing from zip files in locations whose paths
|
||||
# have non ASCII characters
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
def get_resources(zfp, name_or_list_of_names):
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
# License: GPLv3 Copyright: 2010, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
from __future__ import unicode_literals
|
||||
|
||||
# Contains various tweaks that affect calibre behavior. Only edit this file if
|
||||
# you know what you are doing. If you delete this file, it will be recreated from
|
||||
# defaults.
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
import os
|
||||
from collections import namedtuple
|
||||
|
||||
@@ -10,6 +6,10 @@ from ebook_converter.constants import iswindows
|
||||
from ebook_converter.customize import Plugin
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
class DevicePlugin(Plugin):
|
||||
"""
|
||||
Defines the interface that should be implemented by backends that
|
||||
|
||||
@@ -1,9 +1,4 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
# License: GPLv3 Copyright: 2019, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
import bs4
|
||||
from bs4 import ( # noqa
|
||||
CData, Comment, Declaration, NavigableString, ProcessingInstruction,
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
import re, codecs
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import re, codecs
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
_encoding_pats = (
|
||||
# XML declaration
|
||||
r'<\?[^<>]+encoding\s*=\s*[\'"](.*?)[\'"][^<>]*>',
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import io
|
||||
from struct import pack
|
||||
|
||||
from ebook_converter.constants import plugins
|
||||
from ebook_converter.ebooks.compression import cPalmdoc
|
||||
from ebook_converter.polyglot.builtins import range
|
||||
#cPalmdoc = plugins['cPalmdoc'][0]
|
||||
#if not cPalmdoc:
|
||||
# raise RuntimeError(('Failed to load required cPalmdoc module: '
|
||||
# '%s')%plugins['cPalmdoc'][1])
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
def decompress_doc(data):
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
from ebook_converter.polyglot.builtins import native_string_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
from ebook_converter.polyglot.builtins import native_string_type
|
||||
|
||||
|
||||
class ConversionUserFeedBack(Exception):
|
||||
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
'''
|
||||
"""
|
||||
Command line interface to conversion sub-system
|
||||
'''
|
||||
|
||||
"""
|
||||
import sys, os, numbers
|
||||
from optparse import OptionGroup, Option
|
||||
from collections import OrderedDict
|
||||
@@ -20,6 +13,11 @@ from ebook_converter.ebooks.conversion import ConversionUserFeedBack
|
||||
from ebook_converter.utils.localization import localize_user_manual_link
|
||||
from ebook_converter.polyglot.builtins import iteritems
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
USAGE = '%prog ' + _('''\
|
||||
input_file output_file [options]
|
||||
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin
|
||||
from ebook_converter.polyglot.builtins import getcwd
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin
|
||||
from ebook_converter.polyglot.builtins import getcwd
|
||||
|
||||
|
||||
class AZW4Input(InputFormatPlugin):
|
||||
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
''' CHM File decoding support '''
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>,' \
|
||||
' and Alex Bramley <a.bramley at gmail.com>.'
|
||||
|
||||
"""
|
||||
CHM File decoding support
|
||||
"""
|
||||
import os
|
||||
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin
|
||||
@@ -12,6 +8,10 @@ from ebook_converter.ptempfile import TemporaryDirectory
|
||||
from ebook_converter.constants import filesystem_encoding
|
||||
from ebook_converter.polyglot.builtins import unicode_type, as_bytes
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = ('2008, Kovid Goyal <kovid at kovidgoyal.net>, '
|
||||
'and Alex Bramley <a.bramley at gmail.com>.')
|
||||
|
||||
|
||||
class CHMInput(InputFormatPlugin):
|
||||
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
'''
|
||||
"""
|
||||
Based on ideas from comiclrf created by FangornUK.
|
||||
'''
|
||||
|
||||
"""
|
||||
import shutil, textwrap, codecs, os
|
||||
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin, OptionRecommendation
|
||||
@@ -16,6 +9,11 @@ from ebook_converter.ptempfile import PersistentTemporaryDirectory
|
||||
from ebook_converter.polyglot.builtins import getcwd, map
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class ComicInput(InputFormatPlugin):
|
||||
|
||||
name = 'Comic Input'
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2011, Anthon van der Neut <anthon@mnt.org>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os
|
||||
from io import BytesIO
|
||||
|
||||
@@ -13,6 +5,11 @@ from ebook_converter.customize.conversion import InputFormatPlugin
|
||||
from ebook_converter.polyglot.builtins import getcwd
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2011, Anthon van der Neut <anthon@mnt.org>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class DJVUInput(InputFormatPlugin):
|
||||
|
||||
name = 'DJVU Input'
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin, OptionRecommendation
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin, OptionRecommendation
|
||||
|
||||
|
||||
class DOCXInput(InputFormatPlugin):
|
||||
name = 'DOCX Input'
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
from ebook_converter.customize.conversion import OutputFormatPlugin, OptionRecommendation
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
from ebook_converter.customize.conversion import OutputFormatPlugin, OptionRecommendation
|
||||
|
||||
PAGE_SIZES = ['a0', 'a1', 'a2', 'a3', 'a4', 'a5', 'a6', 'b0', 'b1',
|
||||
'b2', 'b3', 'b4', 'b5', 'b6', 'legal', 'letter']
|
||||
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os, re, posixpath
|
||||
from itertools import cycle
|
||||
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin, OptionRecommendation
|
||||
from ebook_converter.polyglot.builtins import getcwd
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
ADOBE_OBFUSCATION = 'http://ns.adobe.com/pdf/enc#RC'
|
||||
IDPF_OBFUSCATION = 'http://www.idpf.org/2008/embedding'
|
||||
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os, shutil, re
|
||||
|
||||
from ebook_converter.customize.conversion import (OutputFormatPlugin,
|
||||
@@ -14,6 +6,11 @@ from ebook_converter.ptempfile import TemporaryDirectory
|
||||
from ebook_converter import CurrentDir
|
||||
from ebook_converter.polyglot.builtins import unicode_type, filter, map, zip, range, as_bytes
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
block_level_tags = (
|
||||
'address',
|
||||
'body',
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Anatoly Shipitsin <norguhtar at gmail.com>'
|
||||
"""
|
||||
Convert .fb2 files to .lrf
|
||||
"""
|
||||
@@ -12,6 +8,10 @@ from ebook_converter.customize.conversion import InputFormatPlugin, OptionRecomm
|
||||
from ebook_converter import guess_type
|
||||
from ebook_converter.polyglot.builtins import iteritems, getcwd
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Anatoly Shipitsin <norguhtar at gmail.com>'
|
||||
|
||||
FB2NS = 'http://www.gribuser.ru/xml/fictionbook/2.0'
|
||||
FB21NS = 'http://www.gribuser.ru/xml/fictionbook/2.1'
|
||||
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
import os
|
||||
|
||||
from ebook_converter.customize.conversion import OutputFormatPlugin, OptionRecommendation
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os
|
||||
|
||||
from ebook_converter.customize.conversion import OutputFormatPlugin, OptionRecommendation
|
||||
|
||||
|
||||
class FB2Output(OutputFormatPlugin):
|
||||
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import re, tempfile, os
|
||||
from functools import partial
|
||||
|
||||
@@ -18,6 +10,11 @@ from ebook_converter.utils.imghdr import what
|
||||
from ebook_converter.polyglot.builtins import unicode_type, zip, getcwd, as_unicode
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
def sanitize_file_name(x):
|
||||
ans = re.sub(r'\s+', ' ', re.sub(r'[?&=;#]', '_', ascii_filename(x))).strip().rstrip('.')
|
||||
ans, ext = ans.rpartition('.')[::2]
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2010, Fabian Grassl <fg@jusmeum.de>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os, re, shutil
|
||||
from os.path import dirname, abspath, relpath as _relpath, exists, basename
|
||||
import pkg_resources
|
||||
@@ -14,6 +8,11 @@ from ebook_converter.ptempfile import PersistentTemporaryDirectory
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2010, Fabian Grassl <fg@jusmeum.de>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
def relpath(*args):
|
||||
return _relpath(*args).replace(os.sep, '/')
|
||||
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os
|
||||
|
||||
from ebook_converter import guess_type
|
||||
@@ -13,6 +5,11 @@ from ebook_converter.customize.conversion import InputFormatPlugin
|
||||
from ebook_converter.polyglot.builtins import getcwd
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class HTMLZInput(InputFormatPlugin):
|
||||
|
||||
name = 'HTLZ Input'
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import io
|
||||
import os
|
||||
|
||||
@@ -15,6 +7,11 @@ from ebook_converter.ptempfile import TemporaryDirectory
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class HTMLZOutput(OutputFormatPlugin):
|
||||
|
||||
name = 'HTMLZ Output'
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin
|
||||
|
||||
|
||||
class LITInput(InputFormatPlugin):
|
||||
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
from ebook_converter.customize.conversion import OutputFormatPlugin
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
from ebook_converter.customize.conversion import OutputFormatPlugin
|
||||
|
||||
|
||||
class LITOutput(OutputFormatPlugin):
|
||||
|
||||
name = 'LIT Output'
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os, sys
|
||||
import pkg_resources
|
||||
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class LRFInput(InputFormatPlugin):
|
||||
|
||||
name = 'LRF Input'
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import sys, os
|
||||
|
||||
from ebook_converter.customize.conversion import OutputFormatPlugin
|
||||
@@ -13,6 +5,11 @@ from ebook_converter.customize.conversion import OptionRecommendation
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class LRFOptions(object):
|
||||
|
||||
def __init__(self, output, opts, oeb):
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os
|
||||
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class MOBIInput(InputFormatPlugin):
|
||||
|
||||
name = 'MOBI Input'
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
from ebook_converter.customize.conversion import (OutputFormatPlugin,
|
||||
OptionRecommendation)
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
from ebook_converter.customize.conversion import (OutputFormatPlugin,
|
||||
OptionRecommendation)
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
def remove_html_cover(oeb, log):
|
||||
from ebook_converter.ebooks.oeb.base import OEB_DOCS
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
"""
|
||||
Convert an ODT file into a Open Ebook
|
||||
"""
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
'''
|
||||
Convert an ODT file into a Open Ebook
|
||||
'''
|
||||
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin
|
||||
|
||||
|
||||
class ODTInput(InputFormatPlugin):
|
||||
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os, re
|
||||
|
||||
|
||||
@@ -12,6 +6,11 @@ from ebook_converter.customize.conversion import (OutputFormatPlugin,
|
||||
from ebook_converter import CurrentDir
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class OEBOutput(OutputFormatPlugin):
|
||||
|
||||
name = 'OEB Output'
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin
|
||||
from ebook_converter.polyglot.builtins import getcwd
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin
|
||||
from ebook_converter.polyglot.builtins import getcwd
|
||||
|
||||
|
||||
class PDBInput(InputFormatPlugin):
|
||||
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os
|
||||
|
||||
from ebook_converter.customize.conversion import OutputFormatPlugin, \
|
||||
@@ -12,6 +5,11 @@ from ebook_converter.customize.conversion import OutputFormatPlugin, \
|
||||
from ebook_converter.ebooks.pdb import PDBError, get_writer, ALL_FORMAT_WRITERS
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class PDBOutput(OutputFormatPlugin):
|
||||
|
||||
name = 'PDB Output'
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os
|
||||
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin, OptionRecommendation
|
||||
from ebook_converter.polyglot.builtins import as_bytes, getcwd
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class PDFInput(InputFormatPlugin):
|
||||
|
||||
name = 'PDF Input'
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
'''
|
||||
"""
|
||||
Convert OEB ebook format to PDF.
|
||||
'''
|
||||
|
||||
"""
|
||||
import glob, os
|
||||
|
||||
from ebook_converter.customize.conversion import (OutputFormatPlugin,
|
||||
@@ -16,6 +8,11 @@ from ebook_converter.customize.conversion import (OutputFormatPlugin,
|
||||
from ebook_converter.ptempfile import TemporaryDirectory
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2012, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
UNITS = ('millimeter', 'centimeter', 'point', 'inch' , 'pica' , 'didot',
|
||||
'cicero', 'devicepixel')
|
||||
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import glob
|
||||
import os
|
||||
import shutil
|
||||
@@ -14,6 +7,11 @@ from ebook_converter.ptempfile import TemporaryDirectory
|
||||
from ebook_converter.polyglot.builtins import getcwd
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class PMLInput(InputFormatPlugin):
|
||||
|
||||
name = 'PML Input'
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os, io
|
||||
|
||||
from ebook_converter.customize.conversion import (OutputFormatPlugin,
|
||||
@@ -13,6 +6,11 @@ from ebook_converter.ptempfile import TemporaryDirectory
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class PMLOutput(OutputFormatPlugin):
|
||||
|
||||
name = 'PML Output'
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin
|
||||
from ebook_converter.polyglot.builtins import getcwd
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin
|
||||
from ebook_converter.polyglot.builtins import getcwd
|
||||
|
||||
|
||||
class RBInput(InputFormatPlugin):
|
||||
|
||||
name = 'RB Input'
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
import os
|
||||
|
||||
from ebook_converter.customize.conversion import OutputFormatPlugin, OptionRecommendation
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os
|
||||
|
||||
from ebook_converter.customize.conversion import OutputFormatPlugin, OptionRecommendation
|
||||
|
||||
|
||||
class RBOutput(OutputFormatPlugin):
|
||||
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os
|
||||
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin, OptionRecommendation
|
||||
@@ -14,6 +6,11 @@ from ebook_converter import walk
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class RecipeDisabled(Exception):
|
||||
pass
|
||||
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
from __future__ import with_statement, unicode_literals
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import os, glob, re, textwrap
|
||||
import pkg_resources
|
||||
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin, OptionRecommendation
|
||||
from ebook_converter.polyglot.builtins import iteritems, filter, getcwd, as_bytes
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
border_style_map = {
|
||||
'single' : 'solid',
|
||||
'double-thickness-border' : 'double',
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
import os
|
||||
|
||||
from ebook_converter.customize.conversion import OutputFormatPlugin
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os
|
||||
|
||||
from ebook_converter.customize.conversion import OutputFormatPlugin
|
||||
|
||||
|
||||
class RTFOutput(OutputFormatPlugin):
|
||||
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2010, Li Fanxi <lifanxi@freemindworld.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os
|
||||
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin
|
||||
@@ -12,6 +5,11 @@ from ebook_converter.ptempfile import TemporaryDirectory
|
||||
from ebook_converter.utils.filenames import ascii_filename
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2010, Li Fanxi <lifanxi@freemindworld.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
HTML_TEMPLATE = '<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><title>%s</title></head><body>\n%s\n</body></html>'
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2010, Li Fanxi <lifanxi@freemindworld.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os
|
||||
|
||||
from ebook_converter.customize.conversion import OutputFormatPlugin, OptionRecommendation
|
||||
@@ -13,6 +6,11 @@ from ebook_converter.constants import __appname__, __version__
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2010, Li Fanxi <lifanxi@freemindworld.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class SNBOutput(OutputFormatPlugin):
|
||||
|
||||
name = 'SNB Output'
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
from io import BytesIO
|
||||
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class TCRInput(InputFormatPlugin):
|
||||
|
||||
name = 'TCR Input'
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os
|
||||
|
||||
from ebook_converter.customize.conversion import OutputFormatPlugin, \
|
||||
OptionRecommendation
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class TCROutput(OutputFormatPlugin):
|
||||
|
||||
name = 'TCR Output'
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os
|
||||
|
||||
from ebook_converter import _ent_pat, walk, xml_entity_to_unicode
|
||||
from ebook_converter.customize.conversion import InputFormatPlugin, OptionRecommendation
|
||||
from ebook_converter.polyglot.builtins import getcwd
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
MD_EXTENSIONS = {
|
||||
'abbr': _('Abbreviations'),
|
||||
'admonition': _('Support admonitions'),
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
||||
from ebook_converter.customize.conversion import OutputFormatPlugin, \
|
||||
OptionRecommendation
|
||||
from ebook_converter.ptempfile import TemporaryDirectory, TemporaryFile
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
NEWLINE_TYPES = ['system', 'unix', 'old_mac', 'windows']
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import os, re, sys, shutil, pprint, json
|
||||
from functools import partial
|
||||
|
||||
@@ -22,6 +15,11 @@ from ebook_converter import (extract, walk, isbytestring, filesystem_encoding,
|
||||
from ebook_converter.constants import __version__
|
||||
from ebook_converter.polyglot.builtins import unicode_type, string_or_bytes, map
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
DEBUG_README=b'''
|
||||
This debug directory contains snapshots of the e-book as it passes through the
|
||||
various stages of conversion. The stages are:
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import functools, re, json
|
||||
from math import ceil
|
||||
|
||||
from ebook_converter import entity_to_unicode, as_unicode
|
||||
from ebook_converter.polyglot.builtins import unicode_type, range
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
XMLDECL_RE = re.compile(r'^\s*<[?]xml.*?[?]>')
|
||||
SVG_NS = 'http://www.w3.org/2000/svg'
|
||||
XLINK_NS = 'http://www.w3.org/1999/xlink'
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import re
|
||||
from math import ceil
|
||||
from ebook_converter.ebooks.conversion.preprocess import DocAnalysis, Dehyphenator
|
||||
@@ -14,6 +6,11 @@ from ebook_converter.utils.wordcount import get_wordcount_obj
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class HeuristicProcessor(object):
|
||||
|
||||
def __init__(self, extra_opts=None, log=None):
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import re, random, unicodedata, numbers
|
||||
from collections import namedtuple
|
||||
from contextlib import contextmanager
|
||||
@@ -27,6 +20,10 @@ from ebook_converter.gui2 import ensure_app, config, load_builtin_fonts, pixmap_
|
||||
from ebook_converter.utils.cleantext import clean_ascii_chars, clean_xml_chars
|
||||
from ebook_converter.utils.config import JSONConfig
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
# Default settings {{{
|
||||
cprefs = JSONConfig('cover_generation')
|
||||
cprefs.defaults['title_font_size'] = 120 # px
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
class InvalidDOCX(ValueError):
|
||||
pass
|
||||
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import numbers
|
||||
from collections import OrderedDict
|
||||
from ebook_converter.polyglot.builtins import iteritems
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
class Inherit(object):
|
||||
|
||||
def __eq__(self, other):
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
from collections import OrderedDict
|
||||
from ebook_converter.ebooks.docx.block_styles import ( # noqa
|
||||
inherit, simple_color, LINE_STYLES, simple_float, binary_property, read_shd)
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
# Read from XML {{{
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
import os
|
||||
from ebook_converter.polyglot.builtins import itervalues, range
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import os
|
||||
from ebook_converter.polyglot.builtins import itervalues, range
|
||||
|
||||
NBSP = '\xa0'
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import os, sys, shutil
|
||||
|
||||
from lxml import etree
|
||||
@@ -21,6 +14,10 @@ from ebook_converter.utils.zipfile import ZipFile
|
||||
from ebook_converter.utils.xml_parse import safe_xml_fromstring
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
def fromstring(raw, parser=None):
|
||||
return safe_xml_fromstring(raw)
|
||||
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import re
|
||||
|
||||
from ebook_converter.ebooks.docx.index import process_index, polish_index_markup
|
||||
from ebook_converter.polyglot.builtins import iteritems, native_string_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
class Field(object):
|
||||
|
||||
def __init__(self, start):
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import os, re
|
||||
from collections import namedtuple
|
||||
|
||||
@@ -15,6 +8,10 @@ from ebook_converter.utils.fonts.utils import panose_to_css_generic_family, is_t
|
||||
from ebook_converter.utils.icu import ord_string
|
||||
from ebook_converter.polyglot.builtins import codepoint_to_chr, iteritems, range
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
Embed = namedtuple('Embed', 'name key subsetted')
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
from collections import OrderedDict
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
from collections import OrderedDict
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type
|
||||
|
||||
|
||||
class Note(object):
|
||||
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import os
|
||||
|
||||
from lxml.html.builder import IMG, HR
|
||||
@@ -17,6 +10,10 @@ from ebook_converter.utils.imghdr import what
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
class LinkedImageNotFound(ValueError):
|
||||
|
||||
def __init__(self, fname):
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
from operator import itemgetter
|
||||
|
||||
from lxml import etree
|
||||
@@ -13,6 +6,10 @@ from ebook_converter.utils.icu import partition_by_first_letter, sort_key
|
||||
from ebook_converter.polyglot.builtins import iteritems, filter
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2014, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
def get_applicable_xe_fields(index, xe_fields, XPath, expand):
|
||||
iet = index.get('entry-type', None)
|
||||
xe_fields = [xe for xe in xe_fields if xe.get('entry-type', None) == iet]
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import re
|
||||
|
||||
from lxml.etree import XPath as X
|
||||
@@ -12,6 +5,10 @@ from lxml.etree import XPath as X
|
||||
from ebook_converter.utils.filenames import ascii_text
|
||||
from ebook_converter.polyglot.builtins import iteritems
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
# Names {{{
|
||||
TRANSITIONAL_NAMES = {
|
||||
'DOCUMENT' : 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument',
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import re, string
|
||||
from collections import Counter, defaultdict
|
||||
from functools import partial
|
||||
@@ -16,6 +9,10 @@ from ebook_converter.ebooks.docx.char_styles import RunStyle, inherit
|
||||
from ebook_converter.ebooks.metadata import roman
|
||||
from ebook_converter.polyglot.builtins import iteritems, unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
STYLE_MAP = {
|
||||
'aiueo': 'hiragana',
|
||||
'aiueoFullWidth': 'hiragana',
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import textwrap
|
||||
from collections import OrderedDict, Counter
|
||||
|
||||
@@ -14,6 +7,10 @@ from ebook_converter.ebooks.docx.tables import TableStyle
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
class PageProperties(object):
|
||||
|
||||
'''
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
from lxml.html.builder import TABLE, TR, TD
|
||||
|
||||
from ebook_converter.ebooks.docx.block_styles import inherit, read_shd as rs, read_border, binary_property, border_props, ParagraphStyle, border_to_css
|
||||
from ebook_converter.ebooks.docx.char_styles import RunStyle
|
||||
from ebook_converter.polyglot.builtins import filter, iteritems, itervalues, range, unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
# Read from XML {{{
|
||||
read_shd = rs
|
||||
edges = ('left', 'top', 'right', 'bottom')
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import sys, os, re, math, errno, uuid, numbers
|
||||
from collections import OrderedDict, defaultdict
|
||||
|
||||
@@ -31,6 +24,9 @@ from ebook_converter.utils.localization import canonicalize_lang, lang_as_iso639
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues, filter, getcwd, map, unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
NBSP = '\xa0'
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
from collections import namedtuple
|
||||
from itertools import count
|
||||
|
||||
@@ -15,6 +8,10 @@ from ebook_converter.ebooks.oeb.polish.toc import elem_to_toc_text
|
||||
from ebook_converter.polyglot.builtins import iteritems, range
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
def from_headings(body, log, namespace, num_levels=3):
|
||||
' Create a TOC from headings in the document '
|
||||
tocroot = TOC()
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import textwrap, os
|
||||
|
||||
from lxml import etree
|
||||
@@ -21,6 +14,10 @@ from ebook_converter.utils.zipfile import ZipFile
|
||||
from ebook_converter.polyglot.builtins import iteritems, map, unicode_type, native_string_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
def xml2str(root, pretty_print=False, with_tail=False):
|
||||
if hasattr(etree, 'cleanup_namespaces'):
|
||||
etree.cleanup_namespaces(root)
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
from collections import defaultdict
|
||||
from uuid import uuid4
|
||||
|
||||
@@ -13,6 +6,10 @@ from ebook_converter.ebooks.oeb.transforms.subset import find_font_face_rules
|
||||
from ebook_converter.polyglot.builtins import range
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
def obfuscate_font_data(data, key):
|
||||
prefix = bytearray(data[:32])
|
||||
key = bytearray(reversed(key.bytes))
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import re
|
||||
from collections import Counter
|
||||
|
||||
@@ -21,6 +14,10 @@ from ebook_converter.utils.localization import lang_as_iso639_1
|
||||
from ebook_converter.polyglot.builtins import unicode_type, string_or_bytes
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
def lang_for_tag(tag):
|
||||
for attr in ('lang', '{http://www.w3.org/XML/1998/namespace}lang'):
|
||||
val = lang_as_iso639_1(tag.get(attr))
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import os
|
||||
import posixpath
|
||||
from collections import namedtuple
|
||||
@@ -19,6 +12,10 @@ from ebook_converter.ebooks.docx.images import pt_to_emu
|
||||
from ebook_converter.utils.filenames import ascii_filename
|
||||
from ebook_converter.utils.imghdr import identify
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
Image = namedtuple('Image', 'rid fname width height fmt item')
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import posixpath, re
|
||||
from uuid import uuid4
|
||||
|
||||
@@ -13,6 +6,10 @@ from ebook_converter.polyglot.builtins import unicode_type
|
||||
from ebook_converter.polyglot.urllib import urlparse
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
def start_text(tag, prefix_len=0, top_level=True):
|
||||
ans = tag.text or ''
|
||||
limit = 50 - prefix_len
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
from collections import defaultdict
|
||||
from operator import attrgetter
|
||||
|
||||
from ebook_converter.polyglot.builtins import iteritems, itervalues, unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
LIST_STYLES = frozenset(
|
||||
'disc circle square decimal decimal-leading-zero lower-roman upper-roman'
|
||||
' lower-greek lower-alpha lower-latin upper-alpha upper-latin hiragana hebrew'
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import numbers
|
||||
from collections import Counter, defaultdict
|
||||
from operator import attrgetter
|
||||
@@ -17,6 +10,10 @@ from ebook_converter.utils.localization import lang_as_iso639_1
|
||||
from ebook_converter.polyglot.builtins import iteritems, filter, unicode_type
|
||||
from ebook_converter.tinycss.css21 import CSS21Parser
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
css_parser = CSS21Parser()
|
||||
|
||||
border_edges = ('left', 'top', 'right', 'bottom')
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
from collections import namedtuple
|
||||
|
||||
from ebook_converter.ebooks.docx.writer.utils import convert_color
|
||||
@@ -12,6 +5,10 @@ from ebook_converter.ebooks.docx.writer.styles import read_css_block_borders as
|
||||
from ebook_converter.polyglot.builtins import iteritems, range, unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2015, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
class Dummy(object):
|
||||
pass
|
||||
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
from ebook_converter.tinycss.color3 import parse_color_string
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
from ebook_converter.tinycss.color3 import parse_color_string
|
||||
|
||||
|
||||
def int_or_zero(raw):
|
||||
try:
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
"""
|
||||
Conversion to EPUB.
|
||||
"""
|
||||
from ebook_converter.utils.zipfile import ZipFile, ZIP_STORED
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
'''
|
||||
Conversion to EPUB.
|
||||
'''
|
||||
from ebook_converter.utils.zipfile import ZipFile, ZIP_STORED
|
||||
|
||||
|
||||
def rules(stylesheets):
|
||||
for s in stylesheets:
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
@@ -1,14 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
'''
|
||||
"""
|
||||
Transform OEB content into FB2 markup
|
||||
'''
|
||||
|
||||
"""
|
||||
import re, textwrap, uuid
|
||||
from datetime import datetime
|
||||
|
||||
@@ -25,6 +17,11 @@ from ebook_converter.polyglot.binary import as_base64_unicode
|
||||
from ebook_converter.polyglot.urllib import urlparse
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2009, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class FB2MLizer(object):
|
||||
'''
|
||||
Todo: * Include more FB2 specific tags in the conversion.
|
||||
|
||||
@@ -1,16 +1,6 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
'''
|
||||
"""
|
||||
Input plugin for HTML or OPF ebooks.
|
||||
'''
|
||||
|
||||
"""
|
||||
import os, re, sys, errno as gerrno
|
||||
|
||||
from ebook_converter.ebooks.oeb.base import urlunquote
|
||||
@@ -21,6 +11,11 @@ from ebook_converter.polyglot.builtins import is_py3, unicode_type
|
||||
from ebook_converter.polyglot.urllib import urlparse, urlunparse
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class Link(object):
|
||||
|
||||
'''
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
import textwrap, os, glob
|
||||
|
||||
from ebook_converter.customize import FileTypePlugin
|
||||
@@ -13,6 +5,11 @@ from ebook_converter.constants import numeric_version
|
||||
from ebook_converter.polyglot.builtins import unicode_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
|
||||
class HTML2ZIP(FileTypePlugin):
|
||||
name = 'HTML to ZIP'
|
||||
author = 'Kovid Goyal'
|
||||
|
||||
@@ -1,8 +1,3 @@
|
||||
#!/usr/bin/env python2
|
||||
# vim:fileencoding=utf-8
|
||||
# License: GPLv3 Copyright: 2017, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
html5_entities = {
|
||||
# ENTITY_DATA {{{
|
||||
'AElig': 'Æ',
|
||||
|
||||
@@ -1,15 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
'''
|
||||
"""
|
||||
Transform OEB content into a single (more or less) HTML file.
|
||||
'''
|
||||
|
||||
"""
|
||||
import os
|
||||
import re
|
||||
|
||||
@@ -24,6 +15,11 @@ from ebook_converter.utils.logging import default_log
|
||||
from ebook_converter.polyglot.builtins import unicode_type, string_or_bytes, as_bytes
|
||||
from ebook_converter.polyglot.urllib import urldefrag
|
||||
|
||||
|
||||
__license__ = 'GPL 3'
|
||||
__copyright__ = '2011, John Schember <john@nachtimwald.com>'
|
||||
__docformat__ = 'restructuredtext en'
|
||||
|
||||
SELF_CLOSING_TAGS = {'area', 'base', 'basefont', 'br', 'hr', 'input', 'img', 'link', 'meta'}
|
||||
|
||||
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
"""
|
||||
This package contains logic to read and write LRF files.
|
||||
The LRF file format is documented at U{http://www.sven.de/librie/Librie/LrfFormat}.
|
||||
The LRF file format is documented at
|
||||
http://www.sven.de/librie/Librie/LrfFormat.
|
||||
"""
|
||||
|
||||
from ebook_converter.ebooks.lrf.pylrs.pylrs import Book as _Book
|
||||
from ebook_converter.ebooks.lrf.pylrs.pylrs import TextBlock, Header, \
|
||||
TextStyle, BlockStyle
|
||||
from ebook_converter.ebooks.lrf.fonts import FONT_FILE_MAP
|
||||
from ebook_converter.ebooks import ConversionError
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
__docformat__ = "epytext"
|
||||
|
||||
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
"""
|
||||
Default fonts used in the PRS500
|
||||
"""
|
||||
from PIL import ImageFont
|
||||
|
||||
from ebook_converter.utils.fonts.scanner import font_scanner
|
||||
|
||||
'''
|
||||
Default fonts used in the PRS500
|
||||
'''
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
LIBERATION_FONT_MAP = {'Swis721 BT Roman': 'Liberation Sans Regular',
|
||||
'Dutch801 Rm BT Roman': 'Liberation Serif Regular',
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
import re
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
import re
|
||||
|
||||
NAME_MAP = {
|
||||
'aliceblue': '#F0F8FF',
|
||||
'antiquewhite': '#FAEBD7',
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
# vim:fileencoding=utf-8
|
||||
# License: GPLv3 Copyright: 2008, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
"""
|
||||
Code to convert HTML ebooks into LRF ebooks.
|
||||
|
||||
I am indebted to esperanc for the initial CSS->Xylog Style conversion code
|
||||
and to Falstaff for pylrs.
|
||||
|
||||
License: GPLv3 Copyright: 2008, Kovid Goyal <kovid at kovidgoyal.net>
|
||||
"""
|
||||
import copy
|
||||
import glob
|
||||
import os
|
||||
@@ -35,13 +39,6 @@ from ebook_converter.ptempfile import PersistentTemporaryFile
|
||||
from ebook_converter.polyglot.builtins import getcwd, itervalues, string_or_bytes, unicode_type
|
||||
from ebook_converter.polyglot.urllib import unquote, urlparse
|
||||
|
||||
"""
|
||||
Code to convert HTML ebooks into LRF ebooks.
|
||||
|
||||
I am indebted to esperanc for the initial CSS->Xylog Style conversion code
|
||||
and to Falstaff for pylrs.
|
||||
"""
|
||||
|
||||
from PIL import Image as PILImage
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
from __future__ import absolute_import, division, print_function, unicode_literals
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
import math, sys, re, numbers
|
||||
|
||||
from ebook_converter.ebooks.lrf.fonts import get_font
|
||||
@@ -11,6 +7,10 @@ from ebook_converter.ebooks.lrf.pylrs.pylrs import TextBlock, Text, CR, Span, \
|
||||
from ebook_converter.polyglot.builtins import string_or_bytes, range, native_string_type
|
||||
|
||||
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2008, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||
|
||||
|
||||
def ceil(num):
|
||||
return int(math.ceil(num))
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user