Style inheritance and dependent styles.
See original GitHub issueI’m new to CSL and as I understand it there is no style inheritance mechanism. That is, the ability to have a smaller csl file with a few modifications to citation and bibliography styles that are contained in a base csl file.
There are “dependent styles”, http://docs.citationstyles.org/en/stable/specification.html#dependent-styles …
A dependent style is an alias for an independent style. Its contents are limited to style metadata, and doesn’t include any formatting instructions (the sole exception is that dependent styles can specify an overriding style locale).
… but that just aliases the parent style and there’s not room for providing overriding styles.
From https://github.com/citation-style-language/styles/wiki/Style-Requirements
If you started from another CSL style, delete the original style authors and contributors, and point to the original style with a “template” link:
<info> <link href="http://www.zotero.org/styles/original-style" rel="template"/> </info>
… that suggests rel="template"
serves as a mere informational reference.
If I’m right there’s no style inheritance mechanism would there be appetite for this as a feature request?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:44 (26 by maintainers)
Top GitHub Comments
You’re right. Here’s the issue:
https://github.com/citation-style-language/csl-evolution/issues/15
There weren’t strong feelings one way or the other, so we erred for conservatism.
I read through the long thread which was opened several years ago. I realized this issue after manually edited two CSL styles recently, and this is why I’m here.
After searching CSL inheritance for some time, I found CSL dependence actually has no relation with inheritance.
I’m a python developer, and I want to introduce you the jinja template I adopted at the beginning of my career. Jinja (now version 3.0) is a sharping tool for templates that could extend parent templates and include children.
So basically I split the parent style (For example, APA) into several module templates. The template folder has a tree structure, such as:
And for example, I want to edit a new style which is based on APA, I would edit the new style.xml as :
And finally, we have a python script to compile templates to strings and saved to the new style.xml.
So we could get a new style that extends from APA. I haven’t open sourced all of my styles, but I make this philosophy available in my team to make style writing(modification) plausible.
Just for your reference.