Fix initials

This commit is contained in:
Olivier Berten 2021-03-06 19:57:59 +01:00
parent 1abfe35356
commit f62f0c9cc4

View File

@ -43,7 +43,7 @@ function mkstemp($suffix) {
return False; return False;
} }
function gregorio($s,$i=1) { function gregorio($s) {
$f = mkstemp('.gabc'); $f = mkstemp('.gabc');
fwrite($f[0],"nabc-lines: 1;\n%%\n".$s); fwrite($f[0],"nabc-lines: 1;\n%%\n".$s);
fclose($f[0]); fclose($f[0]);
@ -57,8 +57,6 @@ function gregorio($s,$i=1) {
unlink($gf); unlink($gf);
$tex = substr($tex,0,-12)."\n\\relax\n"; $tex = substr($tex,0,-12)."\n\\relax\n";
$tex .= "\\gresetinitiallines{$i}\n";
return $tex; return $tex;
} }
@ -140,23 +138,23 @@ function mgabc2tex($c, $firstverse = False) {
# Parsing gabc # Parsing gabc
# #
$g = json_decode($c['gabc']); $g = json_decode($c['gabc']);
$i = $c['initial']; if($c['initial'] != 1) $tex .= "\\gresetinitiallines{".$c['initial']."}\n";
if(is_array($g)) { if(is_array($g)) {
foreach($g as $l) { foreach($g as $l) {
if($l[0] == 'gabc') { if($l[0] == 'gabc') {
$tex .= gregorio($l[1], $i); $tex .= gregorio($l[1]);
$i = 0; $tex .= "\\gresetinitiallines{0}\n";
} else { } else {
$tex .= "\\vspace{10pt}\n".$l[1]."\\par\n"; $tex .= "\\vspace{10pt}\n".$l[1]."\\par\n";
} }
} }
} elseif($c['gabc_verses'] && !$firstverse) { } elseif($c['gabc_verses'] && !$firstverse) {
$tex .= gregorio($g."\n".$c['gabc_verses'], $i); $tex .= gregorio($g."\n".$c['gabc_verses']);
} elseif($c['tex_verses'] && !$firstverse) { } elseif($c['tex_verses'] && !$firstverse) {
$tex .= gregorio($g, $i); $tex .= gregorio($g);
$tex .= "\\vspace{10pt}\n".$c['tex_verses']."\\par\n"; $tex .= "\\vspace{10pt}\n".$c['tex_verses']."\\par\n";
} else { } else {
$tex .= gregorio($g, $i); $tex .= gregorio($g);
} }
# #
# Document footer # Document footer