Skip to content

Commit e81c3c9

Browse files
authored
➕ Merge pull request #219 from devmount/fix-openlp-export
Fix OpenLP export
2 parents 4789c44 + 89d1977 commit e81c3c9

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

frontend/src/utils.js

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ const openLyricsXML = (song, version, locales = [], allTags = null) => {
337337
const subtitle = song.subtitle ? `<title>${song.subtitle}</title>` : '';
338338
const year = song.year ? `<released>${song.year}</released>` : '';
339339
const copyright = song.year || song.publisher
340-
? '<copyright>' + song.year + ' ' + song.publisher.replace(/(?:\r\n|\r|\n)/g, '; ') + '</copyright>'
340+
? '<copyright>' + song.year + ' ' + song.publisher.replace(/(?:\r\n|\r|\n)/g, '; ').replace(/&/gi, '&amp;') + '</copyright>'
341341
: '';
342342
const ccli = song.ccli ? `<ccliNo>${song.ccli}</ccliNo>` : '';
343343
const authors = song.authors
@@ -349,18 +349,12 @@ const openLyricsXML = (song, version, locales = [], allTags = null) => {
349349
).join('') + '</themes>'
350350
: '';
351351
const lyrics = parsedContent(song.content, song.tuning, false, false).map(p => {
352+
const type = p.type ? p.type.toUpperCase() : 'V';
352353
const num = p.number > 0 ? p.number : '1';
353-
return `<verse name="${p.type ? p.type.toUpperCase() : 'V'}${num}"><lines>` + p.content.replace(/\n/g, "<br />") + '</lines></verse>'
354+
return `<verse name='${type}${num}'><lines>` + p.content.replace(/\n/g, "<br />") + '</lines></verse>'
354355
}).join('');
355356

356-
return `<?xml version='1.0' encoding='UTF-8'?>
357-
<song xmlns="http://openlyrics.info/namespace/2009/song" version="0.9" createdIn="SongDrive ${version}" modifiedIn="SongDrive ${version}" modifiedDate="${timestamp}">
358-
<properties>
359-
<titles>${title}${subtitle}</titles>
360-
${copyright}${year}${ccli}${authors}${tags}
361-
</properties>
362-
<lyrics>${lyrics}</lyrics>
363-
</song>`;
357+
return `<?xml version='1.0' encoding='UTF-8'?><song xmlns='http://openlyrics.info/namespace/2009/song' version='0.9' createdIn='SongDrive ${version}' modifiedIn='SongDrive ${version}' modifiedDate='${timestamp}'><properties><titles>${title}${subtitle}</titles>${copyright}${year}${ccli}${authors}${tags}</properties><lyrics>${lyrics}</lyrics></song>`;
364358
};
365359

366360
export {

0 commit comments

Comments
 (0)