From 2ea260dbf1764fb085a913423e52cdbd76abe00c Mon Sep 17 00:00:00 2001 From: Nero <41307858+nero@users.noreply.github.com> Date: Tue, 26 Mar 2024 21:58:23 +0000 Subject: [PATCH] md2tex: Two bugs prevented graceful handling of ampersands in headings --- md2tex | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/md2tex b/md2tex index f9c9019..c493544 100755 --- a/md2tex +++ b/md2tex @@ -42,7 +42,7 @@ function inline(text) { gsub(/_/, "\\_", text) gsub(/#/, "\\#", text) gsub(/%/, "\\%", text) - gsub(/&/, "\\&", text) + gsub(/&/, "\\\\&", text) gsub(/\^/, "\\textasciicircum ", text) gsub(/\.{3,}/, "\\ldots", text) text = gensub(/\*\*([^\*]*)\*\*/, "\\textbf{\\1}", "g", text) @@ -88,13 +88,13 @@ function inline(text) { t="section" for (i=3; i<=d; i++) t="sub"t gsub(/^#* /, "", $0) - tag(t"{" $0 "}") + tag(t"{" inline($0) "}") next } /^### / { gsub(/^#* /, "", $0) - tag("subsection{" $0 "}") + tag("subsection{" inline($0) "}") next }