Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 1224 #1344

Merged
merged 4 commits into from
Apr 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ As of v3.0.0 this project adheres to [Semantic Versioning](http://semver.org/).
- The printing of the commentary box is no longer tied to the printing of the inital. As a result it is now possible to have a score which has a commentary but not an initial. See [this thread on the user list](http://www.mail-archive.com/gregorio-users@gna.org/msg03911.html).
- Elisions after a vowel centering prefix will no longer cause the center to be placed on the vowel in the prefix. Since prefixes are unvoiced vowels, this makes more sense than the previous behavior. As usual, you may use the manual centering features to force the centering where you want if this does not produce what you want. See [#1320](https://github.com/gregorio-project/gregorio/issues/1320).
- Dynmanic line spacing when a clef change occurs at the end of a line is fixed so that the line after the clef change is spaced appropriately. See [#1285](https://github.com/gregorio-project/gregorio/issues/1285).

- Spaces in the filename of a score no longer cause Gregoriotex to fail. See [#1224](https://github.com/gregorio-project/gregorio/issues/1224).

## [5.0.0-beta2] - 2017-02-24
### Fixed
Expand Down
42 changes: 26 additions & 16 deletions tex/gregoriotex.lua
Original file line number Diff line number Diff line change
Expand Up @@ -740,7 +740,7 @@ local function compile_gabc(gabc_file, gtex_file, glog_file, allow_deprecated)
extra_args = extra_args..' -D'
end

local cmd = string.format("%s %s -W -o %s -l %s %s", gregorio_exe, extra_args,
local cmd = string.format("%s %s -W -o %s -l %s '%s'", gregorio_exe, extra_args,
gtex_file, glog_file, gabc_file)
res = os.execute(cmd)
if res == nil then
Expand Down Expand Up @@ -795,21 +795,31 @@ local function compile_gabc(gabc_file, gtex_file, glog_file, allow_deprecated)
end

local function include_score(input_file, force_gabccompile, allow_deprecated)
local file_root
if string.match(input_file:sub(-5), '%.gtex') then
file_root = input_file:sub(1,-6)
elseif string.match(input_file:sub(-4), '%.tex') then
file_root = input_file:sub(1,-5)
elseif string.match(input_file:sub(-5), '%.gabc') then
file_root = input_file:sub(1,-6)
elseif not file_root then
file_root = input_file
end
local gtex_file = file_root.."-"..internalversion:gsub("%.", "_")..".gtex"
local glog_file = file_root.."-"..internalversion:gsub("%.", "_")..".glog"
local gabc_file = file_root..".gabc"
if string.match(input_file, "[#%%]") then
err("GABC filename contains invalid character(s): # %%\n"
.."Rename the file and retry: %s", input_file)
end
local has_extention = false
local file_dir,input_name
local extensions = {['gabc']=true, ['gtex']=true, ['tex']=true}
if extensions[string.match(input_file, "([^%.\\/]*)$")] then
has_extention = true
end
if has_extention then
file_dir,input_name = string.match(input_file,
"(.-)([^\\/]-)%.?[^%.\\/]*$")
else
file_dir,input_name = string.match(input_file, "(.-)([^\\/]*)$")
end

local cleaned_filename = input_name:gsub("[%s%+%&%*%?$@:;!\"\'`]", "-")
local gabc_file = string.format("%s%s.gabc", file_dir, input_name)
local gtex_file = string.format("%s%s-%s.gtex", file_dir, cleaned_filename,
internalversion:gsub("%.", "_"))
local glog_file = string.format("%s%s-%s.glog", file_dir, cleaned_filename,
internalversion:gsub("%.", "_"))
if not lfs.isfile(gtex_file) then
clean_old_gtex_files(file_root)
clean_old_gtex_files(file_dir..cleaned_filename)
log("The file %s does not exist. Searching for a gabc file", gtex_file)
if lfs.isfile(gabc_file) then
local gabc = io.open(gabc_file, 'r')
Expand Down Expand Up @@ -842,7 +852,7 @@ local function include_score(input_file, force_gabccompile, allow_deprecated)
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, glog_file, allow_deprecated)
elseif force_gabccompile then
compile_gabc(gabc_file, gtex_file, glog_file)
compile_gabc(gabc_file, gtex_file, glog_file, allow_deprecated)
end
tex.print(string.format([[\input %s\relax]], gtex_file))
return
Expand Down