diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py
index 7d4bcb762..90d139673 100644
--- a/openlp/core/lib/__init__.py
+++ b/openlp/core/lib/__init__.py
@@ -282,12 +282,12 @@ def check_item_selected(list_widget, message):
return True
-def clean_tags(text, chords=False):
+def clean_tags(text, remove_chords=False):
"""
Remove Tags from text for display
:param text: Text to be cleaned
- :param chords: Clean ChordPro tags
+ :param remove_chords: Clean ChordPro tags
"""
text = text.replace('
', '\n')
text = text.replace('{br}', '\n')
@@ -296,7 +296,7 @@ def clean_tags(text, chords=False):
text = text.replace(tag['start tag'], '')
text = text.replace(tag['end tag'], '')
# Remove ChordPro tags
- if chords:
+ if remove_chords:
text = re.sub(r'\[.+?\]', r'', text)
return text
@@ -322,14 +322,21 @@ def expand_chords(text):
"""
text_lines = text.split('{br}')
expanded_text_lines = []
+ chords_on_last_line = False
for line in text_lines:
# If a ChordPro is detected in the line, replace it with a html-span tag and wrap the line in a span tag.
if '[' in line and ']' in line:
- new_line = ''
- new_line += re.sub(r'(.*?)\[(.+?)\](.*?)', r'\1\2\3', line)
+ if chords_on_last_line:
+ new_line = ''
+ else:
+ new_line = ''
+ chords_on_last_line = True
+ new_line += re.sub(r'(.*?)\[(.+?)\](.*?)',
+ r'\1\2\3', line)
new_line += ''
expanded_text_lines.append(new_line)
else:
+ chords_on_last_line = False
expanded_text_lines.append(line)
return '{br}'.join(expanded_text_lines)
@@ -371,7 +378,7 @@ from .plugin import PluginStatus, StringContent, Plugin
from .pluginmanager import PluginManager
from .settingstab import SettingsTab
from .serviceitem import ServiceItem, ServiceItemType, ItemCapabilities
-from .htmlbuilder import build_html, build_lyrics_format_css, build_lyrics_outline_css
+from .htmlbuilder import build_html, build_lyrics_format_css, build_lyrics_outline_css, build_chords_css
from .imagemanager import ImageManager
from .renderer import Renderer
from .mediamanageritem import MediaManagerItem
diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py
index bdcc0ed32..dd5f6c3f0 100644
--- a/openlp/core/lib/htmlbuilder.py
+++ b/openlp/core/lib/htmlbuilder.py
@@ -444,32 +444,8 @@ HTML_SRC = Template("""
position: relative;
top: -0.3em;
}
- #chords {
- /*font-size: 20pt;
- color: gray;
- background-color: gray;
- color: white;
- cursor: pointer;*/
- }
- .chordline {
- line-height: 2.0;
- }
- .chordline1 {
- line-height: 1.0
- }
- .chordline span.chord span {
- position: relative;
- }
- .chordline span.chord span strong {
- position: absolute;
- top: -1em;
- left: 0;
- font-size: 75%;
- font-weight: normal;
- line-height: normal;
- /*font: 30pt sans-serif;
- color: yellow;*/
- }
+ /* Chords css */${chords_css}
+
+ #main {position: absolute; top: 0px; %s %s} %s