I have a small sinatra app that I use to run a basic website. Content for the specified site is provided by the client, and most of it comes from PDF files. Since I donβt need to manually replace all < with < & on & Is there a way to configure HAML / Sinatra for this automatically for me?
Basically, I have a few blocks that look like this:
%p large block of text here... multi-line so I can see it in my IDE... more lines here...
I would just like to find the config option, which tells HAML to go through all the content and replace the unsafe characters with its copies of the HTML entity.
I tried using the HTMLEntities stone, but there are many multi-line paragraphs on this site, and I could not get it to work. By this, I mean that I would do something like this in my server.rb file:
def "/some_url" @encoder = HTMLEntities.new haml :some_template end
And in my template:
%p = @encoder.encode("Really long multiline string... some more lines here... and more lines...")
And he spat out a mistake about the lack of closure ) .
source share