amagical-net / rails-latex

rails-latex is a renderer for rails which allows tex files with erb to be turned into an inline pdf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Escaping special characters like &

hammady opened this issue · comments

If a string to be rendered in erb contains & it generates a pdflatex error.
For example:

<%= @title %>

where @title contains &, gives an error.
Should escape special characters with .
If you do this manually, the & is converted to & due to html escaping.
A manual fix is to write @title.html_safe but that's not handy if you have a lot of strings.
Is there a way to fix these automatically?

Ops, I have just figured out the helper lesc!