Open retorquere opened 5 years ago
You can load a style by passing an absolute path or URL instead of the name, or, if you would like to be able to load the styles via short names you can set the style/locale roots to the folder where you keep the styles.
The csl-styles
gem does nothing but this -- setting the root folders to its own styles/locales folders (which are just pulled from the CSL repositories).
And if I pass it an url, it will download the style? Awesome, that actually solves a different problem immediately.
Yes, if I remember correctly it should download the style. By the way, here's the test setup from the official styles repo -- that might be helpful as well.
Generally, you should try to load styles only once if you process many items over time (regardless of whether you load from the file system or via URL, parsing the style takes more time than rendering citations usually).
smacks forehead I was rummaging around there and it didn't dawn upon me that they were using this gem. This is going to prevent a slew of questions I was about to ask. Thanks!
When I pass an URL, is there a way for me to add custom headers? I need to pull a file from the github API. I could store it in a temp file, but if it's not required, that'd be preferable.
No, I'm afraid there's no way to do that at the moment. You can however, pass the contents of the CSL instead of a path, so you won't need to create a temp file.
That will work just fine - thanks!
I am looking to use the ruby citeproc gems to test styles that are not in
csl/styles
-- how would I feed the style to the processor in this case?