Closed joshweir closed 7 years ago
There is currently no shortcut to loading dependent styles, so you need to pass the full path to the style to load it. Note that you can't do much with a dependent style, but load its independent parent style (in theory could have different locale information, but when I last checked, no style in the official repo actually does that).
For context, also see: https://github.com/inukshuk/csl-ruby/issues/6 https://github.com/inukshuk/jekyll-scholar/issues/108
I made a change to address the rendering of dependent styles in this commit:
https://github.com/joshweir/citeproc-ruby/commit/8c8fbe16e24521a7b0f59fcb368b94ec8eb13fda
I retrieve the independent_parent
within the render
method and not in the initialize
method because I figure that the concern with the parent is only rendering and the dependent style may be used directly elsewhere within Engine
.
If this is something worth merging into main im happy to submit pull request, otherwise if there is any issues with this im happy to modify.
Thanks again.
We do something similar in jekyll-scholar
(namely, simply load the independent parent is a user loads a dependent style), but if we do it in citeproc-ruby
I suggest that we should check for and merge (or replace?) the style's locale data (and check the spec to see if there was anything else that dependent styles could define). In other words, when loading a dependent style, we should automatically try to load the independent parent and merge the two into a virtual style which can be used to render citations. Happy to accept a PR if you want to give it a try!
I want to render styles in both the
CSL::Style.root
directory and thedependent
sub directory, currently i can only render styles in theCSL::Style.root
and not thedependent
sub dir. How to do this?This works fine because the
apa
style sits in theCSL::Style.root
directory:If I want try to render the
3-biotech
style (which sits in thedependent
sub directory) I get error:I think this is because the
CSL::Style.root
is not pointing to thisdependent
sub directory - but if I change this to point to the sub directory i wont be able to call theapa
style any longer as its in the parent directory?Even if I do make this change, i get another error:
Thanks for this nice library btw :)