# HG changeset patch # User ihse # Date 1539684165 -7200 # Node ID 8139ac807fc963fe695b242726de0d2e7619d8cd # Parent 57ed7a70cd1f9d24a3d126b19c3586e2cbedbdd0 Add needed man-page preprocessing. diff -r 57ed7a70cd1f -r 8139ac807fc9 make/common/ProcessMarkdown.gmk --- a/make/common/ProcessMarkdown.gmk Tue Oct 16 11:53:36 2018 +0200 +++ b/make/common/ProcessMarkdown.gmk Tue Oct 16 12:02:45 2018 +0200 @@ -124,19 +124,22 @@ endif ifeq ($$($1_FORMAT), man) - $1_PRE_PROCESS := $(SED) -e 's/@@VERSION_SHORT@@/$(VERSION_SHORT)/g' + # Use preprocessing to inject the current version. + # Also mis-use preprocessing for stuff that would be better handled as a + # pandoc filter: raise ## headings to #, convert those headings to upper + # case, and remove internal links. + $1_PRE_PROCESS := $(SED) -E -e 's/@@VERSION_SHORT@@/$(VERSION_SHORT)/g' \ + -e '/^\\\#\\\# /y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ + -e 's/^\\\#\\\# /\\\# /' -e 's/(\\\#[a-z-]+)/ /g' # Pandoc's default behavior is to convert `code` to \f[C], which do not # show up in normal man page rendering (but shows correctly when generating - # html). Normally, we could fix this by a pandoc filter, but pandoc prior + # html). Normally, we could fix this by a pandoc filter, but pandoc prior # to version 2.0 cannot properly produced nested formatting in man pages # (see https://github.com/jgm/pandoc/issues/3568). # As a workaround, use post-processing with sed. $1_POST_PROCESS := $(SED) -e 's/\\f\[C\]/\\f\[CB\]/g' - # 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. # If no file extension is specified, default to '.1'. ifeq ($$($1_FILE_EXT), ) $1_FILE_EXT := .1