About your API proposal. It doesn’t make much sense to me yet. So far
I stored my references in a simple list, not an object. For some
purposes it might perhaps be handy, esp. for methods that search
trough and sort the list.
I was more thinking (and implementing) an object that does the actual
formatting (see citation_style.py). The references list is just a
"dumb" list. The actual “intelligent” stuff happens in citation_style.
OK, but I think we still need to think about the API.
My main part (see citeproc.py) handles file input, and takes care of
obtaining the needed citations/references and outputting it again
through the various drivers.
Or actually it’s named at the moment:
Peter was suggesting methods calls like:
… and Ed:
references = ReferenceList()
references added here
formatter = APAFormatter()
Am not sure what I think, but in any case, it makes sense to me that
one formats a list of references; list.format, or format(list).
You really want to synchronize the API across the different
implementations? Perhaps we should, but I am not yet convinced.
I think it’s enough to do a good one for the Python version and then
worry about others later.
Thinking about how people would actually use the code tends to result
in better design.
It might be worth thinking about three use scenarios:
- the simple script, commandline batch processing (a la BibTeX,
- a web app (say Django-based bib app, PyULike, etc.)
- a desktop app (Word or OpenOffice integration)
I think it’s possible to design things in a way that makes it easy to
any of them.
Btw, I am thinking to switch to use lxml which is ElementTree
compatible but has XPath support and RelaxNG validation, both of which
I think are very handy.
Why would RNG validation be “handy” (here; obviously it’s valuable for
CSL stuff per se)?
I only still have to figure out how we can distribute the final code
for CiteProc-py without requiring the user to have to get to install
lxml first. That isn’t something the average
computer user can do.
Right, and ElementTree is part of the standard library, isn’t it?
But if I am not mistaken it should be possible to wrap it all up into
easy installer packages, at least for OS X and Windows. The Linux
people likely will known how to get lxml installed, but also there it
should be possible. I just don’t yet know exactly
Any objections against using lxml?
Ideally, you’d use standard libraries, but if there’s a good case for
using something else, then you probably should. I don’t know Python
well enough to comment much on the best choice.