|
@ -12,6 +12,13 @@ Parse Latex song into chordpro |
|
|
return array.join(""); |
|
|
return array.join(""); |
|
|
} |
|
|
} |
|
|
function property(name, value){ |
|
|
function property(name, value){ |
|
|
|
|
|
if(value instanceof Array) { |
|
|
|
|
|
value = value.join(""); |
|
|
|
|
|
} |
|
|
|
|
|
cp.setProperty(name,value); |
|
|
|
|
|
return "{" + name +": " + value + "}"; |
|
|
|
|
|
} |
|
|
|
|
|
function inline_property(name, value){ |
|
|
if(value instanceof Array) { |
|
|
if(value instanceof Array) { |
|
|
value = value.join(""); |
|
|
value = value.join(""); |
|
|
} |
|
|
} |
|
@ -31,11 +38,18 @@ Parse Latex song into chordpro |
|
|
} |
|
|
} |
|
|
var define = "define"; |
|
|
var define = "define"; |
|
|
if(ukulele){ |
|
|
if(ukulele){ |
|
|
define += "_ukulele"; |
|
|
//define += "_ukulele"; |
|
|
} |
|
|
} |
|
|
return property(define, content); |
|
|
return property(define, content); |
|
|
} |
|
|
} |
|
|
function blockify(name, content, newline){ |
|
|
function blockify(name, content, newline){ |
|
|
|
|
|
cp.openSongBlock(name); |
|
|
|
|
|
lines = content.split("\n"); |
|
|
|
|
|
for(i in lines){ |
|
|
|
|
|
cp.addLine(lines[i]); |
|
|
|
|
|
} |
|
|
|
|
|
cp.closeSongBlock(name); |
|
|
|
|
|
|
|
|
var start = "{start_of_"+name+"}"; |
|
|
var start = "{start_of_"+name+"}"; |
|
|
var end = "{end_of_"+name+"}"; |
|
|
var end = "{end_of_"+name+"}"; |
|
|
if(newline){ |
|
|
if(newline){ |
|
@ -56,13 +70,35 @@ Parse Latex song into chordpro |
|
|
} |
|
|
} |
|
|
return start + content + end; |
|
|
return start + content + end; |
|
|
} |
|
|
} |
|
|
|
|
|
function blockify_scripture(name, content, newline){ |
|
|
|
|
|
content = cp.inlineProperty("comment", content); |
|
|
|
|
|
return blockify("verse", content, true); |
|
|
|
|
|
} |
|
|
|
|
|
function blockify_scripture_param(name, param, content, newline){ |
|
|
|
|
|
var header = ""; |
|
|
|
|
|
switch (param) { |
|
|
|
|
|
case "Encyclopédie Naheulbeuk": |
|
|
|
|
|
case "Portal": |
|
|
|
|
|
header = param + " - "; |
|
|
|
|
|
case "Les Souliers": |
|
|
|
|
|
content = header + content; |
|
|
|
|
|
content = cp.inlineProperty("comment", content); |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
throw "sc"; |
|
|
|
|
|
} |
|
|
|
|
|
if(content.length == 0){ |
|
|
|
|
|
return ""; |
|
|
|
|
|
} |
|
|
|
|
|
return blockify("verse", content, true); |
|
|
|
|
|
} |
|
|
function chordname_split(chordname){ |
|
|
function chordname_split(chordname){ |
|
|
return chordname.split(" - ").join(" ").split(" ").join("][").replace("/b/g", "&"); |
|
|
return chordname.split(" - ").join(" ").split(" ").join("][").replace("/b/g", "&"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
start |
|
|
start |
|
|
= content:(language? newlines_merge columnsetting? newlines_merge song) {return content.join(""); } |
|
|
= content:(language? newlines_merge columnsetting? newlines_merge song) {return cp.toString(); } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Basic characters |
|
|
// Basic characters |
|
@ -158,10 +194,10 @@ block_standalone_command |
|
|
= "\\capo{" digits:digits "}" { return property("capo", digits)} |
|
|
= "\\capo{" digits:digits "}" { return property("capo", digits)} |
|
|
/ "\\meter{" num:digits "}{" denom:digits "}" { return property("meter", num + "/" + denom)} |
|
|
/ "\\meter{" num:digits "}{" denom:digits "}" { return property("meter", num + "/" + denom)} |
|
|
/ "\\cover" { return ""} |
|
|
/ "\\cover" { return ""} |
|
|
/ "\\transposition{" digits:ndigits "}" {return property("transposition", digits)} |
|
|
/ "\\transposition{" digits:ndigits "}" {return inline_property("transposition", digits)} |
|
|
/ "\\lilypond" " "? "{" file:slug "}" { return property("partition", [file + ".ly"])} |
|
|
/ "\\lilypond" " "? "{" file:slug "}" { return inline_property("partition", [file + ".ly"])} |
|
|
/ "\\nolyrics{\\lilypond{" file:slug "}}" { return property("partition", [file + ".ly"])} |
|
|
/ "\\nolyrics{\\lilypond{" file:slug "}}" { return inline_property("partition", [file + ".ly"])} |
|
|
/ "\\rep{" digits:digits "}" {return property("repeat", digits)} |
|
|
/ "\\rep{" digits:digits "}" {return inline_property("repeat", digits)} |
|
|
/ guitar_tab |
|
|
/ guitar_tab |
|
|
/ ukulele_tab |
|
|
/ ukulele_tab |
|
|
|
|
|
|
|
@ -187,7 +223,7 @@ basefret |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
language |
|
|
language |
|
|
= "\\selectlanguage{" lang:alpha "}" {return property("language", lang);} |
|
|
= "\\selectlanguage{" lang:alpha "}" {cp.reset(); return property("language", lang);} |
|
|
|
|
|
|
|
|
columnsetting |
|
|
columnsetting |
|
|
= "\\songcolumns{" num:digits "}" {return property("columns", num);} |
|
|
= "\\songcolumns{" num:digits "}" {return property("columns", num);} |
|
@ -273,9 +309,9 @@ repeated_block_part |
|
|
= "\\begin{repeatedchords}" newlines c:song_block_parts "\\end{repeatedchords}" newlines {return c} |
|
|
= "\\begin{repeatedchords}" newlines c:song_block_parts "\\end{repeatedchords}" newlines {return c} |
|
|
|
|
|
|
|
|
verse |
|
|
verse |
|
|
= "\\begin{verse}" newlines c:song_block_parts "\\end{verse}" {return c} |
|
|
= "\\begin{verse}" newlines c:song_block_parts "\\end{verse}" {return blockify("verse", c, true)} |
|
|
/ "\\beginverse" newlines c:song_block_parts "\\endverse" {return c} |
|
|
/ "\\beginverse" newlines c:song_block_parts "\\endverse" {return blockify("verse", c, true)} |
|
|
/ "\\begin{verse*}" newlines c:song_block_parts "\\end{verse*}" {return c} |
|
|
/ "\\begin{verse*}" newlines c:song_block_parts "\\end{verse*}" {return blockify("verse*", c, true)} |
|
|
|
|
|
|
|
|
chorus |
|
|
chorus |
|
|
= "\\begin{chorus}" newlines c:song_block_parts "\\end{chorus}" {return blockify("chorus", c, true)} |
|
|
= "\\begin{chorus}" newlines c:song_block_parts "\\end{chorus}" {return blockify("chorus", c, true)} |
|
@ -294,17 +330,19 @@ nolyrics_block_part |
|
|
/ "\\nolyrics" {return ""} |
|
|
/ "\\nolyrics" {return ""} |
|
|
|
|
|
|
|
|
musicnote_block |
|
|
musicnote_block |
|
|
= "\\musicnote" " "* "{" c:song_block_parts "}" {return blockify("musicnote", c, true)} |
|
|
= "\\musicnote" " "* "{" c:song_block_parts "}" {return cp.inlineProperty("guitar_comment", c)} |
|
|
/ "\\musicnote[" lang:alpha "]" " "* "{" c:song_block_parts "}" {return blockify_param("musicnote", lang, c, true)} |
|
|
/ "\\musicnote[" lang:alpha "]" " "* "{" c:song_block_parts "}" {return cp.inlineProperty("guitar_comment", c, lang)} |
|
|
|
|
|
|
|
|
musicnote_block_part |
|
|
musicnote_block_part |
|
|
|
|
|
= musicnote_block |
|
|
|
|
|
/* |
|
|
= "\\musicnote" " "* "{" c:song_block_parts "}" {return c} |
|
|
= "\\musicnote" " "* "{" c:song_block_parts "}" {return c} |
|
|
/ "\\musicnote[" lang:alpha "]" " "* "{" c:song_block_parts "}" {return c} |
|
|
/ "\\musicnote[" lang:alpha "]" " "* "{" c:song_block_parts "}" {return c} |
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
textnote_block |
|
|
textnote_block |
|
|
= "\\textnote" " "* "{" c:song_block_parts "}" {return blockify("textnote", c, false)} |
|
|
= "\\textnote" " "* "{" c:song_block_parts "}" {return blockify("verse*", cp.inlineProperty("comment", c))} |
|
|
/ "\\textnote[" lang:alpha "]" " "* "{" c:song_block_parts "}" {return blockify_param("textnote", lang, c, false)} |
|
|
/ "\\textnote[" lang:alpha "]" " "* "{" c:song_block_parts "}" {return blockify("verse*", cp.inlineProperty("comment", c, lang))} |
|
|
|
|
|
|
|
|
textnote_block_part |
|
|
textnote_block_part |
|
|
= "\\textnote" " "* "{" c:song_block_parts "}" {return c} |
|
|
= "\\textnote" " "* "{" c:song_block_parts "}" {return c} |
|
@ -312,11 +350,11 @@ textnote_block_part |
|
|
/ "\\textbf" " "* "{" c:song_block_parts "}" {return "**" + c + "**"} |
|
|
/ "\\textbf" " "* "{" c:song_block_parts "}" {return "**" + c + "**"} |
|
|
|
|
|
|
|
|
scripture_block |
|
|
scripture_block |
|
|
= "\\beginscripture{}" "%"? newlines c:song_block_parts "\\endscripture" "%"? {return blockify("scripture", c, true)} |
|
|
= "\\beginscripture{}" "%"? newlines c:song_block_parts "\\endscripture" "%"? {return blockify_scripture("scripture", c, true)} |
|
|
/ "\\beginscripture{" comment:inline_text "}" newlines c:song_block_parts "\\endscripture" "%"? {return blockify_param("scripture", comment, c, true)} |
|
|
/ "\\beginscripture{" comment:inline_text "}" newlines c:song_block_parts "\\endscripture" "%"? {return blockify_scripture_param("scripture", comment, c, true)} |
|
|
|
|
|
|
|
|
special_block |
|
|
special_block |
|
|
= "\\Bridge" {return blockify("textnote", "Bridge", false)} |
|
|
= "\\Bridge" {return blockify("verse*", cp.inlineProperty("comment", "Bridge"))} |
|
|
/ "\\image[" [^\]]+ "]{" [^}]+ "}" {return ""} |
|
|
/ "\\image[" [^\]]+ "]{" [^}]+ "}" {return ""} |
|
|
/ "\\MultiwordChords" { return ""} |
|
|
/ "\\MultiwordChords" { return ""} |
|
|
|
|
|
|
|
@ -349,7 +387,7 @@ paragraph_line_elt |
|
|
|
|
|
|
|
|
command_in_paragraph |
|
|
command_in_paragraph |
|
|
= "\\emph{" c:paragraph_line "}" {return c} |
|
|
= "\\emph{" c:paragraph_line "}" {return c} |
|
|
/ "\\echo{" c:paragraph_line "}" {return property("echo", c)} |
|
|
/ "\\echo{" c:paragraph_line "}" {return cp.inlineProperty("echo", c)} |
|
|
/ "\\" c:ignored_command_in_paragraph "{}"? { return c} |
|
|
/ "\\" c:ignored_command_in_paragraph "{}"? { return c} |
|
|
|
|
|
|
|
|
ignored_command_in_paragraph |
|
|
ignored_command_in_paragraph |
|
|