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

Case protecting braces are passed through to HTML #81

Open
luc-j-bourhis opened this issue Mar 31, 2023 · 4 comments
Open

Case protecting braces are passed through to HTML #81

luc-j-bourhis opened this issue Mar 31, 2023 · 4 comments

Comments

@luc-j-bourhis
Copy link

Consider

require 'bibtex'
require 'citeproc'
require 'csl/styles'

bib = BibTeX::Bibliography.parse(<<~'BIB'
  @book{Grant:2018,
    author = {Grant, Keith J.},
    publisher = {Manning},
    title = {{CSS} in depth},
    year = {2018}}
BIB
)
cp = CiteProc::Processor.new(style: 'apa', format: 'html')
cp.import(bib.to_citeproc)
puts cp.render(:bibliography, id: 'Grant:2018')

This produces

Grant, K. J. (2018). <i>{CSS} in depth</i>. Manning.

The braces are passed through all the way from BibTeX to HTML, leading to an incorrect rendering. The correct one would obviously be

Grant, K. J. (2018). <i>CSS in depth</i>. Manning.

since HTML respect the input case.

The issue might be in bibtex though: if so, I apologise for bugging you here.

@inukshuk
Copy link
Owner

I think the latex decode filter would strip those braces off by default. Something like bib.convert(:latex).to_citeproc

@luc-j-bourhis
Copy link
Author

Yes, sure but in the LaTeX world, removing those braces would not be correct because BibTeX styles may then put CSS in lower case (or more likely capitalise it in my example). Is there not the same issue with citeproc and csl/styles? My question may be completely dumb: I am just starting to use citeproc, coming from a LaTeX background.

@inukshuk
Copy link
Owner

Ah, I see. I might be missing something, but I don't think there's a standardized way in CSL to protect words like that.

@luc-j-bourhis
Copy link
Author

I see, thank you. Cognitive dissonance of mine then, and your solution works perfectly then (I already used it because there might be other LaTeX formatting that needs to be put in HTML form of course). I reckon this can be closed then.

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