Sun, 21 Jun 2009 18:47:57 +0100
Add support for specifying a year in the input
4 | 1 | #!/usr/bin/env lua |
2 | ||
0
44416491923e
Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
3 | local ndp = require "ndp"; |
44416491923e
Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
4 | |
44416491923e
Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
5 | local base; |
44416491923e
Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
6 | for line in io.lines() do |
44416491923e
Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
7 | if line:match("^base:%d+$") then |
44416491923e
Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
8 | base = tonumber(line:match("^base:(%d+)$")); |
44416491923e
Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
9 | else |
3 | 10 | local ret = ndp.when(line, base); |
0
44416491923e
Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
11 | print(os.date("%c", ret).." ("..ret..")"); |
44416491923e
Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
12 | end |
44416491923e
Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
13 | end |
44416491923e
Initial commit of ndp, the natural date processing library
Matthew Wild <mwild1@gmail.com>
parents:
diff
changeset
|
14 |