ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Bug when stripping file name suffix.
@ 2013-01-30 14:00 Andre Caldas
  0 siblings, 0 replies; only message in thread
From: Andre Caldas @ 2013-01-30 14:00 UTC (permalink / raw)
  To: ConTeXt users

Hello!

The file tex/context/base/l-file.lua
has a small bug in function remove suffix. The problem is that strings like
path/./to/file
become
path/

Here is a fix:

diff --git a/tex/context/base/l-file.lua b/tex/context/base/l-file.lua
index e91eeac..bb63359 100644
--- a/tex/context/base/l-file.lua
+++ b/tex/context/base/l-file.lua
@@ -166,7 +166,7 @@ end
 -- inspect(file.nametotable("dir/file.ext"))
 -- inspect(file.nametotable("/dir/file.ext"))

-local pattern = Cs(((period * noperiod^1 * -1)/"" + 1)^1)
+local pattern = Cs(((period * (1-period-slashes)^1 * -1)/"" + 1)^1)

 function file.removesuffix(name)
     return name and lpegmatch(pattern,name)
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-01-30 14:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-30 14:00 Bug when stripping file name suffix Andre Caldas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).