summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/lyluatex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2017-12-06 23:56:38 +0000
committerKarl Berry <karl@freefriends.org>2017-12-06 23:56:38 +0000
commitda0eaf985023f5c7085d52ea43031045a585f63d (patch)
tree127fcac73d9bd6b20e4d0e2cae6c1504d8d5b217 /Master/texmf-dist/scripts/lyluatex
parentc6ba83a91ec48c7986e2445f0795b1c006927d4c (diff)
lyluatex (7dec17)
git-svn-id: svn://tug.org/texlive/trunk@46005 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/lyluatex')
-rwxr-xr-xMaster/texmf-dist/scripts/lyluatex/lyluatex.lua33
1 files changed, 17 insertions, 16 deletions
diff --git a/Master/texmf-dist/scripts/lyluatex/lyluatex.lua b/Master/texmf-dist/scripts/lyluatex/lyluatex.lua
index 599eb7b8bb3..bf9b29579d4 100755
--- a/Master/texmf-dist/scripts/lyluatex/lyluatex.lua
+++ b/Master/texmf-dist/scripts/lyluatex/lyluatex.lua
@@ -2,9 +2,9 @@ local err, warn, info, log = luatexbase.provides_module({
name = "lyluatex",
version = '0',
greinternalversion = internalversion,
- date = "2017/11/27",
+ date = "2017/12/05",
description = "Module lyluatex.",
- author = "The Gregorio Project (see CONTRIBUTORS.md)",
+ author = "The Gregorio Project − Jacques Peron <cataclop@hotmail.com>",
copyright = "2008-2017 - The Gregorio Project",
license = "MIT",
})
@@ -42,17 +42,20 @@ end
function direct_ly(ly, largeur, facteur)
N = N + 1
+ largeur = {['n'] = largeur:match('%d+'), ['u'] = largeur:match('%a+')}
facteur = calcul_facteur(facteur)
ly = ly:gsub('\\par ', '\n'):gsub('\\([^%s]*) %-([^%s])', '\\%1-%2')
- local sortie = TMP..'/'..string.gsub(md5.sumhexa(contenuIntegral(ly))..'-'..facteur..'-'..largeur, '%.', '-')
+ local sortie =
+ TMP..'/'..string.gsub(md5.sumhexa(contenuIntegral(ly))..'-'..facteur..'-'..largeur.n..largeur.u, '%.', '-')
if not lfs.isfile(sortie..'-systems.tex') then
- compiler_ly(entete_lilypond(facteur, largeur - 10)..'\n'..ly, sortie, true)
+ compiler_ly(entete_lilypond(facteur, largeur)..'\n'..ly, sortie, true)
end
- retour_tex(sortie)
+ retour_tex(sortie, facteur)
end
function inclure_ly(entree, currfiledir, largeur, facteur, pleinepage)
+ largeur = {['n'] = largeur:match('%d+'), ['u'] = largeur:match('%a+')}
facteur = calcul_facteur(facteur)
nom = splitext(entree, 'ly')
entree = currfiledir..nom..'.ly'
@@ -61,7 +64,7 @@ function inclure_ly(entree, currfiledir, largeur, facteur, pleinepage)
local i = io.open(entree, 'r')
ly = i:read('*a')
i:close()
- local sortie = TMP..'/' ..string.gsub(md5.sumhexa(contenuIntegral(ly))..'-'..facteur..'-'..largeur..'-', '%.', '-')
+ local sortie = TMP..'/'..string.gsub(md5.sumhexa(contenuIntegral(ly))..'-'..facteur..'-'..largeur.n..largeur.u..'-', '%.', '-')
if pleinepage then sortie = sortie..'-pleinepage' end
if not lfs.isfile(sortie..'-systems.tex') then
if pleinepage then
@@ -70,10 +73,10 @@ function inclure_ly(entree, currfiledir, largeur, facteur, pleinepage)
i:write('\\includepdf[pages=-]{'..sortie..'}')
i:close()
else
- compiler_ly(entete_lilypond(facteur, largeur - 10)..'\n'..ly, sortie, true, dirname(entree))
+ compiler_ly(entete_lilypond(facteur, largeur)..'\n'..ly, sortie, true, dirname(entree))
end
end
- retour_tex(sortie)
+ retour_tex(sortie, facteur)
end
@@ -123,13 +126,13 @@ function entete_lilypond(facteur, largeur)
%%Paramètres de la partition
\paper{
indent = 0\mm
- line-width = %s\pt
+ line-width = %s\%s
}
%%Partition originale
]],
facteur,
-largeur
+largeur.n, largeur.u
)
end
@@ -140,14 +143,12 @@ function calcul_facteur(facteur)
end
-function retour_tex(sortie)
+function retour_tex(sortie, facteur)
local i = io.open(sortie..'-systems.tex', 'r')
- contenu = i:read("*all")
+ local contenu = i:read("*all")
i:close()
- texoutput, _ = string.gsub(
- contenu,
- [[includegraphics{]], [[includegraphics{]]..dirname(sortie)
- )
+ local texoutput, nbre = contenu:gsub([[\includegraphics{]],
+ [[\includegraphics{]]..dirname(sortie))
tex.print(([[\noindent]]..texoutput):explode('\n'))
end