CSL macro bundles

The legal styles we’re building on CitationStylist will need to share
a lot of code, since citation forms are jurisdiction-specific. This
looked like becoming a maintenance headache, so I spent the better
part of yesterday building a Python script to populate self-contained
macro sets from a “home” style to others that depend on it. It’s
worked out pretty well, so this afternoon I did some more work to
generalize the script. It’s now available here:

https://bitbucket.org/fbennett/cslmodules

A README in the repo explains how it works, but basically you set up a
config file for each style that has dependencies, indicating the names
of the code bundles it needs and the style that contains each one. The
script will then check for a -bundle-start macro in both the
receiving and the source style, and if both are found, it will grab
all macros ultimately called through the -bundle-start macro and
move them across. To allow small variations in formatting, macros that
don’t change apart from a small list of “cosmetic” attributes are not
overwritten.

The script might be useful for sharing code within a family of styles,
or for self-contained citation types (patent?) that might be shared
more widely.

Hope it’s useful.

Frank

The script might be useful for sharing code within a family of styles,
or for self-contained citation types (patent?) that might be shared
more widely.

And more widely still, does it not also demonstrate the sort of
macro-based assembly of styles we’ve talked about for a CSL
creator/editor? E.g. one could hook this up to a UI?

Bruce

The script might be useful for sharing code within a family of styles,
or for self-contained citation types (patent?) that might be shared
more widely.

And more widely still, does it not also demonstrate the sort of
macro-based assembly of styles we’ve talked about for a CSL
creator/editor? E.g. one could hook this up to a UI?

Bruce

It could help move things in that direction. Someone working with this
while hand coding would be rewarded for adopting consistent structures
across styles, which might help to reduce the number of variations,
and reveal what a CSL macro library might look like.