On this Johan:
-c …, --csl=… use specified csl file or URL
-m …, --mods=… use specified mods file or URL
-o …, --output=… use specified output file
I suggest you make input generic, or leave it to a wrapper script that
imports the library. So I think you want to put this user-oriented
stuff in a separate file, and have there:
-s …, --style=… use specified csl style file or URL
-d …, --data=… use specified data file or URL
-o …, --output=… use specified output file
After all, it seems to me the input might be MODS, or RDF, or an SQL
database.
There are two approaches to this abstraction:
- Simon’s approach is to map source data to native Javascript (JSON?)
data structures. As he explains it:
We use something like this:
‘itemType’ => “book”
‘title’ => “Computer-Mediated Communication: Human-to-Human
Communication
Across the Internet”
‘dateAdded’ => “2006-03-12 05:25:50”
‘dateModified’ => “2006-03-12 05:25:50”
‘publisher’ => “Allyn & Bacon Publishers”
‘year’ => “2002”
‘pages’ => “347”
‘ISBN’ => “0-205-32145-3”
‘creators’ …
‘0’ …
‘firstName’ => “Susan B.”
‘lastName’ => “Barnes”
‘creatorType’ => “author”
My only complaint about this to him was the name model they’re using.
Also, the flat “publisher” structure might be a problem.
- My approach in citeproc-rb is fully object-based. For one thing,
citeproc-rb is not responsible for input. I leave that up to whoever
wants to use the library, and they simply have to create Reference
objects.
I tend to think (not being an expert mind you) each approach makes
sense in their respective contexts.
Simon is processing citations in a browser and the greater abstraction
I have is overkill for that context.
But I do think for languages like Python and Ruby, where the code might
be used in a lot of different contexts (desktop and web-based
applications, scripts, etc.), it makes sense to follow a strict OO
design approach.
In the end, for example, with the Ruby version (once it’s finished!),
I’d like a Rails web developer or a TeX developer be able to pick up
the library and easily integrate it into a solution: almost-instant
citation processing support.
This is why the unit tests and API discussion are important.
Bruce