Skip to content

Commit

Permalink
➕ Merge pull request #219 from devmount/fix-openlp-export
Browse files Browse the repository at this point in the history
Fix OpenLP export
  • Loading branch information
devmount committed Jun 5, 2024
2 parents 4789c44 + 89d1977 commit e81c3c9
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions frontend/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ const openLyricsXML = (song, version, locales = [], allTags = null) => {
const subtitle = song.subtitle ? `<title>${song.subtitle}</title>` : '';
const year = song.year ? `<released>${song.year}</released>` : '';
const copyright = song.year || song.publisher
? '<copyright>' + song.year + ' ' + song.publisher.replace(/(?:\r\n|\r|\n)/g, '; ') + '</copyright>'
? '<copyright>' + song.year + ' ' + song.publisher.replace(/(?:\r\n|\r|\n)/g, '; ').replace(/&/gi, '&amp;') + '</copyright>'
: '';
const ccli = song.ccli ? `<ccliNo>${song.ccli}</ccliNo>` : '';
const authors = song.authors
Expand All @@ -349,18 +349,12 @@ const openLyricsXML = (song, version, locales = [], allTags = null) => {
).join('') + '</themes>'
: '';
const lyrics = parsedContent(song.content, song.tuning, false, false).map(p => {
const type = p.type ? p.type.toUpperCase() : 'V';
const num = p.number > 0 ? p.number : '1';
return `<verse name="${p.type ? p.type.toUpperCase() : 'V'}${num}"><lines>` + p.content.replace(/\n/g, "<br />") + '</lines></verse>'
return `<verse name='${type}${num}'><lines>` + p.content.replace(/\n/g, "<br />") + '</lines></verse>'
}).join('');

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>`;
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>`;
};

export {
Expand Down

0 comments on commit e81c3c9

Please sign in to comment.