forked from openlp/openlp
Fix theme text weight and html tag cleanups
This commit is contained in:
parent
1e0d68016f
commit
1e86aa98ba
@ -116,6 +116,7 @@ body {
|
|||||||
else
|
else
|
||||||
img.style.display = 'block';
|
img.style.display = 'block';
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_blank(state){
|
function show_blank(state){
|
||||||
var black = 'none';
|
var black = 'none';
|
||||||
var lyrics = '';
|
var lyrics = '';
|
||||||
|
@ -169,7 +169,16 @@ class Renderer(object):
|
|||||||
doc.setDefaultFont(df)
|
doc.setDefaultFont(df)
|
||||||
layout = doc.documentLayout()
|
layout = doc.documentLayout()
|
||||||
formatted = []
|
formatted = []
|
||||||
shell = u'<p>%s</p>'
|
if self._theme.font_main_weight == u'Bold' and \
|
||||||
|
self._theme.font_main_italics:
|
||||||
|
shell = u'{p}{st}{it}%s{/it}{/st}{/p}'
|
||||||
|
elif self._theme.font_main_weight == u'Bold' and \
|
||||||
|
not self._theme.font_main_italics:
|
||||||
|
shell = u'{p}{st}%s{/st}{/p}'
|
||||||
|
elif self._theme.font_main_italics:
|
||||||
|
shell = u'{p}{it}%s{/it}{/p}'
|
||||||
|
else:
|
||||||
|
shell = u'{p}%s{/p}'
|
||||||
temp_text = u''
|
temp_text = u''
|
||||||
old_html_text = u''
|
old_html_text = u''
|
||||||
for line in text:
|
for line in text:
|
||||||
|
@ -68,15 +68,49 @@ class RenderManager(object):
|
|||||||
self.themedata = None
|
self.themedata = None
|
||||||
self.alertTab = None
|
self.alertTab = None
|
||||||
|
|
||||||
# TODO make external and configurable
|
# TODO make external and configurable in alpha 4
|
||||||
self.html_expands = {
|
self.html_expands = []
|
||||||
u'{r}': u'<font color=red>',
|
|
||||||
u'{b}': u'<font color=black>',
|
self.html_expands.append({u'desc':u'Red',u'start tag':u'{r}', \
|
||||||
u'{u}': u'<font color=blue>',
|
u'start html':u'<font color=red>', \
|
||||||
u'{y}': u'<font color=yellow>',
|
u'end tag':u'{/r}', u'end html':u'</font>', \
|
||||||
u'{g}': u'<font color=green>',
|
u'protected':False})
|
||||||
u'{/}': u'</font>'
|
self.html_expands.append({u'desc':u'Black',u'start tag':u'{b}', \
|
||||||
}
|
u'start html':u'<font color=black>', \
|
||||||
|
u'end tag':u'{/b}', u'end html':u'</font>', \
|
||||||
|
u'protected':False})
|
||||||
|
self.html_expands.append({u'desc':u'Blue',u'start tag':u'{bl}', \
|
||||||
|
u'start html':u'<font color=blue>', \
|
||||||
|
u'end tag':u'{/bl}', u'end html':u'</font>', \
|
||||||
|
u'protected':False})
|
||||||
|
self.html_expands.append({u'desc':u'Yellow',u'start tag':u'{y}', \
|
||||||
|
u'start html':u'<font color=yellow>', \
|
||||||
|
u'end tag':u'{/y}', u'end html':u'</font>', \
|
||||||
|
u'protected':False})
|
||||||
|
self.html_expands.append({u'desc':u'Green',u'start tag':u'{g}', \
|
||||||
|
u'start html':u'<font color=green>', \
|
||||||
|
u'end tag':u'{/g}', u'end html':u'</font>', \
|
||||||
|
u'protected':False})
|
||||||
|
self.html_expands.append({u'desc':u'Superscript',u'start tag':u'{su}', \
|
||||||
|
u'start html':u'<sup>', \
|
||||||
|
u'end tag':u'{/su}', u'end html':u'</sup>', \
|
||||||
|
u'protected':True})
|
||||||
|
self.html_expands.append({u'desc':u'Subscript',u'start tag':u'{sb}', \
|
||||||
|
u'start html':u'<sub>', \
|
||||||
|
u'end tag':u'{/sb}', u'end html':u'</sub>', \
|
||||||
|
u'protected':True})
|
||||||
|
self.html_expands.append({u'desc':u'Paragraph',u'start tag':u'{p}', \
|
||||||
|
u'start html':u'<p>', \
|
||||||
|
u'end tag':u'{/p}', u'end html':u'</p>', \
|
||||||
|
u'protected':True})
|
||||||
|
self.html_expands.append({u'desc':u'Bold',u'start tag':u'{st}', \
|
||||||
|
u'start html':u'<strong>', \
|
||||||
|
u'end tag':u'{/st}', u'end html':u'</strong>', \
|
||||||
|
u'protected':True})
|
||||||
|
self.html_expands.append({u'desc':u'Italics',u'start tag':u'{it}', \
|
||||||
|
u'start html':u'<em>', \
|
||||||
|
u'end tag':u'{/it}', u'end html':u'</em>', \
|
||||||
|
u'protected':True})
|
||||||
|
|
||||||
def update_display(self):
|
def update_display(self):
|
||||||
"""
|
"""
|
||||||
@ -262,18 +296,18 @@ class RenderManager(object):
|
|||||||
"""
|
"""
|
||||||
Remove Tags from text for display
|
Remove Tags from text for display
|
||||||
"""
|
"""
|
||||||
text = text.replace(u'<br>', u'\n').replace(u'<p>', u'')\
|
text = text.replace(u'<br>', u'\n')
|
||||||
.replace(u'</p>', u'').replace(u'<sup>', u'')\
|
for tag in self.html_expands:
|
||||||
.replace(u'</sup>', u'')
|
text = text.replace(tag[u'start tag'], u'')
|
||||||
for key, value in self.html_expands.iteritems():
|
text = text.replace(tag[u'end tag'], u'')
|
||||||
text = text.replace(key, u'')
|
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def expand(self, text):
|
def expand(self, text):
|
||||||
"""
|
"""
|
||||||
Expand tags fto HTML for display
|
Expand tags fto HTML for display
|
||||||
"""
|
"""
|
||||||
for key, value in self.html_expands.iteritems():
|
for tag in self.html_expands:
|
||||||
text = text.replace(key, value)
|
text = text.replace(tag[u'start tag'], tag[u'start html'])
|
||||||
|
text = text.replace(tag[u'end tag'], tag[u'end html'])
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
@ -503,16 +503,16 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
dual_text = self._decodeQtObject(reference, 'dual_text')
|
dual_text = self._decodeQtObject(reference, 'dual_text')
|
||||||
if self.parent.settings_tab.display_style == 1:
|
if self.parent.settings_tab.display_style == 1:
|
||||||
verse_text = self.formatVerse(old_chapter, chapter, verse,
|
verse_text = self.formatVerse(old_chapter, chapter, verse,
|
||||||
u'<sup>(', u')</sup>')
|
u'{su}(', u'){/su}')
|
||||||
elif self.parent.settings_tab.display_style == 2:
|
elif self.parent.settings_tab.display_style == 2:
|
||||||
verse_text = self.formatVerse(old_chapter, chapter, verse,
|
verse_text = self.formatVerse(old_chapter, chapter, verse,
|
||||||
u'<sup>{', u'}</sup>')
|
u'{su}{', u'}{/su}')
|
||||||
elif self.parent.settings_tab.display_style == 3:
|
elif self.parent.settings_tab.display_style == 3:
|
||||||
verse_text = self.formatVerse(old_chapter, chapter, verse,
|
verse_text = self.formatVerse(old_chapter, chapter, verse,
|
||||||
u'<sup>[', u']</sup>')
|
u'{su}[', u']{/su}')
|
||||||
else:
|
else:
|
||||||
verse_text = self.formatVerse(old_chapter, chapter, verse,
|
verse_text = self.formatVerse(old_chapter, chapter, verse,
|
||||||
u'<sup>', u'</sup>')
|
u'{su}', u'{/su}')
|
||||||
old_chapter = chapter
|
old_chapter = chapter
|
||||||
footer = u'%s (%s %s)' % (book, version, copyright)
|
footer = u'%s (%s %s)' % (book, version, copyright)
|
||||||
# If not found add to footer
|
# If not found add to footer
|
||||||
@ -572,7 +572,6 @@ class BibleMediaItem(MediaManagerItem):
|
|||||||
service_item.title = u'%s, %s' % (service_item.title,
|
service_item.title = u'%s, %s' % (service_item.title,
|
||||||
translate('BiblesPlugin.MediaItem', 'etc'))
|
translate('BiblesPlugin.MediaItem', 'etc'))
|
||||||
# item theme
|
# item theme
|
||||||
>>>>>>> MERGE-SOURCE
|
|
||||||
if len(self.parent.settings_tab.bible_theme) == 0:
|
if len(self.parent.settings_tab.bible_theme) == 0:
|
||||||
service_item.theme = None
|
service_item.theme = None
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user