bdarcus / csl-next-attic

a very tentative experiment ATM ...
2 stars 0 forks source link

Add conversion script from CSL 1.0 styles #20

Open bdarcus opened 1 year ago

bdarcus commented 1 year ago

If this is to go anywhere (still not clear it should, much less that it will) but assuming it does ...

After it stabilizes a bit more, this would be the next step:

Someone, likely with better programming skills than I (or at least more time), needs to write an update script, to see if it's even possible.

I think it is, but we need to know for sure, and we need to be able to have those styles available.

XSLT is in general well-suited to this sort of thing (for example), but there may be details better to couple with a traditional programming language. Example in python:

https://lxml.de/extensions.html

EDIT: I did add the start of an XSLT to #18.

https://gist.github.com/matejskubic/5865576 https://stackoverflow.com/a/42287010

After thinking about it, the hard part would be converting sorting and grouping logic to this (at least the current iteration). This would be tough, I think, using XSLT:

  <citation et-al-min="3" et-al-use-first="1" disambiguate-add-year-suffix="true" disambiguate-add-names="true" disambiguate-add-givenname="true" collapse="year" givenname-disambiguation-rule="primary-name-with-initials">
<!--
The above attributes are mostly relating to grouping, but of different kinds of lists and groups (names, authors, years).

The below is in the end an author-year sorting spec, but how to know that for sure, and what other variants there may be?
-->
    <sort>
      <key macro="author-bib" names-min="3" names-use-first="1"/>
      <key macro="date-sort-group"/>
      <key macro="date-sort-date" sort="ascending"/>
      <key variable="status"/>
    </sort>
      <list delimiter=", " group-by="cs:author" sort="cs:author">
        <reference template="apa-authors"/>
        <list prefix="(" suffix=")" group-by="cs:year" sort="cs:year">
          <reference template="date-year"/>
          <reference template="citation-locator"/>
        </list>
      </list>

Really we might want a separate set of code that can analyze existing, in particular, sorting logic, and figure out how to map it to this.

The one thing that may make this easier is sorting and grouping logic is now pretty tightly constrained to particular nodes.

Of course, this is all highly experimental and unstable. But it's worth thinking about conversion early, to avoid problems if this does go anywhere.

Also, would need this to extract appropriate macros for potential inclusion in shared template files.