122 ifeq ($$($1_FORMAT), ) |
122 ifeq ($$($1_FORMAT), ) |
123 $1_FORMAT := html5 |
123 $1_FORMAT := html5 |
124 endif |
124 endif |
125 |
125 |
126 ifeq ($$($1_FORMAT), man) |
126 ifeq ($$($1_FORMAT), man) |
127 $1_PRE_PROCESS := $(SED) -e 's/@@VERSION_SHORT@@/$(VERSION_SHORT)/g' |
127 # Use preprocessing to inject the current version. |
|
128 # Also mis-use preprocessing for stuff that would be better handled as a |
|
129 # pandoc filter: raise ## headings to #, convert those headings to upper |
|
130 # case, and remove internal links. |
|
131 $1_PRE_PROCESS := $(SED) -E -e 's/@@VERSION_SHORT@@/$(VERSION_SHORT)/g' \ |
|
132 -e '/^\\\#\\\# /y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ |
|
133 -e 's/^\\\#\\\# /\\\# /' -e 's/(\\\#[a-z-]+)/ /g' |
128 |
134 |
129 # Pandoc's default behavior is to convert `code` to \f[C], which do not |
135 # Pandoc's default behavior is to convert `code` to \f[C], which do not |
130 # show up in normal man page rendering (but shows correctly when generating |
136 # show up in normal man page rendering (but shows correctly when generating |
131 # html). Normally, we could fix this by a pandoc filter, but pandoc prior |
137 # html). Normally, we could fix this by a pandoc filter, but pandoc prior |
132 # to version 2.0 cannot properly produced nested formatting in man pages |
138 # to version 2.0 cannot properly produced nested formatting in man pages |
133 # (see https://github.com/jgm/pandoc/issues/3568). |
139 # (see https://github.com/jgm/pandoc/issues/3568). |
134 # As a workaround, use post-processing with sed. |
140 # As a workaround, use post-processing with sed. |
135 $1_POST_PROCESS := $(SED) -e 's/\\f\[C\]/\\f\[CB\]/g' |
141 $1_POST_PROCESS := $(SED) -e 's/\\f\[C\]/\\f\[CB\]/g' |
136 |
142 |
137 # FIXME: We also need a pandoc filter that removes link targets for internal |
|
138 # links (#options)... |
|
139 # FIXME: Perhaps it should also make h1 headings ALL CAPS. |
|
140 # If no file extension is specified, default to '.1'. |
143 # If no file extension is specified, default to '.1'. |
141 ifeq ($$($1_FILE_EXT), ) |
144 ifeq ($$($1_FILE_EXT), ) |
142 $1_FILE_EXT := .1 |
145 $1_FILE_EXT := .1 |
143 endif |
146 endif |
144 else ifeq ($$($1_FORMAT), html5) |
147 else ifeq ($$($1_FORMAT), html5) |