forked from openlp/openlp
Import export
This commit is contained in:
parent
d77f0127e8
commit
dddd5ab4cd
@ -71,6 +71,7 @@ log = logging.getLogger(__name__)
|
|||||||
|
|
||||||
NAMESPACE = 'http://openlyrics.info/namespace/2009/song'
|
NAMESPACE = 'http://openlyrics.info/namespace/2009/song'
|
||||||
NSMAP = '{{' + NAMESPACE + '}}{tag}'
|
NSMAP = '{{' + NAMESPACE + '}}{tag}'
|
||||||
|
NEWPAGETAG = '<p style="page-break-after: always;"/>'
|
||||||
|
|
||||||
|
|
||||||
class SongXML(object):
|
class SongXML(object):
|
||||||
@ -472,6 +473,7 @@ class OpenLyrics(object):
|
|||||||
text = text.replace('{{/{tag}}}'.format(tag=tag), '</tag>')
|
text = text.replace('{{/{tag}}}'.format(tag=tag), '</tag>')
|
||||||
# Replace \n with <br/>.
|
# Replace \n with <br/>.
|
||||||
text = text.replace('\n', '<br/>')
|
text = text.replace('\n', '<br/>')
|
||||||
|
text = text.replace('[--}{--]', NEWPAGETAG)
|
||||||
element = etree.XML('<lines>{text}</lines>'.format(text=text))
|
element = etree.XML('<lines>{text}</lines>'.format(text=text))
|
||||||
verse_element.append(element)
|
verse_element.append(element)
|
||||||
return element
|
return element
|
||||||
@ -634,6 +636,9 @@ class OpenLyrics(object):
|
|||||||
if element.tail:
|
if element.tail:
|
||||||
text += element.tail
|
text += element.tail
|
||||||
return text
|
return text
|
||||||
|
elif newlines and element.tag == NSMAP.format(tag='p') and 'page-break-after' in str(element.attrib):
|
||||||
|
text += '[--}{--]'
|
||||||
|
return text
|
||||||
# Start formatting tag.
|
# Start formatting tag.
|
||||||
if element.tag == NSMAP.format(tag='tag'):
|
if element.tag == NSMAP.format(tag='tag'):
|
||||||
text += '{{{name}}}'.format(name=element.get('name'))
|
text += '{{{name}}}'.format(name=element.get('name'))
|
||||||
|
Loading…
Reference in New Issue
Block a user