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

Implement Cite Collapsing #46

Open
inukshuk opened this issue Jul 18, 2017 · 3 comments
Open

Implement Cite Collapsing #46

inukshuk opened this issue Jul 18, 2017 · 3 comments

Comments

@inukshuk
Copy link
Owner

https://github.com/citation-style-language/documentation/blob/master/specification.txt#L1655

Also see inukshuk/jekyll-scholar#196

@krafczyk
Copy link

krafczyk commented Jul 18, 2017

@inukshuk Where would be the right place to implement this? I might be able to do it if I know where to start and have a bit of extra time.

@inukshuk
Copy link
Owner Author

Citation nodes are currently rendered by the render_citation method (and render_single_citation directly below that). As you can see, there is a map and join using the layout's delimiter -- if collapse is set, we'd have to reduce the citations differently there. After a quick glance at the spec I'm a bit concerned about prefixes and suffixes, like brackets, because, if I'm not mistaken they would be rendered by the layout node. So render_single_citation and maybe even render_layout will have to be hoisted into the loop or passed some information that collapsing is taking place.

If it gets a little complicated, I'd move the relevant methods to renderer/citation.rb -- if you take a look at all these renderer files, you'll see that they all just open the Renderer class and add they're own private methods (so some additional care must be taken with regard to naming).

Generally, these features work really well with a TDD approach. Take a look at the renderer unit tests or renderer.feature for more high-level tests where you can pass in CSL snippets.

Finally, I don't know if it's relevant, but we're collapsing page numbers already -- perhaps some parts of that could be reused.

If you have any questions, just ask. The dev dependencies may be a bit dusty, because the gem has been in maintenance-only mode for some time, but the CI builds have been running fine recently so I'd hope it's easy to get set up!

@inukshuk
Copy link
Owner Author

Oh, if you do decide that render_layout will have to be aware of whether or not collapsing is taking place, let's discuss it in more detail. We have some state that is kept separately (and not passed down through all renderer methods) already (e.g. for suppression of author names or stuff like 'ibid' etc.).

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

No branches or pull requests

2 participants