Rendering verbatim author strings with `{}`
mjy opened this issue · 3 comments
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!
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" }
.
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\"}"}],
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.