foxygit / doom Log in
commit 7a75ee86052ca6297617abf87d38804c8cb12f4a
Author:     Simon Howard <fraggle@soulsphere.org>
AuthorDate: Thu Aug 22 23:23:42 2024 -0400
Commit:     Simon Howard <fraggle@soulsphere.org>
CommitDate: Thu Aug 22 23:23:42 2024 -0400

    win32: Tweaks to pandoc-formatted HTML

    I've been using this set of style tweaks for other projects already
    and it makes a definite improvement.
---
 pkg/Makefile.am       |  2 +-
 pkg/style.html        | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 pkg/win32/GNUmakefile | 14 ++++++++------
 3 files changed, 57 insertions(+), 7 deletions(-)

diff --git a/pkg/Makefile.am b/pkg/Makefile.am
index 823851b8..3a287b24 100644
--- a/pkg/Makefile.am
+++ b/pkg/Makefile.am
@@ -21,5 +21,5 @@ win32/GNUmakefile                                                       \
 win32/cp-with-libs                                                      \
 win32/README

-EXTRA_DIST=$(OSX_FILES) $(WIN32_FILES)
+EXTRA_DIST=style.html $(OSX_FILES) $(WIN32_FILES)

diff --git a/pkg/style.html b/pkg/style.html
new file mode 100644
index 00000000..4ae291a3
--- /dev/null
+++ b/pkg/style.html
@@ -0,0 +1,48 @@
+
+<!-- Tweaks to the pandoc output style to make the resulting HTML
+     look much nicer. -->
+
+<style>
+body {
+    background-color: white;
+    margin-top: 1.5em;
+    margin-bottom: 4em;
+
+    max-width: 38em;
+    margin-left: auto;
+    margin-right: auto;
+    box-sizing: border-box;
+
+    padding: 0;
+    padding-left: 1.3em;
+    padding-right: 1.3em;
+
+    font-size: large;
+    color: #555;
+    line-height: 1.6;
+
+    text-align: justify;
+    overflow-wrap: break-word;
+}
+
+header {
+      font-family: serif;
+      margin-top: 0;
+      margin-bottom: 0.2em;
+}
+
+h1, h2, h3, h4, h5, h6 {
+      margin-top: 0.5em;
+      margin-bottom: 0.2em;
+}
+
+p {
+      margin-top: 0;
+      margin-bottom: 0.8em;
+}
+
+dl {
+      margin-block-start: 0.5em;
+}
+</style>
+
diff --git a/pkg/win32/GNUmakefile b/pkg/win32/GNUmakefile
index 8d55b85d..da5fea00 100644
--- a/pkg/win32/GNUmakefile
+++ b/pkg/win32/GNUmakefile
@@ -9,6 +9,8 @@ else
     POSTFIX=win32
 endif

+PANDOC_FLAGS = -f gfm -s --template=default.html5 -H ../style.html
+
 DOOM_ZIP=$(PROGRAM_PREFIX)doom-$(PACKAGE_VERSION)-$(POSTFIX).zip
 HERETIC_ZIP=$(PROGRAM_PREFIX)heretic-$(PACKAGE_VERSION)-$(POSTFIX).zip
 HEXEN_ZIP=$(PROGRAM_PREFIX)hexen-$(PACKAGE_VERSION)-$(POSTFIX).zip
@@ -32,12 +34,12 @@ $(STRIFE_ZIP): staging-strife hook-strife
 # Special hooks to custom modify files for particular games.

 hook-doom: staging-doom
-	-pandoc -f gfm -s -o $</NOT-BUGS.html $(TOPLEVEL)/NOT-BUGS.md
+	-pandoc $(PANDOC_FLAGS) -o $</NOT-BUGS.html $(TOPLEVEL)/NOT-BUGS.md

 # Chocolate Strife has its own custom README file:

 hook-strife: staging-strife
-	-pandoc -f gfm -s -o $</README.html $(TOPLEVEL)/README.Strife.md
+	-pandoc $(PANDOC_FLAGS) -o $</README.html $(TOPLEVEL)/README.Strife.md

 # Build up a staging dir for a particular game.

@@ -52,11 +54,11 @@ staging-%:
 	$(STRIP) $@/*.exe $@/*.dll

 	-for f in $(DOC_FILES); do                              \
-		pandoc  -f gfm -o $@/$$(basename $$f .md).html  \
-			-s $(TOPLEVEL)/$$f;                     \
+		pandoc $(PANDOC_FLAGS) $@/$$(basename $$f .md).html  \
+		       $(TOPLEVEL)/$$f;                     \
 	done
-	-pandoc -f gfm -s -o $@/CMDLINE.html $(TOPLEVEL)/man/CMDLINE.$*.md
-	-pandoc -f gfm -s -o $@/INSTALL.html $(TOPLEVEL)/man/INSTALL.$*
+	-pandoc $(PANDOC_FLAGS) -o $@/CMDLINE.html $(TOPLEVEL)/man/CMDLINE.$*.md
+	-pandoc $(PANDOC_FLAGS) -o $@/INSTALL.html $(TOPLEVEL)/man/INSTALL.$*

 clean:
 	rm -f $(ZIPS)