Fix incorrect regex: asterisks don't need to be quoted when used in a character set. This incorrectly included the backslash into the character set.

This commit is contained in:
Nero 2024-03-27 08:53:16 +00:00
parent ee7a558a1d
commit 2ac267e68f
1 changed files with 2 additions and 2 deletions

4
md2tex
View File

@ -45,8 +45,8 @@ function inline(text) {
gsub(/&/, "\\\\&", text)
gsub(/\^/, "\\textasciicircum ", text)
gsub(/\.{3,}/, "\\ldots", text)
text = gensub(/\*\*([^\*]*)\*\*/, "\\textbf{\\1}", "g", text)
text = gensub(/\*([^\*]*)\*/, "\\emph{\\1}", "g", text)
text = gensub(/\*\*([^*]+)\*\*/, "\\textbf{\\1}", "g", text)
text = gensub(/\*([^*]+)\*/, "\\emph{\\1}", "g", text)
text = gensub(/`([^`]*)`/, "\\texttt{\\1}", "g", text)
# links
text = gensub(/\[(.*)\]\((.*)\)/, "\\href{\\2}{\\1}\\footnote{\\url{\\2}}", "g", text)