From 29fdf6f6dae3f0299411519c5682dc611a3a4cd5 Mon Sep 17 00:00:00 2001 From: "Henry H. Andrews" Date: Thu, 16 May 2024 08:32:40 -0700 Subject: [PATCH] Correctly handle appendicies in md2html We have an Appendix A that was getting treated as a numbered section, with a second Appendix A generated for references. This now correctly detects sections with "Appendix" in the name, and assigns letters appropriately. The generated references section is now Appendix B (and will always be the last appendix). --- scripts/md2html/md2html.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/md2html/md2html.js b/scripts/md2html/md2html.js index 8920677f5a..ddf5badd60 100644 --- a/scripts/md2html/md2html.js +++ b/scripts/md2html/md2html.js @@ -293,18 +293,22 @@ for (let l in lines) { //if (delta<0) delta = -1; if (Math.abs(delta)>1) console.warn(delta,line); let prefix = ''; + let newSection = '
'; + if (line.includes('Appendix')) { + newSection = '
'; + } // heading level delta is either 0 or is +1/-1, or we're in respec mode /* respec insists on
...
breaks around headings */ if (delta === 0) { - prefix = '
'; + prefix = '
'+newSection; } else if (delta > 0) { - prefix = '
'.repeat(delta); + prefix = newSection.repeat(delta); } else { - prefix = '
'+('
').repeat(Math.abs(delta))+'
'; + prefix = '
'+('').repeat(Math.abs(delta))+newSection; } prevHeading = heading; line = prefix+md.render(line);