diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py
index 4b4b83090..856d6c7a3 100644
--- a/openlp/core/lib/__init__.py
+++ b/openlp/core/lib/__init__.py
@@ -35,6 +35,67 @@ from PyQt4 import QtCore, QtGui
log = logging.getLogger(__name__)
+# TODO make external and configurable in alpha 4 via a settings dialog
+html_expands = []
+
+html_expands.append({u'desc':u'Red', u'start tag':u'{r}', \
+ u'start html':u'', \
+ u'end tag':u'{/r}', u'end html':u'', \
+ u'protected':False})
+html_expands.append({u'desc':u'Black', u'start tag':u'{b}', \
+ u'start html':u'', \
+ u'end tag':u'{/b}', u'end html':u'', \
+ u'protected':False})
+html_expands.append({u'desc':u'Blue', u'start tag':u'{bl}', \
+ u'start html':u'', \
+ u'end tag':u'{/bl}', u'end html':u'', \
+ u'protected':False})
+html_expands.append({u'desc':u'Yellow', u'start tag':u'{y}', \
+ u'start html':u'', \
+ u'end tag':u'{/y}', u'end html':u'', \
+ u'protected':False})
+html_expands.append({u'desc':u'Green', u'start tag':u'{g}', \
+ u'start html':u'', \
+ u'end tag':u'{/g}', u'end html':u'', \
+ u'protected':False})
+html_expands.append({u'desc':u'Pink', u'start tag':u'{pk}', \
+ u'start html':u'', \
+ u'end tag':u'{/pk}', u'end html':u'', \
+ u'protected':False})
+html_expands.append({u'desc':u'Orange', u'start tag':u'{o}', \
+ u'start html':u'', \
+ u'end tag':u'{/o}', u'end html':u'', \
+ u'protected':False})
+html_expands.append({u'desc':u'Purple', u'start tag':u'{pp}', \
+ u'start html':u'', \
+ u'end tag':u'{/pp}', u'end html':u'', \
+ u'protected':False})
+html_expands.append({u'desc':u'White', u'start tag':u'{w}', \
+ u'start html':u'', \
+ u'end tag':u'{/w}', u'end html':u'', \
+ u'protected':False})
+html_expands.append({u'desc':u'Superscript', u'start tag':u'{su}', \
+ u'start html':u'', \
+ u'end tag':u'{/su}', u'end html':u'', \
+ u'protected':True})
+html_expands.append({u'desc':u'Subscript', u'start tag':u'{sb}', \
+ u'start html':u'', \
+ u'end tag':u'{/sb}', u'end html':u'', \
+ u'protected':True})
+html_expands.append({u'desc':u'Paragraph', u'start tag':u'{p}', \
+ u'start html':u'
', \
+ u'end tag':u'{/p}', u'end html':u'
', \
+ u'protected':True})
+html_expands.append({u'desc':u'Bold', u'start tag':u'{st}', \
+ u'start html':u'', \
+ u'end tag':u'{/st}', \
+ u'end html':u'', \
+ u'protected':True})
+html_expands.append({u'desc':u'Italics', u'start tag':u'{it}', \
+ u'start html':u'', \
+ u'end tag':u'{/it}', u'end html':u'', \
+ u'protected':True})
+
def translate(context, text, comment=None):
"""
A special shortcut method to wrap around the Qt4 translation functions.
@@ -232,6 +293,25 @@ def check_item_selected(list_widget, message):
return False
return True
+def clean_tags(text):
+ """
+ Remove Tags from text for display
+ """
+ text = text.replace(u'
', u'\n')
+ for tag in html_expands:
+ text = text.replace(tag[u'start tag'], u'')
+ text = text.replace(tag[u'end tag'], u'')
+ return text
+
+def expand_tags(text):
+ """
+ Expand tags HTML for display
+ """
+ for tag in html_expands:
+ text = text.replace(tag[u'start tag'], tag[u'start html'])
+ text = text.replace(tag[u'end tag'], tag[u'end html'])
+ return text
+
from eventreceiver import Receiver
from settingsmanager import SettingsManager
from plugin import PluginStatus, Plugin
diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py
index 398d8ef92..433018c23 100644
--- a/openlp/core/lib/renderer.py
+++ b/openlp/core/lib/renderer.py
@@ -31,7 +31,7 @@ import logging
from PyQt4 import QtGui, QtCore
-from openlp.core.lib import resize_image
+from openlp.core.lib import resize_image, expand_tags
log = logging.getLogger(__name__)
@@ -183,7 +183,7 @@ class Renderer(object):
for line in text:
# mark line ends
temp_text = temp_text + line + line_end
- html_text = shell % temp_text
+ html_text = shell % expand_tags(temp_text)
doc.setHtml(html_text)
# Text too long so gone to next mage
if layout.pageCount() != 1:
diff --git a/openlp/core/lib/rendermanager.py b/openlp/core/lib/rendermanager.py
index 9c6632650..5ee04a36d 100644
--- a/openlp/core/lib/rendermanager.py
+++ b/openlp/core/lib/rendermanager.py
@@ -68,67 +68,6 @@ class RenderManager(object):
self.themedata = None
self.alertTab = None
- # TODO make external and configurable in alpha 4
- self.html_expands = []
-
- self.html_expands.append({u'desc':u'Red', u'start tag':u'{r}', \
- u'start html':u'', \
- u'end tag':u'{/r}', u'end html':u'', \
- u'protected':False})
- self.html_expands.append({u'desc':u'Black', u'start tag':u'{b}', \
- u'start html':u'', \
- u'end tag':u'{/b}', u'end html':u'', \
- u'protected':False})
- self.html_expands.append({u'desc':u'Blue', u'start tag':u'{bl}', \
- u'start html':u'', \
- u'end tag':u'{/bl}', u'end html':u'', \
- u'protected':False})
- self.html_expands.append({u'desc':u'Yellow', u'start tag':u'{y}', \
- u'start html':u'', \
- u'end tag':u'{/y}', u'end html':u'', \
- u'protected':False})
- self.html_expands.append({u'desc':u'Green', u'start tag':u'{g}', \
- u'start html':u'', \
- u'end tag':u'{/g}', u'end html':u'', \
- u'protected':False})
- self.html_expands.append({u'desc':u'Pink', u'start tag':u'{pk}', \
- u'start html':u'', \
- u'end tag':u'{/pk}', u'end html':u'', \
- u'protected':False})
- self.html_expands.append({u'desc':u'Orange', u'start tag':u'{o}', \
- u'start html':u'', \
- u'end tag':u'{/o}', u'end html':u'', \
- u'protected':False})
- self.html_expands.append({u'desc':u'Purple', u'start tag':u'{pp}', \
- u'start html':u'', \
- u'end tag':u'{/pp}', u'end html':u'', \
- u'protected':False})
- self.html_expands.append({u'desc':u'White', u'start tag':u'{w}', \
- u'start html':u'', \
- u'end tag':u'{/w}', u'end html':u'', \
- u'protected':False})
- self.html_expands.append({u'desc':u'Superscript', u'start tag':u'{su}', \
- u'start html':u'', \
- u'end tag':u'{/su}', u'end html':u'', \
- u'protected':True})
- self.html_expands.append({u'desc':u'Subscript', u'start tag':u'{sb}', \
- u'start html':u'', \
- u'end tag':u'{/sb}', u'end html':u'', \
- u'protected':True})
- self.html_expands.append({u'desc':u'Paragraph', u'start tag':u'{p}', \
- u'start html':u'', \
- u'end tag':u'{/p}', u'end html':u'
', \
- u'protected':True})
- self.html_expands.append({u'desc':u'Bold', u'start tag':u'{st}', \
- u'start html':u'', \
- u'end tag':u'{/st}', \
- u'end html':u'', \
- u'protected':True})
- self.html_expands.append({u'desc':u'Italics', u'start tag':u'{it}', \
- u'start html':u'', \
- u'end tag':u'{/it}', u'end html':u'', \
- u'protected':True})
-
def update_display(self):
"""
Updates the render manager's information about the current screen.
@@ -294,22 +233,3 @@ class RenderManager(object):
self.width, self.height, self.screen_ratio )
# 90% is start of footer
self.footer_start = int(self.height * 0.90)
-
- def clean(self, text):
- """
- Remove Tags from text for display
- """
- text = text.replace(u'
', u'\n')
- for tag in self.html_expands:
- text = text.replace(tag[u'start tag'], u'')
- text = text.replace(tag[u'end tag'], u'')
- return text
-
- def expand(self, text):
- """
- Expand tags HTML for display
- """
- for tag in self.html_expands:
- text = text.replace(tag[u'start tag'], tag[u'start html'])
- text = text.replace(tag[u'end tag'], tag[u'end html'])
- return text
diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py
index e375598c9..3c3cd4cf3 100644
--- a/openlp/core/lib/serviceitem.py
+++ b/openlp/core/lib/serviceitem.py
@@ -35,7 +35,7 @@ import uuid
from PyQt4 import QtGui
-from openlp.core.lib import build_icon, resize_image
+from openlp.core.lib import build_icon, resize_image, clean_tags, expand_tags
log = logging.getLogger(__name__)
@@ -164,9 +164,9 @@ class ServiceItem(object):
.format_slide(slide[u'raw_slide'], line_break)
for page in formated:
self._display_frames.append(
- {u'title': self.render_manager.clean(page),
- u'text': self.render_manager.clean(page.rstrip()),
- u'html': self.render_manager.expand(page.rstrip()),
+ {u'title': clean_tags(page),
+ u'text': clean_tags(page.rstrip()),
+ u'html': expand_tags(page.rstrip()),
u'verseTag': slide[u'verseTag'] })
log.log(15, u'Formatting took %4s' % (time.time() - before))
elif self.service_item_type == ServiceItemType.Image: