Closed eroux closed 2 years ago
found this: https://github.com/nicompte/edtfy
yes, this is the other way around though (parsing plain English into EDTF)
oh I see! sorry but there seems be an associated "backwards" package: https://github.com/nicompte/unedtfy (but not updated since 2016 though...)
ah I see... I think it will be easier once we integrate edtf.js, we can make use of it for parsing
there seems be an associated "backwards" package: https://github.com/nicompte/unedtfy
installed it, could only parse edtf date but not export it to human-readable format though
I guess it's normal since there seems to be only one initial commit in the repo (see /tests
)
yes, let's not rely on it, I'll write the code if you want, I'm just swamped in the list serialization issue
no problem! I can do it, should be straightforward
needs some further testing but almost done:
beside an annoying soon-to-be-fixed UI bug moving cursor while typing when an error is detected, some oddities though:
wonderful, that's a very nice code!
I'm wondering what 18
means in EDTF though, it's a bit unclear... does it mean 0018
or 2018
? anyways, it's a minor issue
Also, can you test it for decades? 197X
should be "1970s" (I think...)
Otherwise this is really good, thanks a lot!
18 is unambiguously 19th c.:
so why not do that:
ok for decades:
great! this is enough for a first iteration!
added EDTF error message when more informative than "syntax error" or "no parsing possible":
as a help for the dates field, it would be good to have a humanizer for EDTF that we can plugin in the same UI space as the Unicode preview for Wylie fields. The humanizer could then be used on PDL to display the date.
There's a PHP library and a Ruby gem to take inspiration from, but no JS library...
We can start with the most important patterns, in that order (it has to be recursive):
[x,y,z]
=>x, y or z
{x,y,z}
=>x, y and z
x/y
=>between x and y
x/
=>not before x
/x
=>not after x
x~
=>circa x
x?
=>x?
x%
=>circa x?
zXX
=>(z+1)th c.
(ex:12XX
=>13th century