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

Listing all styles, including dependents #6

Open
dginev opened this issue Jul 11, 2016 · 7 comments
Open

Listing all styles, including dependents #6

dginev opened this issue Jul 11, 2016 · 7 comments

Comments

@dginev
Copy link

dginev commented Jul 11, 2016

I may be missing something here, so this may be a question rather than a feature request.

When I try to list all available CSL styles on the local filesystem via:

CSL::Style.list.count
# returns: 1302 

I seem to be missing out on all of the styles under dependent/. For now I have resorted to add my own code to look specifically in CSL::Style.root + "/dependent, but shouldn't this be part of the official API?

Or am I misunderstanding something about the dependent styles in CSL?

I would expect to see .list return the same as:

Dir.glob(CSL::Style.root + '/**/*.csl').count
# returns 8145 

Thanks for any advice!

@dginev
Copy link
Author

dginev commented Jul 11, 2016

There is a second part to this question, which is that I can't do a CSL::Style::load on a dependent style either, as it is not found on the filesystem. I assume the /dependent subdirectory is never looked into. Curious to learn about why.

@inukshuk
Copy link
Owner

It's just a missing feature. You're absolutely right that the dependent folder should be searched when loading styles, I just never got around to implementing it, because I never needed dependent styles myself.

@dginev
Copy link
Author

dginev commented Jul 13, 2016

Got it. I'll try to contribute a PR or two that adds these, but I'm a bit confused since this may be touching several of the repositories. For example, even if I get a :dependent_style symbol or dependent/style.csl path, CiteProc::Processor won't be able to use it. And that's in a different repo altogether.

But now that I understand it's a missing feature, I can make headway - thanks!

@dginev dginev closed this as completed Jul 13, 2016
@dginev dginev reopened this Jul 13, 2016
@dginev
Copy link
Author

dginev commented Jul 13, 2016

(closed by accident)

@dginev
Copy link
Author

dginev commented Jul 13, 2016

Actually, scratch my last comment - the processor works just fine, it's just that some of the dependent styles are missing a bibliography node, such as:

CSL::Style.load('dependent/homo-journal-of-comparative-human-biology.csl').bibliography
# returns nil

I'm still a beginner in the world of CSL/citeproc, so apologies if I am overly confused.

@dginev
Copy link
Author

dginev commented Jul 13, 2016

Right, perfectly obvious. For this to work the bibliography needs to be loaded from the dependent's parent elsevier-harvard, which isn't yet implemented. Got it.

@inukshuk
Copy link
Owner

Yes, the three repos are a bit cumbersome. The decision to extract csl-ruby is a good one; as a CSL library it is useful for tasks other than rendering citations or references. For example, we use it for the testing the official styles; you can use it to work with styles (e.g., an editor or making dynamic adjustments etc.). The citeproc gem is split into two for historical reasons: at one point I wanted to be able to swap out the Ruby rendering engine and use citeproc-js (embedded in Ruby) instead -- so citeproc-ruby is the rendering engine while citeproc handles processor state and manages the input.

Anyway, yes, to use dependent styles you would basically just load their independent parent. Also see here for a related discussion. There is already some functionality to load the corresponding independent style so what's missing, mostly, is a convenient way to list all styles and load them by name. If I remember correctly, a dependent style could in theory include their own locale which would have to be merged into the independent style. I think that's the only case that can result in different output when using a dependent style versus using the independent parent directly. (However, the last time I checked there was no dependent style in the official repository that defined their own locale).

Apart from being able to list all dependent styles, I think it would make sense for the processor to load an independent parent automatically if you pass it a dependent style.

joshweir added a commit to joshweir/csl-ruby that referenced this issue Oct 8, 2017
joshweir added a commit to joshweir/csl-ruby that referenced this issue Oct 8, 2017
joshweir added a commit to joshweir/csl-ruby that referenced this issue Oct 8, 2017
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