From afa56afc7e47859afad818e79fcc0cb8fd545b6a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= <mpg@elzevir.fr>
Date: Wed, 12 May 2010 22:48:53 +0200
Subject: Revert part of 8aa37e31 that broke things.

---
 luatexbase-modutils.dtx | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

(limited to 'luatexbase-modutils.dtx')

diff --git a/luatexbase-modutils.dtx b/luatexbase-modutils.dtx
index 24f09bd..79bdb5f 100644
--- a/luatexbase-modutils.dtx
+++ b/luatexbase-modutils.dtx
@@ -355,13 +355,23 @@ local modules = modules or {}
 local requiredversions = {}
 %    \end{macrocode}
 %
-%    If the given string begins with a date in YYYY/MM/DD format, return the
-%    date as the number YYYYMMDD; otherwise, return nil.
+%    Convert a date in YYYY/MM/DD format into a number
 %
 %    \begin{macrocode}
 local function datetonumber(date)
-    local datenum, ok = version:gsub("^(%d%d%d%d)/(%d%d)/(%d%d).*", "%1%2%3")
-    return (ok == 1) and tonumber(datenum) or nil
+    numbers = string.gsub(date, "(%d+)/(%d+)/(%d+)", "%1%2%3")
+    return tonumber(numbers)
+end
+%    \end{macrocode}
+%
+%    Say if a string is a date in YYYY//MM/DD format.
+%
+%    \begin{macrocode}
+local function isdate(date)
+    for _, _ in string.gmatch(date, "%d+/%d+/%d+") do
+        return true
+    end
+    return false
 end
 %    \end{macrocode}
 %
@@ -371,9 +381,8 @@ end
 %    \begin{macrocode}
 local date, number = 1, 2
 local function parse_version(version)
-    local datenum = datetonumber(date)
-    if ok == 1 then
-        return {type = date, version = tonumber(datenum), orig = version}
+    if isdate(version) then
+        return {type = date, version = datetonumber(version), orig = version}
     else
         return {type = number, version = tonumber(version), orig = version}
     end
-- 
cgit v1.2.3

