Skip to content

Commit efa1439

Browse files
committed
Simpler basename function for extract.lua pgf-tikz#640
1 parent 710bd7f commit efa1439

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

doc/generic/pgf/extract.lua

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,15 +89,8 @@ local extractor = lpeg.P{"document",
8989

9090
-- get the basename and extension of a file
9191
local basename = function(file)
92-
local stripper = P{"stripext",
93-
dot = P".",
94-
other = C((1 - V"dot")^0),
95-
stripext = Ct( C(V"dot"^-1) * V"other" * (V"dot" * V"other")^0 )
96-
}
97-
local matches = lpeg.match(stripper, file)
98-
local ext = table.remove(matches)
99-
local basename = table.concat(matches)
100-
return basename, ext
92+
local basename, ext = string.match(file, "^(.+)%.([^.]+)$")
93+
return basename or "", ext or file
10194
end
10295

10396
-- Main loop

0 commit comments

Comments
 (0)