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

Rendering verbatim author strings with {} #77

Open
mjy opened this issue Sep 13, 2021 · 3 comments
Open

Rendering verbatim author strings with {} #77

mjy opened this issue Sep 13, 2021 · 3 comments

Comments

@mjy
Copy link

mjy commented Sep 13, 2021

Checking to see if I'm missing something obvious.

When I want to render a verbatim author string (e.g. Consortium of Grand Poobahs), then the author string is parsed.

Code is a wrapper, not native, but you can see what I'm getting at here:

a.author = 'Consortium of Grand Poobahs'
ap a.render_with_style('vancouver', 'text', false)
# => "Grand Poobahs C of. TaxonWorks - Codebase [Internet]. d: c; 2021. Available from: https://taxonworks.org"

vs.

a.author = '{Consortium of Grand Poobahs}'
ap a.render_with_style('vancouver', 'text', false)
"{Consortium of Grand Poobahs}. TaxonWorks - Codebase [Internet]. d: c; 2021. Available from: https://taxonworks.org"

I note that {} in author is being assigned in to_citeproc as "author"=>[{"family"=>"{Consortium of Grand Poobahs}"}, this is probably why it renders "cleanly".

Questions:

  • Are the {} handled this way by chance, or by design?
  • Can I render and have {} struck, or is this .csl specific?
  • Does it make sense to write a default :text render rule to handle the striking of one set of wrapping {}?

Thanks!

@inukshuk
Copy link
Owner

If you pass the author as a single string, it will try to parse it. The {} cause the parsing to fail, so it falls back to the literal input instead. So this behavior is incidental, the brackets do not preserve the string by definition.

In order to by-pass name passing you can pass the author as an object. Since this is a literal name and not a personal name with family/given parts you would want to set it to: { "literal" => "Consortium of Grand Poobahs" }.

@mjy
Copy link
Author

mjy commented Sep 14, 2021

Wonderful, thanks.

A followup, we're getting to citeproc form using the BibTeX::Entry.new(bibtex_type: bibtex_type).to_citeproc pattern. Is there a similar convention for BibTeX::Entry for literals that could be used so that I won't have to tweak the to_citeproc return?

E.g. this transition:

b.author = {literal: 'foo and the bar'}
 => {:literal=>"foo and the bar"} 
2.7.4 :028 > b.to_citeproc
 => {"publisher-place"=>"d", "author"=>[{"family"=>"{:literal=>\"foo and the bar\"}"}], 

@inukshuk
Copy link
Owner

I don't think bibtex-ruby has the concept of literal names, so you'll likely need to implement or tweak the conversion to CSL-JSON.

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