Skip to content

Commit

Permalink
Simpler basename function for extract.lua pgf-tikz#640
Browse files Browse the repository at this point in the history
  • Loading branch information
hmenke committed Apr 25, 2019
1 parent 710bd7f commit efa1439
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions doc/generic/pgf/extract.lua
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,8 @@ local extractor = lpeg.P{"document",

-- get the basename and extension of a file
local basename = function(file)
local stripper = P{"stripext",
dot = P".",
other = C((1 - V"dot")^0),
stripext = Ct( C(V"dot"^-1) * V"other" * (V"dot" * V"other")^0 )
}
local matches = lpeg.match(stripper, file)
local ext = table.remove(matches)
local basename = table.concat(matches)
return basename, ext
local basename, ext = string.match(file, "^(.+)%.([^.]+)$")
return basename or "", ext or file
end

-- Main loop
Expand Down

0 comments on commit efa1439

Please sign in to comment.