prevent awk from replacing ampersand's with matched text
This commit is contained in:
		
							parent
							
								
									f84c185a16
								
							
						
					
					
						commit
						b07f9f4fe8
					
				@ -58,7 +58,7 @@ action == "layout" {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  # replace yield with rendered content
 | 
					  # replace yield with rendered content
 | 
				
			||||||
  if (match($0, /{{{yield}}}/)) {
 | 
					  if (match($0, /{{{yield}}}/)) {
 | 
				
			||||||
    sub(/{{{yield}}}/, render_content(main))
 | 
					    sub(/{{{yield}}}/, escape_special_chars(render_content(main)))
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (layout == "") {
 | 
					  if (layout == "") {
 | 
				
			||||||
@ -129,3 +129,9 @@ function run_filter(cmd, txt,   rand_date, tmpfile, rendered_txt, date_cmd, filt
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  return rendered_txt
 | 
					  return rendered_txt
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Prevent awk from replacing ampersand's with matched text
 | 
				
			||||||
 | 
					function escape_special_chars(  txt) {
 | 
				
			||||||
 | 
					  gsub(/&/, "\\\\&", txt)
 | 
				
			||||||
 | 
					  return txt
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user