From 2f5f2a9d335a77abaa97fe34ef86592c3acab5e3 Mon Sep 17 00:00:00 2001
From: Sengian
Date: Mon, 26 Jul 2010 22:43:11 +0200
Subject: [PATCH 01/41] Bug correction: negative values of first line indent
where converted to positive values causing a lot of formatting problems
---
src/calibre/ebooks/rtf2xml/process_tokens.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/calibre/ebooks/rtf2xml/process_tokens.py b/src/calibre/ebooks/rtf2xml/process_tokens.py
index 19a7d38135..9cb7c3c6a4 100755
--- a/src/calibre/ebooks/rtf2xml/process_tokens.py
+++ b/src/calibre/ebooks/rtf2xml/process_tokens.py
@@ -680,7 +680,7 @@ class ProcessTokens:
return the_string
def divide_num(self, numerator, denominator):
try:
- numerator = float(re.search('[0-9.]+', numerator).group())
+ numerator = float(re.search('[0-9.\-]+', numerator).group()) #calibre why ignore negative number? Wrong in case of \fi
except TypeError, msg:
if self.__run_level > 3:
msg = 'no number to process?\n'
From a2702d99c29c2a2eb86c1f957141544f2e11399b Mon Sep 17 00:00:00 2001
From: Sengian
Date: Tue, 27 Jul 2010 19:33:12 +0200
Subject: [PATCH 02/41] Formatting
---
resources/templates/rtf.xsl | 4 ----
src/calibre/ebooks/rtf/input.py | 7 -------
2 files changed, 11 deletions(-)
diff --git a/resources/templates/rtf.xsl b/resources/templates/rtf.xsl
index bf016efaaf..ae054186d4 100644
--- a/resources/templates/rtf.xsl
+++ b/resources/templates/rtf.xsl
@@ -81,7 +81,6 @@
-
@@ -182,14 +181,12 @@
-
-
unnamed
@@ -386,7 +383,6 @@
-
truetruefalse
diff --git a/src/calibre/ebooks/rtf/input.py b/src/calibre/ebooks/rtf/input.py
index 50f5571d58..df74a7b3cb 100644
--- a/src/calibre/ebooks/rtf/input.py
+++ b/src/calibre/ebooks/rtf/input.py
@@ -141,7 +141,6 @@ class RTFInput(InputFormatPlugin):
return name
-
def write_inline_css(self, ic):
font_size_classes = ['span.fs%d { font-size: %spt }'%(i, x) for i, x in
enumerate(ic.font_sizes)]
@@ -152,17 +151,11 @@ class RTFInput(InputFormatPlugin):
text-decoration: none; font-weight: normal;
font-style: normal; font-variant: normal
}
-
span.italics { font-style: italic }
-
span.bold { font-weight: bold }
-
span.small-caps { font-variant: small-caps }
-
span.underlined { text-decoration: underline }
-
span.strike-through { text-decoration: line-through }
-
''')
css += '\n'+'\n'.join(font_size_classes)
css += '\n' +'\n'.join(color_classes)
From 3cf9f7986a174a4404764790800272f2ecdf787d Mon Sep 17 00:00:00 2001
From: Sengian
Date: Wed, 28 Jul 2010 00:47:31 +0200
Subject: [PATCH 03/41] Implementation of a multiple replace class based on
Dict substitutions. Very fast for large dictionnaries.
---
src/calibre/utils/mreplace.py | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
create mode 100644 src/calibre/utils/mreplace.py
diff --git a/src/calibre/utils/mreplace.py b/src/calibre/utils/mreplace.py
new file mode 100644
index 0000000000..dff5fab578
--- /dev/null
+++ b/src/calibre/utils/mreplace.py
@@ -0,0 +1,32 @@
+#multiple replace from dictionnary : http://code.activestate.com/recipes/81330/
+__license__ = 'GPL v3'
+__copyright__ = '2010, sengian '
+__docformat__ = 'restructuredtext en'
+
+import re
+from UserDict import UserDict
+
+class MReplace(UserDict):
+ def __init__(self, dict = None):
+ UserDict.__init__(self, dict)
+ self.re = None
+ self.regex = None
+ self.compile_regex()
+
+ def compile_regex(self):
+ if len(self.data) > 0:
+ keys = sorted(self.data.keys(), key=len)
+ keys.reverse()
+ tmp = "(%s)" % "|".join([re.escape(item) for item in keys])
+ if self.re != tmp:
+ self.re = tmp
+ self.regex = re.compile(self.re)
+
+ def __call__(self, mo):
+ return self[mo.string[mo.start():mo.end()]]
+
+ def mreplace(self, text):
+ #Replace without regex compile
+ if len(self.data) < 1 or self.re is None:
+ return text
+ return self.regex.sub(self, text)
\ No newline at end of file
From 7ebf416513125cee88fc487aa3306a25e4ac6681 Mon Sep 17 00:00:00 2001
From: Sengian
Date: Wed, 28 Jul 2010 00:49:37 +0200
Subject: [PATCH 04/41] Modifications of BIBTEX catalog generation: create a
class for bibtex fonctions, use the new Mreplace fonction as the dictionnary
is very large. Divide by 10 the total execution time.
---
src/calibre/library/catalog.py | 41 ++++++-----
src/calibre/utils/bibtex.py | 125 ++++++++++++++++-----------------
2 files changed, 85 insertions(+), 81 deletions(-)
diff --git a/src/calibre/library/catalog.py b/src/calibre/library/catalog.py
index a540a8a660..5ee0683b87 100644
--- a/src/calibre/library/catalog.py
+++ b/src/calibre/library/catalog.py
@@ -270,10 +270,10 @@ class BIBTEX(CatalogPlugin):
from calibre.library.save_to_disk import preprocess_template
#Bibtex functions
- from calibre.utils.bibtex import bibtex_author_format, utf8ToBibtex, ValidateCitationKey
+ from calibre.utils.bibtex import BibTeX
def create_bibtex_entry(entry, fields, mode, template_citation,
- asccii_bibtex = True, citation_bibtex = True):
+ bibtexdict, citation_bibtex = True):
#Bibtex doesn't like UTF-8 but keep unicode until writing
#Define starting chain or if book valid strict and not book return a Fail string
@@ -289,7 +289,8 @@ class BIBTEX(CatalogPlugin):
if citation_bibtex :
# Citation tag
- bibtex_entry.append(make_bibtex_citation(entry, template_citation, asccii_bibtex))
+ bibtex_entry.append(make_bibtex_citation(entry, template_citation,
+ bibtexdict))
bibtex_entry = [u' '.join(bibtex_entry)]
for field in fields:
@@ -304,11 +305,11 @@ class BIBTEX(CatalogPlugin):
pass
if field == 'authors' :
- bibtex_entry.append(u'author = "%s"' % bibtex_author_format(item))
+ bibtex_entry.append(u'author = "%s"' % bibtexdict.bibtex_author_format(item))
elif field in ['title', 'publisher', 'cover', 'uuid',
'author_sort', 'series'] :
- bibtex_entry.append(u'%s = "%s"' % (field, utf8ToBibtex(item, asccii_bibtex)))
+ bibtex_entry.append(u'%s = "%s"' % (field, bibtexdict.utf8ToBibtex(item)))
elif field == 'id' :
bibtex_entry.append(u'calibreid = "%s"' % int(item))
@@ -321,13 +322,13 @@ class BIBTEX(CatalogPlugin):
elif field == 'tags' :
#A list to flatten
- bibtex_entry.append(u'tags = "%s"' % utf8ToBibtex(u', '.join(item), asccii_bibtex))
+ bibtex_entry.append(u'tags = "%s"' % bibtexdict.utf8ToBibtex(u', '.join(item)))
elif field == 'comments' :
#\n removal
item = item.replace(u'\r\n',u' ')
item = item.replace(u'\n',u' ')
- bibtex_entry.append(u'note = "%s"' % utf8ToBibtex(item, asccii_bibtex))
+ bibtex_entry.append(u'note = "%s"' % bibtexdict.utf8ToBibtex(item))
elif field == 'isbn' :
# Could be 9, 10 or 13 digits
@@ -345,8 +346,7 @@ class BIBTEX(CatalogPlugin):
elif field == 'pubdate' :
bibtex_entry.append(u'year = "%s"' % item.year)
- bibtex_entry.append(u'month = "%s"' % utf8ToBibtex(strftime("%b", item),
- asccii_bibtex))
+ bibtex_entry.append(u'month = "%s"' % bibtexdict.utf8ToBibtex(strftime("%b", item)))
bibtex_entry = u',\n '.join(bibtex_entry)
bibtex_entry += u' }\n\n'
@@ -363,7 +363,7 @@ class BIBTEX(CatalogPlugin):
else :
return True
- def make_bibtex_citation(entry, template_citation, asccii_bibtex):
+ def make_bibtex_citation(entry, template_citation, bibtexclass):
#define a function to replace the template entry by its value
def tpl_replace(objtplname) :
@@ -384,8 +384,9 @@ class BIBTEX(CatalogPlugin):
return u''
if len(template_citation) >0 :
- tpl_citation = utf8ToBibtex(ValidateCitationKey(re.sub(u'\{[^{}]*\}',
- tpl_replace, template_citation)), asccii_bibtex)
+ tpl_citation = bibtexclass.utf8ToBibtex(
+ bibtexclass.ValidateCitationKey(re.sub(u'\{[^{}]*\}',
+ tpl_replace, template_citation)))
if len(tpl_citation) >0 :
return tpl_citation
@@ -397,9 +398,9 @@ class BIBTEX(CatalogPlugin):
template_citation = u'%s' % str(entry["id"])
if asccii_bibtex :
- return ValidateCitationKey(template_citation.encode('ascii', 'replace'))
+ return bibtexclass.ValidateCitationKey(template_citation.encode('ascii', 'replace'))
else :
- return ValidateCitationKey(template_citation)
+ return bibtexclass.ValidateCitationKey(template_citation)
self.fmt = path_to_output.rpartition('.')[2]
self.notification = notification
@@ -467,13 +468,16 @@ class BIBTEX(CatalogPlugin):
if not len(data):
log.error("\nNo matching database entries for search criteria '%s'" % opts.search_text)
+ #Initialize BibTeX class
+ bibtexc = BibTeX()
+
#Entries writing after Bibtex formating (or not)
if bibfile_enc != 'ascii' :
- asccii_bibtex = False
+ bibtexc.ascii_bibtex = False
else :
- asccii_bibtex = True
+ bibtexc.ascii_bibtex = True
- #Check and go to default in case of bad CLI
+ #Check citation choice and go to default in case of bad CLI
if isinstance(opts.impcit, (StringType, UnicodeType)) :
if opts.impcit == 'False' :
citation_bibtex= False
@@ -485,6 +489,7 @@ class BIBTEX(CatalogPlugin):
else :
citation_bibtex= opts.impcit
+ #Preprocess for error and light correction
template_citation = preprocess_template(opts.bib_cit)
#Open output and write entries
@@ -506,7 +511,7 @@ class BIBTEX(CatalogPlugin):
for entry in data:
outfile.write(create_bibtex_entry(entry, fields, bib_entry, template_citation,
- asccii_bibtex, citation_bibtex))
+ bibtexc, citation_bibtex))
outfile.close()
diff --git a/src/calibre/utils/bibtex.py b/src/calibre/utils/bibtex.py
index f6e596e8f0..5b9193d16d 100644
--- a/src/calibre/utils/bibtex.py
+++ b/src/calibre/utils/bibtex.py
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
""" Collection of python utility-methodes commonly used by other
bibliograph packages.
From http://pypi.python.org/pypi/bibliograph.core/
@@ -62,10 +60,14 @@
DAMAGE.
"""
-__docformat__ = 'reStructuredText'
__author__ = 'sengian '
+__docformat__ = 'restructuredtext en'
import re, string
+from UserDict import UserDict
+
+from calibre.constants import preferred_encoding
+from calibre.utils.mreplace import MReplace
utf8enc2latex_mapping = {
# This is a mapping of Unicode characters to LaTeX equivalents.
@@ -2842,69 +2844,66 @@ entity_mapping = {
'"':'{"}',
}
-def ValidateCitationKey(text):
- """
- removes characters not allowed in BibTeX keys
+class BibTeX:
+ def __init__(self):
+ self.rep_utf8 = MReplace(utf8enc2latex_mapping)
+ self.rep_ent = MReplace(entity_mapping)
+ #Set default conversion to ASCII BibTeX
+ self.ascii_bibtex = True
+ # This substitution is based on the description of cite key restrictions at
+ # http://bibdesk.sourceforge.net/manual/BibDesk%20Help_2.html
+ self.invalid_cit = re.compile(u'[ "@\',\\#}{~%&$^]')
+ self.upper = re.compile(u'[' +
+ string.uppercase.decode(preferred_encoding) + u']')
+ self.escape = re.compile(u'[~#&%_]')
+
+ def ValidateCitationKey(self, text):
+ """
+ removes characters not allowed in BibTeX keys
+ >>> ValidateCitationKey(DummyEntry('my@id'))
+ 'myid'
+ """
+ return self.invalid_cit.sub(u'', text)
- >>> from bibliograph.core.utils import _validKey
- >>> _validKey(DummyEntry('Foo Bar'))
- 'FooBar'
+ def braceUppercase(self, text):
+ """ Convert uppercase letters to bibtex encoded uppercase
+ >>> braceUppercase('Foo Bar')
+ '{F}oo {B}ar'
+ """
+ return self.upper.sub(lambda m: u'{%s}' % m.group(), text)
- >>> _validKey(DummyEntry('my@id'))
- 'myid'
+ def resolveEntities(self, text):
+ #for entity, entity_map in entity_mapping.iteritems():
+ # text = text.replace(entity, entity_map)
+ #return text
+ return self.rep_ent.mreplace(text)
- """
- # This substitution is based on the description of cite key restrictions at
- # http://bibdesk.sourceforge.net/manual/BibDesk%20Help_2.html
- return re.sub(u'[ "@\',\\#}{~%&$^]', u'', text)
+ def resolveUnicode(self, text):
+ #UTF-8 text as entry
+ #for unichar, latexenc in utf8enc2latex_mapping.iteritems() :
+ # text = text.replace(unichar, latexenc)
+ text = self.rep_utf8.mreplace(text)
+ return text.replace(u'$}{$', u'')
-def BraceUppercase(text):
- """ Convert uppercase letters to bibtex encoded uppercase
+ def escapeSpecialCharacters(self, text):
+ """
+ latex escaping some (not all) special characters
+ """
+ text.replace('\\', '\\\\')
+ return self.escape.sub(lambda m: u'\\%s' % m.group(), text)
- >>> from bibliograph.core.utils import _braceUppercase
- >>> _braceUppercase('foo bar')
- 'foo bar'
+ #Calibre functions
+ #Option to go to official ASCII Bibtex or unofficial UTF-8
+ #Go from an unicode entry to ASCII Bibtex format without encoding
+ def utf8ToBibtex(self, text):
+ if len(text) == 0:
+ return ''
+ text.replace('\\', '\\\\')
+ text = self.resolveEntities(text)
+ if self.ascii_bibtex :
+ text = self.resolveUnicode(text)
+ return self.escapeSpecialCharacters(text)
- >>> _braceUppercase('Foo Bar')
- '{F}oo {B}ar'
- """
- for uc in string.uppercase:
- text = text.replace(uc, u'{%s}' % uc)
- return text
-
-def resolveEntities(text):
- for entity, entity_map in entity_mapping.iteritems():
- text = text.replace(entity, entity_map)
- return text
-
-def resolveUnicode(text):
- #UTF-8 text as entry
- for unichar, latexenc in utf8enc2latex_mapping.iteritems() :
- text = text.replace(unichar, latexenc)
- return text.replace(u'$}{$', u'')
-
-def escapeSpecialCharacters(text):
- """
- latex escaping some (not all) special characters
- """
- text.replace('\\', '\\\\')
- escape = ['~', '#', '&', '%', '_']
- for c in escape:
- text = text.replace(c, '\\' + c )
- return text
-
-#Calibre functions
-#Go from an unicode entry to ASCII Bibtex format without encoding
-#Option to go to official ASCII Bibtex or unofficial UTF-8
-def utf8ToBibtex(text, asccii_bibtex = True):
- if len(text) == 0:
- return ''
- text.replace('\\', '\\\\')
- text = resolveEntities(text)
- if asccii_bibtex :
- text = resolveUnicode(text)
- return escapeSpecialCharacters(text)
-
-def bibtex_author_format(item):
- #Format authors for Bibtex compliance (get a list as input)
- return utf8ToBibtex(u' and'.join([author for author in item]))
+ def bibtex_author_format(self, item):
+ #Format authors for Bibtex compliance (get a list as input)
+ return self.utf8ToBibtex(u' and'.join([author for author in item]))
From 8512f57866262b66f4cd542ac96cccf2b9c05737 Mon Sep 17 00:00:00 2001
From: Sengian
Date: Wed, 28 Jul 2010 23:08:02 +0200
Subject: [PATCH 05/41] Check if RTF is asccii early. Will be effactive after
preprocess integration in rtf2xml.
---
src/calibre/ebooks/rtf2xml/ParseRtf.py | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/src/calibre/ebooks/rtf2xml/ParseRtf.py b/src/calibre/ebooks/rtf2xml/ParseRtf.py
index 7b89407f79..f494b7a9c1 100755
--- a/src/calibre/ebooks/rtf2xml/ParseRtf.py
+++ b/src/calibre/ebooks/rtf2xml/ParseRtf.py
@@ -17,7 +17,8 @@
#########################################################################
# $Revision: 1.41 $
# $Date: 2006/03/24 23:50:07 $
-import sys,os
+import sys, os, codecs
+
from calibre.ebooks.rtf2xml import headings_to_sections, \
line_endings, footnote, fields_small, default_encoding, \
make_lists, preamble_div, header, colors, group_borders, \
@@ -90,7 +91,6 @@ class ParseRtf:
out_file = '',
out_dir = None,
dtd = '',
- #debug = 0, #why? calibre
deb_dir = None,
convert_symbol = None,
convert_wingdings = None,
@@ -107,6 +107,7 @@ class ParseRtf:
no_dtd = 0,
char_data = '',
):
+
"""
Requires:
'file' --file to parse
@@ -125,14 +126,16 @@ class ParseRtf:
through a file. Only for debugging.
Returns: Nothing
"""
+
self.__file = in_file
self.__out_file = out_file
self.__out_dir = out_dir
self.__temp_dir = out_dir
self.__dtd_path = dtd
self.__check_file(in_file,"file_to_parse")
+ self.__check_ascii(in_file)
self.__char_data = char_data
- self.__debug_dir = deb_dir #self.__debug_dir = debug calibre
+ self.__debug_dir = deb_dir
self.__check_dir(self.__temp_dir)
self.__copy = self.__check_dir(self.__debug_dir)
self.__convert_caps = convert_caps
@@ -149,19 +152,17 @@ class ParseRtf:
self.__group_borders = group_borders
self.__empty_paragraphs = empty_paragraphs
self.__no_dtd = no_dtd
-
def __check_file(self, the_file, type):
"""Check to see if files exist"""
if hasattr(the_file, 'read'): return
if the_file == None:
if type == "file_to_parse":
- message = "You must provide a file for the script to work"
- msg = message
+ msg = "\nYou must provide a file for the script to work"
raise RtfInvalidCodeException, msg
elif os.path.exists(the_file):
pass # do nothing
else:
- message = "The file '%s' cannot be found" % the_file
+ message = "\nThe file '%s' cannot be found" % the_file
msg = message
raise RtfInvalidCodeException, msg
def __check_dir(self, the_dir):
@@ -170,7 +171,16 @@ class ParseRtf:
return
dir_exists = os.path.isdir(the_dir)
if not dir_exists:
- message = "%s is not a directory" % the_dir
+ msg = "\n%s is not a directory" % the_dir
+ raise RtfInvalidCodeException, msg
+ return 1
+ def __check_ascii(self, the_file):
+ """Check to see if the file is correct ascii"""
+ try:
+ test = codecs.open(the_file, 'r', 'ascii', 'strict')
+ test.close()
+ except UnicodeError:
+ message= "\n%s is not a correct ascii file" % the_file
msg = message
raise RtfInvalidCodeException, msg
return 1
From 09c8f13a1f17c869d06ace0d6cf76f0ff9b3fdc7 Mon Sep 17 00:00:00 2001
From: Sengian
Date: Sat, 31 Jul 2010 10:47:12 +0200
Subject: [PATCH 06/41] Global overhaul of rtf2xml : RTF fixes (1)
---
src/calibre/ebooks/rtf/input.py | 1 +
src/calibre/ebooks/rtf2xml/ParseRtf.py | 53 ++++++++------------
src/calibre/ebooks/rtf2xml/check_brackets.py | 10 ++--
src/calibre/ebooks/rtf2xml/line_endings.py | 52 ++++++++-----------
src/calibre/ebooks/rtf2xml/process_tokens.py | 2 -
src/calibre/ebooks/rtf2xml/tokenize.py | 6 +--
src/calibre/ebooks/txt/processor.py | 5 +-
7 files changed, 52 insertions(+), 77 deletions(-)
diff --git a/src/calibre/ebooks/rtf/input.py b/src/calibre/ebooks/rtf/input.py
index df74a7b3cb..2622d82d99 100644
--- a/src/calibre/ebooks/rtf/input.py
+++ b/src/calibre/ebooks/rtf/input.py
@@ -50,6 +50,7 @@ class RTFInput(InputFormatPlugin):
parser = ParseRtf(
in_file = stream,
out_file = ofile,
+ #deb_dir = 'I:\\Calibre\\rtfdebug',
# Convert symbol fonts to unicode equivalents. Default
# is 1
convert_symbol = 1,
diff --git a/src/calibre/ebooks/rtf2xml/ParseRtf.py b/src/calibre/ebooks/rtf2xml/ParseRtf.py
index f494b7a9c1..3a804792c5 100755
--- a/src/calibre/ebooks/rtf2xml/ParseRtf.py
+++ b/src/calibre/ebooks/rtf2xml/ParseRtf.py
@@ -143,7 +143,7 @@ class ParseRtf:
self.__convert_wingdings = convert_wingdings
self.__convert_zapf = convert_zapf
self.__run_level = run_level
- self.__exit_level = 0
+ #self.__exit_level = 0
self.__indent = indent
self.__replace_illegals = replace_illegals
self.__form_lists = form_lists
@@ -162,8 +162,7 @@ class ParseRtf:
elif os.path.exists(the_file):
pass # do nothing
else:
- message = "\nThe file '%s' cannot be found" % the_file
- msg = message
+ msg = "\nThe file '%s' cannot be found" % the_file
raise RtfInvalidCodeException, msg
def __check_dir(self, the_dir):
"""Check to see if directory exists"""
@@ -180,8 +179,7 @@ class ParseRtf:
test = codecs.open(the_file, 'r', 'ascii', 'strict')
test.close()
except UnicodeError:
- message= "\n%s is not a correct ascii file" % the_file
- msg = message
+ msg = "\n%s is not a correct ascii file" % the_file
raise RtfInvalidCodeException, msg
return 1
def parse_rtf(self):
@@ -204,27 +202,29 @@ class ParseRtf:
copy_obj.set_dir(self.__debug_dir)
copy_obj.remove_files()
copy_obj.copy_file(self.__temp_file, "original_file")
- # new as of 2005-08-02. Do I want this?
+ # Function to check if bracket are well handled
if self.__debug_dir or self.__run_level > 2:
self.__check_brack_obj = check_brackets.CheckBrackets\
(file = self.__temp_file,
bug_handler = RtfInvalidCodeException,
)
- # convert Macintosh line endings to Unix line endings
+ # convert Macintosh and Windows line endings to Unix line endings
+ #why do this if you don't wb after?
line_obj = line_endings.FixLineEndings(
in_file = self.__temp_file,
bug_handler = RtfInvalidCodeException,
copy = self.__copy,
- run_level = self.__run_level,
+ #run_level = self.__run_level,
replace_illegals = self.__replace_illegals,
)
- return_value = line_obj.fix_endings()
- self.__return_code(return_value)
+ line_obj.fix_endings()
+ #return_value = line_obj.fix_endings() #calibre: no return in this function, why keep it?
+ #self.__return_code(return_value)
tokenize_obj = tokenize.Tokenize(
bug_handler = RtfInvalidCodeException,
in_file = self.__temp_file,
- copy = self.__copy,
- run_level = self.__run_level,)
+ copy = self.__copy,)
+ #run_level = self.__run_level,)
tokenize_obj.tokenize()
process_tokens_obj = process_tokens.ProcessTokens(
in_file = self.__temp_file,
@@ -529,36 +529,27 @@ class ParseRtf:
)
output_obj.output()
os.remove(self.__temp_file)
- return self.__exit_level
+ #return self.__exit_level
def __bracket_match(self, file_name):
if self.__run_level > 2:
good_br, msg = self.__check_brack_obj.check_brackets()
if good_br:
pass
- # sys.stderr.write( msg + ' in ' + file_name + "\n")
+ #sys.stderr.write( msg + ' in ' + file_name + "\n")
else:
msg += msg + " in file '" + file_name + "'\n"
raise RtfInvalidCodeException, msg
- def __return_code(self, num):
- if num == None:
- return
- if int(num) > self.__exit_level:
- self.__exit_level = num
+ #def __return_code(self, num): calibre not used
+ # if num == None:
+ # return
+ # if int(num) > self.__exit_level:
+ # self.__exit_level = num
def __make_temp_file(self,file):
"""Make a temporary file to parse"""
write_file="rtf_write_file"
read_obj = file if hasattr(file, 'read') else open(file,'r')
write_obj = open(write_file, 'w')
- line = "dummy"
- while line:
- line = read_obj.read(1000)
- write_obj.write(line )
+ for line in read_obj:
+ write_obj.write(line)
write_obj.close()
- return write_file
- """
-mi1\n
-mi33\n
-mi 0:
length_byte = len(txt.encode('utf-8'))
From 3405615e54da2f2aa7345d1f51525acd250cbd91 Mon Sep 17 00:00:00 2001
From: Sengian
Date: Sat, 31 Jul 2010 13:15:47 +0200
Subject: [PATCH 07/41] Remove invalid ASCII characters from plain text files
---
src/calibre/ebooks/txt/input.py | 3 ++-
src/calibre/ebooks/txt/processor.py | 25 +++++++++++++++----------
2 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/src/calibre/ebooks/txt/input.py b/src/calibre/ebooks/txt/input.py
index b444bf1cf4..935a187d5d 100644
--- a/src/calibre/ebooks/txt/input.py
+++ b/src/calibre/ebooks/txt/input.py
@@ -57,6 +57,7 @@ class TXTInput(InputFormatPlugin):
txt = preserve_spaces(txt)
txt = _ent_pat.sub(xml_entity_to_unicode, txt)
+ txt = txt.encode('utf-8')
if options.markdown:
log.debug('Running text though markdown conversion...')
@@ -79,7 +80,7 @@ class TXTInput(InputFormatPlugin):
base = os.path.dirname(stream.name)
htmlfile = open(os.path.join(base, 'temp_calibre_txt_input_to_html.html'),
'wb')
- htmlfile.write(html.encode('utf-8'))
+ htmlfile.write(html) #html.encode('utf-8')
htmlfile.close()
cwd = os.getcwdu()
odi = options.debug_pipeline
diff --git a/src/calibre/ebooks/txt/processor.py b/src/calibre/ebooks/txt/processor.py
index 91c274a7b1..6bd635b6df 100644
--- a/src/calibre/ebooks/txt/processor.py
+++ b/src/calibre/ebooks/txt/processor.py
@@ -19,7 +19,7 @@ HTML_TEMPLATE = u'
]
-
+
@@ -294,7 +294,7 @@
-
+
From 1f237c99bfe5bb875f4dc384b4b80938967d7ae9 Mon Sep 17 00:00:00 2001
From: Sengian
Date: Sat, 31 Jul 2010 20:01:54 +0200
Subject: [PATCH 10/41] Change in the convert to bibtex reference for euro
symbol
---
src/calibre/utils/bibtex.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/calibre/utils/bibtex.py b/src/calibre/utils/bibtex.py
index 5b9193d16d..09868ccdb1 100644
--- a/src/calibre/utils/bibtex.py
+++ b/src/calibre/utils/bibtex.py
@@ -80,7 +80,7 @@ utf8enc2latex_mapping = {
#Fix some encoding problem between cp1252 and latin1
# from http://www.microsoft.com/typography/unicode/1252.htm
- u'\x80': '{\\mbox{\\texteuro}}', # EURO SIGN
+ u'\x80': '{\\texteuro}', # EURO SIGN
u'\x82': '{,}', # SINGLE LOW-9 QUOTATION MARK
u'\x83': '$f$', # LATIN SMALL LETTER F WITH HOOK
u'\x84': '{,,}', # DOUBLE LOW-9 QUOTATION MARK
@@ -746,7 +746,7 @@ utf8enc2latex_mapping = {
u'\u205f': '{\\mkern4mu}',
u'\u2060': '{\\nolinebreak}',
u'\u20a7': '{\\ensuremath{\\Elzpes}}',
- u'\u20ac': '{\\mbox{\\texteuro}}',
+ u'\u20ac': '{\\texteuro}',
u'\u20db': '$\\dddot$',
u'\u20dc': '$\\ddddot$',
u'\u2102': '$\\mathbb{C}$',
From 2eb20249319e551f41d4d721c831e3e64abaf72c Mon Sep 17 00:00:00 2001
From: Sengian
Date: Tue, 10 Aug 2010 12:38:59 +0200
Subject: [PATCH 11/41] Merge from trunk
---
resources/catalog/stylesheet.css | 142 +++----
resources/content_server/gui.css | 163 ++++----
resources/content_server/index.html | 103 ++---
resources/content_server/mobile.css | 91 ++---
resources/templates/html.css | 361 ++++++++---------
setup/installer/windows/en-us.xml | 19 +-
setup/installer/windows/wix-template.xml | 267 ++++++-------
src/calibre/ebooks/lrf/html/demo/demo.html | 440 +++++++++++++--------
src/calibre/manual/templates/layout.html | 24 +-
src/calibre/manual/xpath.xhtml | 30 +-
10 files changed, 871 insertions(+), 769 deletions(-)
diff --git a/resources/catalog/stylesheet.css b/resources/catalog/stylesheet.css
index 4f9ca9ac41..ea01aeb43b 100644
--- a/resources/catalog/stylesheet.css
+++ b/resources/catalog/stylesheet.css
@@ -1,102 +1,104 @@
-body { background-color: white; }
+body {
+ background-color: white;
+}
-p.title {
- margin-top:0em;
- margin-bottom:1em;
- text-align:center;
- font-style:italic;
- font-size:xx-large;
- border-bottom: solid black 4px;
- }
+p.title {
+ margin-top: 0em;
+ margin-bottom: 1em;
+ text-align: center;
+ font-style: italic;
+ font-size: xx-large;
+ border-bottom: solid black 4px;
+}
p.author {
- margin-top:0em;
- margin-bottom:0em;
+ margin-top: 0em;
+ margin-bottom: 0em;
text-align: left;
text-indent: 1em;
- font-size:large;
- }
+ font-size: large;
+}
p.tags {
- margin-top:0em;
- margin-bottom:0em;
+ margin-top: 0em;
+ margin-bottom: 0em;
text-align: left;
text-indent: 1em;
- font-size:small;
- }
+ font-size: small;
+}
p.description {
- text-align:left;
- font-style:normal;
+ text-align: left;
+ font-style: normal;
margin-top: 0em;
- }
+}
p.date_index {
- font-size:x-large;
- text-align:center;
- font-weight:bold;
- margin-top:1em;
- margin-bottom:0px;
- }
+ font-size: x-large;
+ text-align: center;
+ font-weight: bold;
+ margin-top: 1em;
+ margin-bottom: 0px;
+}
p.letter_index {
- font-size:x-large;
- text-align:center;
- font-weight:bold;
- margin-top:1em;
- margin-bottom:0px;
- }
+ font-size: x-large;
+ text-align: center;
+ font-weight: bold;
+ margin-top: 1em;
+ margin-bottom: 0px;
+}
p.author_index {
- font-size:large;
- text-align:left;
- margin-top:0px;
- margin-bottom:0px;
+ font-size: large;
+ text-align: left;
+ margin-top: 0px;
+ margin-bottom: 0px;
text-indent: 0em;
- }
+}
p.series {
text-align: left;
- margin-top:0px;
- margin-bottom:0px;
- margin-left:2em;
- text-indent:-2em;
- }
+ margin-top: 0px;
+ margin-bottom: 0px;
+ margin-left: 2em;
+ text-indent: -2em;
+}
p.read_book {
- text-align:left;
- margin-top:0px;
- margin-bottom:0px;
- margin-left:2em;
- text-indent:-2em;
- }
+ text-align: left;
+ margin-top: 0px;
+ margin-bottom: 0px;
+ margin-left: 2em;
+ text-indent: -2em;
+}
p.unread_book {
- text-align:left;
- margin-top:0px;
- margin-bottom:0px;
- margin-left:2em;
- text-indent:-2em;
- }
+ text-align: left;
+ margin-top: 0px;
+ margin-bottom: 0px;
+ margin-left: 2em;
+ text-indent: -2em;
+}
p.date_read {
- text-align:left;
- margin-top:0px;
- margin-bottom:0px;
- margin-left:6em;
- text-indent:-6em;
- }
+ text-align: left;
+ margin-top: 0px;
+ margin-bottom: 0px;
+ margin-left: 6em;
+ text-indent: -6em;
+}
hr.series_divider {
- width:50%;
- margin-left:1em;
- margin-top:0em;
- margin-bottom:0em;
- }
+ width: 50%;
+ margin-left: 1em;
+ margin-top: 0em;
+ margin-bottom: 0em;
+}
hr.annotations_divider {
- width:50%;
- margin-left:1em;
- margin-top:0em;
- margin-bottom:0em;
- }
+ width: 50%;
+ margin-left: 1em;
+ margin-top: 0em;
+ margin-bottom: 0em;
+}
\ No newline at end of file
diff --git a/resources/content_server/gui.css b/resources/content_server/gui.css
index 1bcc4e1eb0..d7a3eda51e 100644
--- a/resources/content_server/gui.css
+++ b/resources/content_server/gui.css
@@ -1,142 +1,157 @@
body {
- background-color: white;
+ background-color: white;
}
#banner {
- position: absolute;
- left: 5px; top: 0px;
+ position: absolute;
+ left: 5px;
+ top: 0px;
}
/*
Search bar
*/
#search_box {
- width: 201px;
- height: 31px;
- background: url(bg_search_box.png);
- top: 5px; right: 20px;
- position: absolute;
+ width: 201px;
+ height: 31px;
+ background: url(bg_search_box.png);
+ top: 5px;
+ right: 20px;
+ position: absolute;
}
+
#search_box #s {
- float: left;
- padding: 0;
- margin: 6px 0 0 6px;
- border-width: 0px;
- font-size: 16px;
- width: 159px;
- background: transparent;
+ float: left;
+ padding: 0;
+ margin: 6px 0 0 6px;
+ border-width: 0px;
+ font-size: 16px;
+ width: 159px;
+ background: transparent;
}
+
#search_box #go {
- float: right;
- margin: 3px 4px 0 0;
+ float: right;
+ margin: 3px 4px 0 0;
}
/*
Count bar
*/
#count_bar {
- position: absolute;
- right: 30px;
- top: 80px;
- font-size:smaller;
- padding-bottom: 5px;
+ position: absolute;
+ right: 30px;
+ top: 80px;
+ font-size: smaller;
+ padding-bottom: 5px;
}
#count_bar * img {
- cursor: pointer;
+ cursor: pointer;
}
-#count { cursor: default;}
+#count {
+ cursor: default;
+}
/*
Styles for the book list
*/
#main {
- width:95%;
- overflow: auto;
- border: solid thin black;
- position: absolute;
- top: 115px; left: 10px;
- z-index: 1;
+ width: 95%;
+ overflow: auto;
+ border: solid thin black;
+ position: absolute;
+ top: 115px;
+ left: 10px;
+ z-index: 1;
}
table#book_list thead tr td {
- width: 100%;
- padding-right: 1em; padding-left: 1em;
- text-align: center;
- font-weight: bold;
- font-size: 130%;
- border-bottom: thick solid black;
- border-top: thick solid black;
- cursor: pointer;
- font-family: serif;
- padding-top: 0.5ex; padding-bottom: 0.5ex;
+ width: 100%;
+ padding-right: 1em;
+ padding-left: 1em;
+ text-align: center;
+ font-weight: bold;
+ font-size: 130%;
+ border-bottom: thick solid black;
+ border-top: thick solid black;
+ cursor: pointer;
+ font-family: serif;
+ padding-top: 0.5ex;
+ padding-bottom: 0.5ex;
}
table#book_list tbody tr td {
- padding-right: 1em; padding-left: 1em;
- /*border-bottom: thin solid black;*/
- padding-bottom: 0.7ex; padding-top: 0.7ex;
- margin: 0pt;
- cursor: pointer;
-
+ padding-right: 1em;
+ padding-left: 1em;
+ /*border-bottom: thin solid black;*/
+ padding-bottom: 0.7ex;
+ padding-top: 0.7ex;
+ margin: 0pt;
+ cursor: pointer;
}
table#book_list * .sort_indicator {
- visibility:hidden;
- color: #9f9f9f;
+ visibility: hidden;
+ color: #9f9f9f;
}
table#book_list * .rating {
- color: #3fbbe4;
+ color: #3fbbe4;
}
table#book_list * span.subtitle {
- font-size: smaller;
+ font-size: smaller;
}
table#book_list * a.format {
- text-decoration: none;
- color: blue;
- font-family: monospace;
+ text-decoration: none;
+ color: blue;
+ font-family: monospace;
}
table#book_list * a.format:hover {
- color: red;
+ color: red;
}
table#book_list * a.format:visited {
- color: blue;
+ color: blue;
}
table#book_list * .comments {
- font-size: smaller;
- display: none;
+ font-size: smaller;
+ display: none;
}
+
/*
Loading message
*/
#loading {
- top: 10px; left: 10px;
- position: absolute;
- font-size: 160%; font-family: monospace;
- text-align: center;
- visibility: hidden;
- z-index: 10000;
- background-color: #aaaaaa;
- opacity: 0.8;
-
+ top: 10px;
+ left: 10px;
+ position: absolute;
+ font-size: 160%;
+ font-family: monospace;
+ text-align: center;
+ visibility: hidden;
+ z-index: 10000;
+ background-color: #aaaaaa;
+ opacity: 0.8;
}
#loading div {
- top: 50%; position: relative;
+ top: 50%;
+ position: relative;
}
#cover_pane {
- overflow: auto;
- position: absolute;
- visibility: hidden;
- text-align: right;
- z-index: 2;
- margin: 0pt; padding: 0pt; border-width: 0pt;
-}
+ overflow: auto;
+ position: absolute;
+ visibility: hidden;
+ text-align: right;
+ z-index: 2;
+ margin: 0pt;
+ padding: 0pt;
+ border-width: 0pt;
+}
\ No newline at end of file
diff --git a/resources/content_server/index.html b/resources/content_server/index.html
index f9f0aff491..ff11acc719 100644
--- a/resources/content_server/index.html
+++ b/resources/content_server/index.html
@@ -1,49 +1,60 @@
-
-
- calibre library
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Loading…
-
-
-
-
-
-
-
+
+
+calibre library
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Loading…
+
+
+
+
+
diff --git a/resources/content_server/mobile.css b/resources/content_server/mobile.css
index 9be755b954..e3a4b58422 100644
--- a/resources/content_server/mobile.css
+++ b/resources/content_server/mobile.css
@@ -1,83 +1,78 @@
/* CSS for the mobile version of the content server webpage */
-
.navigation table.buttons {
- width: 100%;
+ width: 100%;
}
.navigation .button {
- width: 50%;
+ width: 50%;
}
-.button a, .button:visited a {
- padding: 0.5em;
- font-size: 1.25em;
- border: 1px solid black;
- text-color: black;
- background-color: #ddd;
- border-top: 1px solid ThreeDLightShadow;
- border-right: 1px solid ButtonShadow;
- border-bottom: 1px solid ButtonShadow;
- border-left: 1 px solid ThreeDLightShadow;
- -moz-border-radius: 0.25em;
- -webkit-border-radius: 0.25em;
+.button a,.button:visited a {
+ padding: 0.5em;
+ font-size: 1.25em;
+ border: 1px solid black;
+ text-color: black;
+ background-color: #ddd;
+ border-top: 1px solid ThreeDLightShadow;
+ border-right: 1px solid ButtonShadow;
+ border-bottom: 1px solid ButtonShadow;
+ border-left: 1 px solid ThreeDLightShadow;
+ -moz-border-radius: 0.25em;
+ -webkit-border-radius: 0.25em;
}
.button:hover a {
- border-top: 1px solid #666;
- border-right: 1px solid #CCC;
- border-bottom: 1 px solid #CCC;
- border-left: 1 px solid #666;
-
-
+ border-top: 1px solid #666;
+ border-right: 1px solid #CCC;
+ border-bottom: 1 px solid #CCC;
+ border-left: 1 px solid #666;
}
div.navigation {
- padding-bottom: 1em;
- clear: both;
+ padding-bottom: 1em;
+ clear: both;
}
#search_box {
- border: 1px solid #393;
- -moz-border-radius: 0.5em;
- -webkit-border-radius: 0.5em;
- padding: 1em;
- margin-bottom: 0.5em;
- float: right;
+ border: 1px solid #393;
+ -moz-border-radius: 0.5em;
+ -webkit-border-radius: 0.5em;
+ padding: 1em;
+ margin-bottom: 0.5em;
+ float: right;
}
#listing {
- width: 100%;
- border-collapse: collapse;
+ width: 100%;
+ border-collapse: collapse;
}
+
#listing td {
- padding: 0.25em;
+ padding: 0.25em;
}
#listing td.thumbnail {
- height: 60px;
- width: 60px;
+ height: 60px;
+ width: 60px;
}
#listing tr:nth-child(even) {
-
- background: #eee;
+ background: #eee;
}
-#listing .button a{
- display: inline-block;
- width: 2.5em;
- padding-left: 0em;
- padding-right: 0em;
- overflow: hidden;
- text-align: center;
+#listing .button a {
+ display: inline-block;
+ width: 2.5em;
+ padding-left: 0em;
+ padding-right: 0em;
+ overflow: hidden;
+ text-align: center;
}
#logo {
- float: left;
+ float: left;
}
#spacer {
- clear: both;
-}
-
-
+ clear: both;
+}
\ No newline at end of file
diff --git a/resources/templates/html.css b/resources/templates/html.css
index e9b683ca34..448ec596b9 100644
--- a/resources/templates/html.css
+++ b/resources/templates/html.css
@@ -34,380 +34,367 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
+@
+namespace url (http: //www.w3.org /1999/xhtml);
+ @namespace svg url (http: //www.w3.org /2000/svg);
+ /* blocks */
-@namespace url(http://www.w3.org/1999/xhtml);
-@namespace svg url(http://www.w3.org/2000/svg);
-
-/* blocks */
-
-html, div, map, dt, isindex, form {
- display: block;
+html,div,map,dt,isindex,form {
+ display: block;
}
body {
- display: block;
+ display: block;
}
-p, dl, multicol {
- display: block;
- margin: 1em 0;
+p,dl,multicol {
+ display: block;
+ margin: 1em 0;
}
dd {
- display: block;
- margin-left: 40px;
+ display: block;
+ margin-left: 40px;
}
blockquote {
- display: block;
- margin: 1em;
+ display: block;
+ margin: 1em;
}
address {
- display: block;
- font-style: italic;
+ display: block;
+ font-style: italic;
}
center {
- display: block;
- text-align: center;
+ display: block;
+ text-align: center;
}
blockquote[type=cite] {
- display: block;
- margin: 1em 0em;
- border-color: blue;
- border-width: thin;
+ display: block;
+ margin: 1em 0em;
+ border-color: blue;
+ border-width: thin;
}
span[_moz_quote=true] {
- color: blue;
+ color: blue;
}
pre[_moz_quote=true] {
- color: blue;
+ color: blue;
}
h1 {
- display: block;
- font-size: 2em;
- font-weight: bold;
- margin: .67em 0;
+ display: block;
+ font-size: 2em;
+ font-weight: bold;
+ margin: .67em 0;
}
h2 {
- display: block;
- font-size: 1.5em;
- font-weight: bold;
- margin: .83em 0;
+ display: block;
+ font-size: 1.5em;
+ font-weight: bold;
+ margin: .83em 0;
}
h3 {
- display: block;
- font-size: 1.17em;
- font-weight: bold;
- margin: 1em 0;
+ display: block;
+ font-size: 1.17em;
+ font-weight: bold;
+ margin: 1em 0;
}
h4 {
- display: block;
- font-weight: bold;
- margin: 1.33em 0;
+ display: block;
+ font-weight: bold;
+ margin: 1.33em 0;
}
h5 {
- display: block;
- font-size: 0.83em;
- font-weight: bold;
- margin: 1.67em 0;
+ display: block;
+ font-size: 0.83em;
+ font-weight: bold;
+ margin: 1.67em 0;
}
h6 {
- display: block;
- font-size: 0.67em;
- font-weight: bold;
- margin: 2.33em 0;
+ display: block;
+ font-size: 0.67em;
+ font-weight: bold;
+ margin: 2.33em 0;
}
listing {
- display: block;
- font-family: monospace;
- font-size: medium;
- white-space: pre;
- margin: 1em 0;
+ display: block;
+ font-family: monospace;
+ font-size: medium;
+ white-space: pre;
+ margin: 1em 0;
}
-xmp, pre, plaintext {
- display: block;
- font-family: monospace;
- white-space: pre;
- margin: 1em 0;
+xmp,pre,plaintext {
+ display: block;
+ font-family: monospace;
+ white-space: pre;
+ margin: 1em 0;
}
/* tables */
-
table {
- display: table;
- border-spacing: 2px;
- border-collapse: separate;
- margin-top: 0;
- margin-bottom: 0;
- text-indent: 0;
+ display: table;
+ border-spacing: 2px;
+ border-collapse: separate;
+ margin-top: 0;
+ margin-bottom: 0;
+ text-indent: 0;
}
table[align="left"] {
- float: left;
+ float: left;
}
table[align="right"] {
- float: right;
+ float: right;
}
-table[rules]:not([rules="none"]) {
- border-collapse: collapse;
+table[rules]:not ([rules="none"] ) {
+ border-collapse: collapse;
}
-
-/* caption inherits from table not table-outer */
+
+/* caption inherits from table not table-outer */
caption {
- display: table-caption;
- text-align: center;
+ display: table-caption;
+ text-align: center;
}
-table[align="center"] > caption {
- margin-left: auto;
- margin-right: auto;
+table[align="center"]>caption {
+ margin-left: auto;
+ margin-right: auto;
}
-table[align="center"] > caption[align="left"] {
- margin-right: 0;
+table[align="center"]>caption[align="left"] {
+ margin-right: 0;
}
-table[align="center"] > caption[align="right"] {
- margin-left: 0;
+table[align="center"]>caption[align="right"] {
+ margin-left: 0;
}
tr {
- display: table-row;
- vertical-align: inherit;
+ display: table-row;
+ vertical-align: inherit;
}
col {
- display: table-column;
+ display: table-column;
}
colgroup {
- display: table-column-group;
+ display: table-column-group;
}
tbody {
- display: table-row-group;
- vertical-align: middle;
+ display: table-row-group;
+ vertical-align: middle;
}
thead {
- display: table-header-group;
- vertical-align: middle;
+ display: table-header-group;
+ vertical-align: middle;
}
tfoot {
- display: table-footer-group;
- vertical-align: middle;
+ display: table-footer-group;
+ vertical-align: middle;
}
/* for XHTML tables without tbody */
-table > tr {
- vertical-align: middle;
+table>tr {
+ vertical-align: middle;
}
-td {
- display: table-cell;
- vertical-align: inherit;
- text-align: inherit;
- padding: 1px;
+td {
+ display: table-cell;
+ vertical-align: inherit;
+ text-align: inherit;
+ padding: 1px;
}
th {
- display: table-cell;
- vertical-align: inherit;
- font-weight: bold;
- padding: 1px;
+ display: table-cell;
+ vertical-align: inherit;
+ font-weight: bold;
+ padding: 1px;
}
/* inlines */
-
-b, strong {
- font-weight: bolder;
+b,strong {
+ font-weight: bolder;
}
-i, cite, em, var, dfn {
- font-style: italic;
+i,cite,em,var,dfn {
+ font-style: italic;
}
-tt, code, kbd, samp {
- font-family: monospace;
+tt,code,kbd,samp {
+ font-family: monospace;
}
-u, ins {
- text-decoration: underline;
+u,ins {
+ text-decoration: underline;
}
-s, strike, del {
- text-decoration: line-through;
+s,strike,del {
+ text-decoration: line-through;
}
blink {
- text-decoration: blink;
+ text-decoration: blink;
}
big {
- font-size: larger;
+ font-size: larger;
}
small {
- font-size: smaller;
+ font-size: smaller;
}
sub {
- vertical-align: sub;
- font-size: smaller;
- line-height: normal;
+ vertical-align: sub;
+ font-size: smaller;
+ line-height: normal;
}
sup {
- vertical-align: super;
- font-size: smaller;
- line-height: normal;
+ vertical-align: super;
+ font-size: smaller;
+ line-height: normal;
}
nobr {
- white-space: nowrap;
+ white-space: nowrap;
}
/* titles */
-abbr[title], acronym[title] {
- border-bottom: dotted 1px;
+abbr[title],acronym[title] {
+ border-bottom: dotted 1px;
}
/* lists */
-
-ul, menu, dir {
- display: block;
- list-style-type: disc;
- margin: 1em 0;
+ul,menu,dir {
+ display: block;
+ list-style-type: disc;
+ margin: 1em 0;
}
ol {
- display: block;
- list-style-type: decimal;
- margin: 1em 0;
+ display: block;
+ list-style-type: decimal;
+ margin: 1em 0;
}
li {
- display: list-item;
+ display: list-item;
}
/* nested lists have no top/bottom margins */
-ul ul, ul ol, ul dir, ul menu, ul dl,
-ol ul, ol ol, ol dir, ol menu, ol dl,
-dir ul, dir ol, dir dir, dir menu, dir dl,
-menu ul, menu ol, menu dir, menu menu, menu dl,
-dl ul, dl ol, dl dir, dl menu, dl dl {
- margin-top: 0;
- margin-bottom: 0;
+ul ul,ul ol,ul dir,ul menu,ul dl,ol ul,ol ol,ol dir,ol menu,ol dl,dir ul,dir ol,dir dir,dir menu,dir dl,menu ul,menu ol,menu dir,menu menu,menu dl,dl ul,dl ol,dl dir,dl menu,dl dl
+ {
+ margin-top: 0;
+ margin-bottom: 0;
}
/* 2 deep unordered lists use a circle */
-ol ul, ul ul, menu ul, dir ul,
-ol menu, ul menu, menu menu, dir menu,
-ol dir, ul dir, menu dir, dir dir {
- list-style-type: circle;
+ol ul,ul ul,menu ul,dir ul,ol menu,ul menu,menu menu,dir menu,ol dir,ul dir,menu dir,dir dir
+ {
+ list-style-type: circle;
}
/* 3 deep (or more) unordered lists use a square */
-ol ol ul, ol ul ul, ol menu ul, ol dir ul,
-ol ol menu, ol ul menu, ol menu menu, ol dir menu,
-ol ol dir, ol ul dir, ol menu dir, ol dir dir,
-ul ol ul, ul ul ul, ul menu ul, ul dir ul,
-ul ol menu, ul ul menu, ul menu menu, ul dir menu,
-ul ol dir, ul ul dir, ul menu dir, ul dir dir,
-menu ol ul, menu ul ul, menu menu ul, menu dir ul,
-menu ol menu, menu ul menu, menu menu menu, menu dir menu,
-menu ol dir, menu ul dir, menu menu dir, menu dir dir,
-dir ol ul, dir ul ul, dir menu ul, dir dir ul,
-dir ol menu, dir ul menu, dir menu menu, dir dir menu,
-dir ol dir, dir ul dir, dir menu dir, dir dir dir {
- list-style-type: square;
+ol ol ul,ol ul ul,ol menu ul,ol dir ul,ol ol menu,ol ul menu,ol menu menu,ol dir menu,ol ol dir,ol ul dir,ol menu dir,ol dir dir,ul ol ul,ul ul ul,ul menu ul,ul dir ul,ul ol menu,ul ul menu,ul menu menu,ul dir menu,ul ol dir,ul ul dir,ul menu dir,ul dir dir,menu ol ul,menu ul ul,menu menu ul,menu dir ul,menu ol menu,menu ul menu,menu menu menu,menu dir menu,menu ol dir,menu ul dir,menu menu dir,menu dir dir,dir ol ul,dir ul ul,dir menu ul,dir dir ul,dir ol menu,dir ul menu,dir menu menu,dir dir menu,dir ol dir,dir ul dir,dir menu dir,dir dir dir
+ {
+ list-style-type: square;
}
-
/* leafs */
-
-/* noshade and color attributes are handled completely by
+ /* noshade and color attributes are handled completely by
* the nsHTMLHRElement attribute mapping code
*/
hr {
- display: block;
- height: 2px;
- border: 1px inset;
- margin: 0.5em auto 0.5em auto;
- color: gray;
+ display: block;
+ height: 2px;
+ border: 1px inset;
+ margin: 0.5em auto 0.5em auto;
+ color: gray;
}
hr[size="1"] {
- border-style: solid none none none;
+ border-style: solid none none none;
}
-img[usemap], object[usemap] {
- color: blue;
+img[usemap],object[usemap] {
+ color: blue;
}
frameset {
- display: block ! important;
- position: static ! important;
- float: none ! important;
- border: none ! important;
+ display: block ! important;
+ position: static ! important;
+ float: none ! important;
+ border: none ! important;
}
frame {
- border: none ! important;
+ border: none ! important;
}
iframe {
- border: 2px inset;
+ border: 2px inset;
}
noframes {
- display: none;
+ display: none;
}
spacer {
- position: static ! important;
- float: none ! important;
+ position: static ! important;
+ float: none ! important;
}
/* hidden elements */
-area, base, basefont, head, meta, script, style, title,
-noembed, param, link {
- display: none;
+area,base,basefont,head,meta,script,style,title,noembed,param,link {
+ display: none;
}
/* Page breaks at body tags, to help out with LIT-generation */
body {
- page-break-before: always;
+ page-break-before: always;
}
/* Explicit line-breaks are blocks, sure... */
br {
- display: block;
+ display: block;
}
/* Images, embedded object, and SVG size defaults */
-img, object, svg|svg {
- width: auto;
- height: auto;
+img,object,svg |svg {
+ width: auto;
+ height: auto;
}
/* These are needed because ADE renders anchors the same as links */
+a {
+ text-decoration: inherit;
+ color: inherit;
+ cursor: inherit
+}
-a { text-decoration: inherit; color: inherit; cursor: inherit }
-a[href] { text-decoration: underline; color: blue; cursor: pointer }
+a[href] {
+ text-decoration: underline;
+ color: blue;
+ cursor: pointer
+}
\ No newline at end of file
diff --git a/setup/installer/windows/en-us.xml b/setup/installer/windows/en-us.xml
index 89cc25f0a2..ed181c524b 100644
--- a/setup/installer/windows/en-us.xml
+++ b/setup/installer/windows/en-us.xml
@@ -1,9 +1,16 @@
-
- If you are upgrading from a {app} version older than 0.6.17, please uninstall {app} first. Click Advanced to change installation settings.
- Computing space requirements, this may take upto five minutes...
- Computing space requirements, this may take upto five minutes...
- Computing space requirements, this may take upto five minutes...
- Please wait while the installer finishes determining your disk space requirements, this may take upto five minutes...
+
+ If you are upgrading from a {app} version older than
+ 0.6.17, please uninstall {app} first. Click Advanced to change
+ installation settings.
+ Computing space requirements, this may take upto five
+ minutes...
+ Computing space requirements, this may take upto five
+ minutes...
+ Computing space requirements, this may take upto five
+ minutes...
+ Please wait while the installer finishes determining
+ your disk space requirements, this may take upto five minutes...
diff --git a/setup/installer/windows/wix-template.xml b/setup/installer/windows/wix-template.xml
index 37dd8b25a8..1300eba956 100644
--- a/setup/installer/windows/wix-template.xml
+++ b/setup/installer/windows/wix-template.xml
@@ -1,164 +1,157 @@
-
+
-
-
-
+
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
+
-
- {app_components}
-
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+ {app_components}
+
+
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
-
-
-
+
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
-
+
+
+
-
-
-
+
+
+
+
-
+
+
+
+
+
= 501)]]>
-
-
- NEWPRODUCTFOUND
-
-
-
- NEWPRODUCTFOUND
-
+
+
+ NEWPRODUCTFOUND
+
+
+
+ NEWPRODUCTFOUND
+
-
-
- WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed
+
+
+ WIXUI_EXITDIALOGOPTIONALCHECKBOX = 1 and NOT Installed
-
+
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
+
-
-
-
+
+
+
-
+
diff --git a/src/calibre/ebooks/lrf/html/demo/demo.html b/src/calibre/ebooks/lrf/html/demo/demo.html
index 7d2f783ccc..37bed69b88 100644
--- a/src/calibre/ebooks/lrf/html/demo/demo.html
+++ b/src/calibre/ebooks/lrf/html/demo/demo.html
@@ -1,187 +1,279 @@
-
Demo of html2lrf
-
- This document contains a demonstration of the capabilities of html2lrf, the HTML to LRF converter from calibre. To obtain calibre visit http://calibre-ebook.com
-
This document contains a demonstration of the capabilities of html2lrf, the HTML to LRF
+converter from calibre. To obtain calibre visit
+http://calibre-ebook.com
- html2lrf supports both rowspan and colspan, but no other HTML table attributes, as it uses its own algorithm to determine optimal placement of cells.
-
-
- Note that if you have custom fonts on your reader, the table may not be properly aligned. Also html2lrf does not support nested tables.
-
-
- On the next page you'll see a real life example taken from a Project Gutenberg text with no modifications. It shows off html2lrf's handling of rowspan and colspan.
-
- Here I demonstrate the use of inline images in the midst of text. Here is a small image embedded in a sentence. Now we have a slightly larger image that is automatically put in its own block and finally we have a large image which is put on a page by itself. Try changing sizes from S to M to L and see how the images behave.
-
+
Nested lists
+
+
Item 1
+
+
Sub item 1
+
Sub item 2
+
+
Sub sub item 1. This is a multiline item with almost
+ correct blocking.
+
Sub sub item 2
+
+
+
Item 2
+
+
+
Definition Lists
+
+
Term 1
+
Definition of Term 1. A multi line definition showing correct
+ blocking.
This LRF file has been prepared by embedding Times New Roman and Andale Mono
- as the default serif and monospace fonts. This allows it to correctly display
- non English characters such as:
-
-
mouse in German: mūs
-
mouse in Russian: мышь
-
-
- Note that embedding fonts in LRF files slows down page turns slightly.
-
-
beautiful image based dropcaps to emphasize this
- paragraph. Image based dropcaps are specified by adding the class = 'libprs500_dropcaps'
- attribute to an <img> tag.
-
-
-
This is a plain text based dropcaps. It
- is not nearly as dramatic, but easier to code ;-)
-
-
-
-
This is an Example of small-caps.
- It can also be used to highlight the start of a paragraph very effectively.
-
-
-
A paragraph with a hanging indent. This is especially
- useful for highly structured text like verse, or dialogue.
html2lrf supports both rowspan and colspan, but no other HTML
+table attributes, as it uses its own algorithm to determine optimal
+placement of cells.
+
Note that if you have custom fonts on your reader, the table may
+not be properly aligned. Also html2lrf does not support nested tables.
+
On the next page you'll see a
+real life example taken from a Project Gutenberg text with no
+modifications. It shows off html2lrf's handling of rowspan and colspan.
+
- html2lrf follows links in HTML files that point to other files, recursively. Thus it can be used to convert a whole tree of HTML files into a single LRF file.
-
-
Here I demonstrate the use of inline images in the midst of text.
+Here is a small image embedded in a sentence.
+Now we have a slightly larger image that is automatically put in its own
+block and finally
+we have a large image which is put on a page by itself. Try changing
+sizes from S to M to L and see how the images behave.
This LRF file has been prepared by embedding Times New Roman and
+Andale Mono as the default serif and monospace fonts. This allows it to
+correctly display non English characters such as:
+
+
mouse in German: mūs
+
mouse in Russian: мышь
+
+
Note that embedding fonts in LRF files slows down page turns
+slightly.
+
beautiful image
+based dropcaps to emphasize this paragraph. Image based dropcaps are
+specified by adding the class = 'libprs500_dropcaps'
+attribute to an <img> tag.
+
+
+
This is a plain text based dropcaps. It is not
+nearly as dramatic, but easier to code ;-)
+
+
+
This is an Example
+of small-caps. It can also be used to highlight the start of a paragraph
+very effectively.
+
+
A paragraph with a hanging indent. This is
+especially useful for highly structured text like verse, or dialogue.
+
html2lrf follows links in
+HTML files that point to other files, recursively. Thus it can be used
+to convert a whole tree of HTML files into a single LRF file.
+