Skip to content

Commit

Permalink
prevent awk from replacing ampersand's with matched text
Browse files Browse the repository at this point in the history
  • Loading branch information
nuex committed Dec 2, 2011
1 parent f84c185 commit b07f9f4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/render.awk
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ action == "layout" {

# replace yield with rendered content
if (match($0, /{{{yield}}}/)) {
sub(/{{{yield}}}/, render_content(main))
sub(/{{{yield}}}/, escape_special_chars(render_content(main)))
}

if (layout == "") {
Expand Down Expand Up @@ -129,3 +129,9 @@ function run_filter(cmd, txt, rand_date, tmpfile, rendered_txt, date_cmd, filt

return rendered_txt
}

# Prevent awk from replacing ampersand's with matched text
function escape_special_chars( txt) {
gsub(/&/, "\\\\&", txt)
return txt
}

0 comments on commit b07f9f4

Please sign in to comment.