Skip to content

Commit

Permalink
Showing 2 changed files with 22 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tex/gregoriotex.lua
Original file line number Diff line number Diff line change
@@ -203,14 +203,14 @@ local function include_score(input_file)
if lfs.isfile(gabc_file) then
compile_gabc(gabc_file, gtex_file)
else
err("The %s file does not exist.", gabc_file)
err("The file %s does not exist.", gabc_file)
return
end
end
local gtex_timestamp = lfs.attributes(gtex_file).modification
local gabc_timestamp = lfs.attributes(gabc_file).modification
if gtex_timestamp < gabc_timestamp then
log("%s has been modified and %s needs to be updates. Recompiling the gabc file.", gabc_file, gtex_file)
log("%s has been modified and %s needs to be updated. Recompiling the gabc file.", gabc_file, gtex_file)
compile_gabc(gabc_file, gtex_file)
end
tex.print(string.format("\\input %s", gtex_file))
24 changes: 20 additions & 4 deletions tex/gregoriotex.tex
Original file line number Diff line number Diff line change
@@ -1364,7 +1364,12 @@
%% score including
%%%%%%%%%%%%%%%%%%

% The primary macro that includes a score in gTeX or gabc format.
% The primary macro that includes a score. The lua function check that:
% -- The gtex file exists.
% -- The gtex file is of the correct gregoriotexapi_version.
% -- The gtex file is 'newer' than it's corresponding gabc file.
% If either test fails, the gabc file is (re)compiled.

\def\gre@includescore#1{%
\directlua{gregoriotex.include_score([[#1]])}%
\relax%
@@ -1406,9 +1411,20 @@
{\gre@includescore}%
}

% If called without the optional argument '\includescore{Antiphon}' the filename will be passed to the lua function 'include_score' which will check: whether the gtex file exists, if the API version of the gtex file, or if the gabc file is newer than the gtex file. If one of these tests fails, the gabc file will be (re)compiled.

% If called with the optional argument '\includescore[f]{Antiphon.gtex}' the gtex file will be forced into the document and will not be checked by the lua function 'include_score'. This does not bypass the API version test done by '\gregoriotexapiversion'.
% If called without the optional argument: '\includescore{Antiphon}'
% the filename will be passed to the lua function 'include_score'
% which will check: whether the gtex file exists, if the API version
% of the gtex file, or if the gabc file is newer than the gtex
% file. If one of these tests fails, the gabc file will be
% (re)compiled.
% The argument may or may not include a file extension. These are all valid:
% '\includescore{Antiphon}' or '\includescore{Antiphon.gabc}' or
% '\includescore{Antiphon.gtex}'

% If called with the optional argument: '\includescore[f]{Antiphon.gtex}'
% the gtex file will be forced into the document and will not be
% checked by the lua function 'include_score'. This does not bypass
% the API version test done by '\gregoriotexapiversion'.

%%%%%%%%%%%%%%%%%%%%%%%%%%
%% some hyphen definitions

0 comments on commit a6ad7bf

Please sign in to comment.