prat0318 / json_resume

Generates pretty HTML, LaTeX, markdown, with biodata feeded as input in JSON
http://prat0318.github.io/json_resume
MIT License
1.36k stars 116 forks source link

single quotes converted to escape code ' #22

Closed sevko closed 9 years ago

sevko commented 9 years ago

When compiling to tex_pdf with Ruby 2.1.3, single quotes in some (not all) fields -- like bio_data.other_projects.items[0].time -- appear to get converted to XML-like escape codes: '. This isn't a problem with 1.9.3. Intended behavior, or a bug?

prat0318 commented 9 years ago

Thanks for the report. Definitely not an intended behavior, i will try to reproduce the error on my end.

prat0318 commented 9 years ago

I tried adding single quotes to bio_data.other_projects.items[0].headline and bio_data.other_projects.items[0].points (there was no time field) in ruby-2.1.3 [ x86_64 ] but couldn't repro the issue. It would be strange if this issue occurs with ruby version change, are you sure there was no other change involved.

sevko commented 9 years ago

Oh, I must've added the time field to my custom mustache template (see my resume.json and custom.mustache). The LaTeX versions were the same (and besides, the encoded ' were present right after the JSON was parsed into a hash), and the problem disappeared when I downgraded Ruby to 1.9.3. Seems like there are lots of other dependencies involved, though, so one of those might be the culprit and I'm not sure if it's worth the bother. Thanks for checking it out.

prat0318 commented 9 years ago

The issue was with the mustache template. By default, mustache tries to encode characters. If you provide {<%&time%>} instead of {<%time%>}, It doesn't convert then. So, you can simply add a & sign in your templates.