make/common/ProcessMarkdown.gmk
branchihse-manpages-branch
changeset 56950 55725429863a
parent 56893 2d3320d628a0
child 56951 79c99e08deb2
--- a/make/common/ProcessMarkdown.gmk	Tue Sep 18 14:27:31 2018 +0200
+++ b/make/common/ProcessMarkdown.gmk	Wed Oct 10 10:12:15 2018 +0200
@@ -1,4 +1,4 @@
-# Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -49,10 +49,10 @@
       $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER).vardeps)
 
 $$($1_$2_OUTPUT_FILE): $$($1_SRC)/$2 $$($1_$2_VARDEPS_FILE)
-	$$(call LogInfo, Converting $2 to html)
+	$$(call LogInfo, Converting $2 to $$($1_TO_TYPE))
 	$$(call MakeDir, $$($1_$2_TARGET_DIR) $$(SUPPORT_OUTPUTDIR)/markdown)
 	$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER), \
-	    $$(PANDOC) $$($1_OPTIONS) -f markdown -t html5 --standalone \
+	    $$(PANDOC) $$($1_OPTIONS) -f markdown -t $$($1_TO_TYPE) --standalone \
 	    $$($1_$2_CSS_OPTION) $$($1_$2_OPTIONS) '$$<' -o '$$@')
         ifneq ($$(findstring $$(LOG_LEVEL), debug trace),)
 	TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \
@@ -113,11 +113,17 @@
     # FIXME: We also need a pandoc filter that removes link targets for internal
     # links (#options)...
     # FIXME: Perhaps it should also make h1 headings ALL CAPS.
-  endif
-
-  # If no file extension is specified, default to '.html'.
-  ifeq ($$($1_FILE_EXT), )
-    $1_FILE_EXT := .html
+    $1_TO_TYPE := man
+    # If no file extension is specified, default to '.1'.
+    ifeq ($$($1_FILE_EXT), )
+      $1_FILE_EXT := .1
+    endif
+  else ifeq ($$($1_FORMAT), html)
+    # If no file extension is specified, default to '.html'.
+    $1_TO_TYPE := html5
+    ifeq ($$($1_FILE_EXT), )
+      $1_FILE_EXT := .html
+    endif
   endif
 
   # Remove any trailing slash from SRC and DEST