forked from openlp/openlp
Fix strip_rtf()
This commit is contained in:
parent
953fbf6604
commit
92baf9887c
@ -304,15 +304,15 @@ class SundayPlusImport(SongImport):
|
|||||||
'ansicpg1258': u'cp1258'}
|
'ansicpg1258': u'cp1258'}
|
||||||
charsets = charset_mapping.keys()
|
charsets = charset_mapping.keys()
|
||||||
# Character encoding is defined together with fonts.
|
# Character encoding is defined together with fonts.
|
||||||
# font_table could contain eg 'f0': 'cp1252'
|
# font_table could contain eg '0': 'cp1252'
|
||||||
font_table = {'default': encoding}
|
font_table = {}
|
||||||
stack = []
|
stack = []
|
||||||
# Whether this group (and all inside it) are "ignorable".
|
# Whether this group (and all inside it) are "ignorable".
|
||||||
ignorable = False
|
ignorable = False
|
||||||
# Inside font table
|
# Whether we are inside the font table.
|
||||||
inside_font_table = False
|
inside_font_table = False
|
||||||
current_font = ''
|
current_font = ''
|
||||||
# Number of ASCII characters to skip after a unicode character.
|
# Number of ASCII characters to skip after an unicode character.
|
||||||
ucskip = 1
|
ucskip = 1
|
||||||
# Number of ASCII characters left to skip.
|
# Number of ASCII characters left to skip.
|
||||||
curskip = 0
|
curskip = 0
|
||||||
@ -324,10 +324,10 @@ class SundayPlusImport(SongImport):
|
|||||||
curskip = 0
|
curskip = 0
|
||||||
if brace == u'{':
|
if brace == u'{':
|
||||||
# Push state
|
# Push state
|
||||||
stack.append((ucskip, ignorable))
|
stack.append((ucskip, ignorable, inside_font_table))
|
||||||
elif brace == u'}':
|
elif brace == u'}':
|
||||||
# Pop state
|
# Pop state
|
||||||
ucskip, ignorable = stack.pop()
|
ucskip, ignorable, inside_font_table = stack.pop()
|
||||||
# \x (not a letter)
|
# \x (not a letter)
|
||||||
elif char:
|
elif char:
|
||||||
curskip = 0
|
curskip = 0
|
||||||
@ -356,20 +356,16 @@ class SundayPlusImport(SongImport):
|
|||||||
curskip = ucskip
|
curskip = ucskip
|
||||||
elif word == 'fonttbl':
|
elif word == 'fonttbl':
|
||||||
inside_font_table = True
|
inside_font_table = True
|
||||||
|
ignorable = True
|
||||||
elif word == 'f':
|
elif word == 'f':
|
||||||
if inside_font_table:
|
current_font = arg
|
||||||
font_table[current_font] = font_table['default']
|
if not inside_font_table:
|
||||||
else:
|
|
||||||
encoding = font_table[arg]
|
encoding = font_table[arg]
|
||||||
elif word in charsets:
|
elif word in ('ansicpg', 'fcharset'):
|
||||||
if inside_font_table:
|
if inside_font_table:
|
||||||
font_table[current_font] = charset_mapping[word]
|
font_table[current_font] = charset_mapping[word + arg]
|
||||||
else:
|
else:
|
||||||
font_table['default'] = charset_mapping[word]
|
encoding = charset_mapping[word + arg]
|
||||||
elif inside_font_table:
|
|
||||||
pass
|
|
||||||
elif ignorable:
|
|
||||||
pass
|
|
||||||
# \'xx
|
# \'xx
|
||||||
elif hex:
|
elif hex:
|
||||||
if curskip > 0:
|
if curskip > 0:
|
||||||
|
Loading…
Reference in New Issue
Block a user