diff --git a/resources/templates/rtf.xsl b/resources/templates/rtf.xsl
index 58536186d9..9dba87e83a 100644
--- a/resources/templates/rtf.xsl
+++ b/resources/templates/rtf.xsl
@@ -256,7 +256,7 @@
;
-
+
text-decoration:underline
;
diff --git a/src/calibre/ebooks/rtf/input.py b/src/calibre/ebooks/rtf/input.py
index be032f0598..c1e649851b 100644
--- a/src/calibre/ebooks/rtf/input.py
+++ b/src/calibre/ebooks/rtf/input.py
@@ -41,7 +41,7 @@ border_style_map = {
class InlineClass(etree.XSLTExtension):
- FMTS = ('italics', 'bold', 'underlined', 'strike-through', 'small-caps')
+ FMTS = ('italics', 'bold', 'strike-through', 'small-caps')
def __init__(self, log):
etree.XSLTExtension.__init__(self)
@@ -54,6 +54,9 @@ class InlineClass(etree.XSLTExtension):
for x in self.FMTS:
if input_node.get(x, None) == 'true':
classes.append(x)
+ #underlined is special
+ if input_node.get('underlined', 'false') != 'false':
+ classes.append('underlined')
fs = input_node.get('font-size', False)
if fs:
if fs not in self.font_sizes:
diff --git a/src/calibre/ebooks/rtf2xml/configure_txt.py b/src/calibre/ebooks/rtf2xml/configure_txt.py
index cd4c2558b7..27f06d0d19 100755
--- a/src/calibre/ebooks/rtf2xml/configure_txt.py
+++ b/src/calibre/ebooks/rtf2xml/configure_txt.py
@@ -25,7 +25,7 @@ class Configure:
if self.__show_config_file and self.__configuration_file:
sys.stderr.write('configuration file is "%s"\n' % self.__configuration_file)
if self.__show_config_file and not self.__configuration_file:
- sys.stderr.write('No configuraiton file found; using default vaules\n')
+ sys.stderr.write('No configuraiton file found; using default values\n')
if self.__configuration_file:
read_obj = open(self.__configuration_file, 'r')
line_to_read = 1
diff --git a/src/calibre/ebooks/rtf2xml/inline.py b/src/calibre/ebooks/rtf2xml/inline.py
index 7eda0ce429..2d73db9071 100755
--- a/src/calibre/ebooks/rtf2xml/inline.py
+++ b/src/calibre/ebooks/rtf2xml/inline.py
@@ -411,11 +411,11 @@ class Inline:
self.__set_list_func(line)
action = self.__state_dict.get(self.__state)
if action is None:
- sys.stderr.write('No matching state in module inline_for_lists.py\n')
+ sys.stderr.write('No matching state in module inline.py\n')
sys.stderr.write(self.__state + '\n')
action(line)
copy_obj = copy.Copy(bug_handler = self.__bug_handler)
if self.__copy:
copy_obj.copy_file(self.__write_to, "inline.data")
copy_obj.rename(self.__write_to, self.__file)
- os.remove(self.__write_to)
+ os.remove(self.__write_to)
\ No newline at end of file
diff --git a/src/calibre/ebooks/rtf2xml/process_tokens.py b/src/calibre/ebooks/rtf2xml/process_tokens.py
index 7dd602ff46..5e4017c000 100755
--- a/src/calibre/ebooks/rtf2xml/process_tokens.py
+++ b/src/calibre/ebooks/rtf2xml/process_tokens.py
@@ -214,7 +214,27 @@ class ProcessTokens:
'nosupersub' : ('ci', 'no-su-supe', self.__no_sup_sub_func),
'up' : ('ci', 'font-up___', self.divide_by_2),
'v' : ('ci', 'hidden____', self.default_func),
- # table => tb
+ # underline
+ # can't see why it isn't a char info: 'ul'=>'ci'
+ 'ul' : ('ci', 'underlined tb
'trowd' : ('tb', 'row-def___', self.default_func),
'cell' : ('tb', 'cell______', self.default_func),
'row' : ('tb', 'row_______', self.default_func),
@@ -274,25 +294,6 @@ class ProcessTokens:
'paperh' : ('pa', 'paper-hght', self.divide_by_20),
# annotation => an
'annotation' : ('an', 'annotation', self.default_func),
- # underline
- 'ul' : ('ul', 'underlined bd
'trbrdrh' : ('bd', 'bor-t-r-hi', self.default_func),
'trbrdrv' : ('bd', 'bor-t-r-vi', self.default_func),
diff --git a/src/calibre/ebooks/rtf2xml/sections.py b/src/calibre/ebooks/rtf2xml/sections.py
index 13bf2c2ddc..a315729525 100755
--- a/src/calibre/ebooks/rtf2xml/sections.py
+++ b/src/calibre/ebooks/rtf2xml/sections.py
@@ -496,7 +496,7 @@ Instead, ingore all section information in a field-block.
self.__token_info = line[:16]
action = self.__state_dict.get(self.__state)
if action == None:
- sys.stderr.write('no no matching state in module sections.py\n')
+ sys.stderr.write('no matching state in module sections.py\n')
sys.stderr.write(self.__state + '\n')
action(line)
read_obj.close()
diff --git a/src/calibre/ebooks/rtf2xml/styles.py b/src/calibre/ebooks/rtf2xml/styles.py
index 55f86e4208..7fcbfb24a3 100755
--- a/src/calibre/ebooks/rtf2xml/styles.py
+++ b/src/calibre/ebooks/rtf2xml/styles.py
@@ -103,8 +103,6 @@ class Styles:
'sect-note_' : 'endnotes-in-section',
# list=> ls
'list-text_' : 'list-text',
- # this line must be wrong because it duplicates an earlier one
- 'list-text_' : 'list-text',
'list______' : 'list',
'list-lev-d' : 'list-level-definition',
'list-cardi' : 'list-cardinal-numbering',