Removing LaTeX formatting commands
plessl opened this issue · 2 comments
I'm using latex-decode in bibtex-ruby for cleaning up my BibTeX entries before converting them to citeproc. A few of my BibTeX fields contain LaTeX markup, which is convenient when using the entry in LaTeX but causes problems for CSL. For example:
howpublished = {\url{http://www.awesome-website.com}},
or
note = {\textbf{Paper received the XYZ award}}
Would it still be in scope for latex-decode to remove such formatting instructions, or even to convert them to basic HTML representations, e.g, a hyperlink and ``` for the example above?
Cheers,
Christian
Since latex-decode converts to unicode only this is definitely out of scope since we should not presume that users are necessarily converting to HTML at all.
Having said that, we could add such an HTML conversion filter to bibtex-ruby. This should be pretty easy, take a look here for an example; https://github.com/inukshuk/bibtex-ruby/blob/master/lib/bibtex/filters/linebreaks.rb — basically you only need to inherit from BibTeX::Filter
and implement a method #apply
which will receive the value of each field. You can convert it to string, convert the LaTeX tags to HTML and return the string again.
Allright. I will put that on my TODO list and send you a pull request when done.