Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I bring in my own styles rather than require-ing csl/styles? #65

Open
retorquere opened this issue May 9, 2019 · 7 comments
Open

Comments

@retorquere
Copy link

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?

@inukshuk
Copy link
Owner

inukshuk commented May 9, 2019

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).

@retorquere
Copy link
Author

And if I pass it an url, it will download the style? Awesome, that actually solves a different problem immediately.

@inukshuk
Copy link
Owner

inukshuk commented May 9, 2019

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).

@retorquere
Copy link
Author

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!

@retorquere
Copy link
Author

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.

@inukshuk
Copy link
Owner

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.

@retorquere
Copy link
Author

That will work just fine - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants