date config again

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

date config again

Bruce D'Arcus-3
I'm just about done reworking citeproc to use rdf instead of MODS, and
have been simplifying the code along with this.

One of those changes was to add a cp:format-date function, which
simplifies things a fair bit compared the MODS equivalent.

Here's how dates are currently configured in CSL:

       <date-config jan="January" feb="February" mar="March" apr="April"
may="May" jun="June"

One then has to do stuff like this in each definition:

<refttype ..>


Here is how formating config is now handled in my latest experiments:

       <date-config full="[Y], [MNn] [D]" month-day="[MNn] [D]"/>

What's good about this: uses xpath 2.0-native date config and it
handles internationalization. Really easy n other words.

What is not so good: different languages handle this formatting config
differently. Ruby, Python, PHP, Perl and probably a bunch of other
languages all do something like this:

       <date-config full="%Y, %B %d" month-day="%B %d"/>

So I could do that and just figure out how to use xpath to convert it
to its native syntax.

Or, I could do this all XML; a la:

       <prefix> </prefix>

So configuring it in CSL would be:

<date form="full"/>

... or:

<date form="month-day"/>

Any opinions?


Reply | Threaded
Open this post in threaded view

Re: date config again

Johan Kool-2
Hmm.... that's a tricky question. I would certainly stay away from  
using the %Y %B %d etc. notation. That would result in a weird  
combination of languages. The XPath notation is I think somewhat  
easier to read and use than using the XML way. I think I would go  
with the XPath way, as that seems to be easiest for the current  
citeproc implementation, and any future implementations in Perl etc.  
should be able to convert [Y] to %Y etc.