This commit is contained in:
1 parent
68058c16e6
commit
b99916e9d8
2 files changed
+40
No files matched your search
@@ -31,3 +31,5 @@ tags
|
||||
/.run/
|
||||
/out/
|
||||
*.awk
|
||||
# Required source for the Jenkins release-notes appendix.
|
||||
!/scripts/release-notes.awk
|
||||
@@ -0,0 +1,38 @@
|
||||
# Convert the Markdown emitted by release-notes.sh to a safe LaTeX appendix.
|
||||
# Escape character by character so commit messages cannot become TeX commands.
|
||||
function tex(value, result, i, c) {
|
||||
result = ""
|
||||
for (i = 1; i <= length(value); i++) {
|
||||
c = substr(value, i, 1)
|
||||
if (c == "\\") result = result "\\textbackslash{}"
|
||||
else if (c == "{" || c == "}" || c == "$" || c == "&" || c == "#" || c == "_" || c == "%") result = result "\\" c
|
||||
else if (c == "~") result = result "\\textasciitilde{}"
|
||||
else if (c == "^") result = result "\\textasciicircum{}"
|
||||
else if (c == "`") result = result "\\textasciigrave{}"
|
||||
else result = result c
|
||||
}
|
||||
return result
|
||||
}
|
||||
BEGIN {
|
||||
print "% Generated by the Build LaTeX stage; do not edit."
|
||||
print "\\chapter{Release Notes}"
|
||||
print "\\label{release-notes}"
|
||||
print "\\begingroup\\raggedright"
|
||||
}
|
||||
/^# Changes in / {
|
||||
print "\\section*{" tex(substr($0, 3)) "}"
|
||||
next
|
||||
}
|
||||
/^- / {
|
||||
if (!items) { print "\\begin{itemize}"; items = 1 }
|
||||
print "\\item " tex(substr($0, 3))
|
||||
next
|
||||
}
|
||||
{
|
||||
if (items) { print "\\end{itemize}"; items = 0 }
|
||||
print tex($0)
|
||||
}
|
||||
END {
|
||||
if (items) print "\\end{itemize}"
|
||||
print "\\endgroup"
|
||||
}
|
||||
Reference in new issue
Block a user