< prev index next >

make/common/ProcessMarkdown.gmk

Print this page




  86             $$(PANDOC) $$($1_OPTIONS) -f $$(PANDOC_MARKDOWN_FLAG) \
  87             -t $$($1_FORMAT) --standalone \
  88             $$($1_$2_CSS_OPTION) $$($1_$2_OPTIONS_FROM_SRC) $$($1_$2_OPTIONS) \
  89             '$$($1_$2_PANDOC_INPUT)' -o '$$($1_$2_PANDOC_OUTPUT)')
  90         ifneq ($$(findstring $$(LOG_LEVEL), debug trace),)
  91           TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \
  92           if [ "x$$$$TOO_LONG_LINES" != x ]; then \
  93             $$(ECHO) "Warning: Unsuitable markdown in $$<:" ; \
  94             $$(ECHO) "The following lines are longer than 80 characters:" ; \
  95             $$(GREP) -E -n -e '^.{80}.+$$$$' $$< || true ; \
  96           fi
  97         endif
  98 
  99   # If we have no post processing, PANDOC_OUTPUT is set to OUTPUT_FILE. Otherwise
 100   # PANDOC_OUTPUT is a temporary file, and we must now create the real OUTPUT_FILE.
 101   ifneq ($$($1_POST_PROCESS), )
 102     $$($1_$2_OUTPUT_FILE): $$($1_$2_PANDOC_OUTPUT)
 103         $$(call LogInfo, Post-processing markdown file $2)
 104         $$(call MakeDir, $$(SUPPORT_OUTPUTDIR)/markdown $$($1_$2_TARGET_DIR))
 105         $$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER)_post, \
 106             ( $$($1_POST_PROCESS) < $$($1_$2_PANDOC_OUTPUT) > $$($1_$2_OUTPUT_FILE) ) )
 107   endif
 108 
 109   $1 += $$($1_$2_OUTPUT_FILE)
 110 endef
 111 
 112 ################################################################################
 113 # Setup make rules for converting a markdown file to html.
 114 #
 115 # Parameter 1 is the name of the rule. This name is used as variable prefix,
 116 # and the targets generated are listed in a variable by that name.
 117 #
 118 # Remaining parameters are named arguments. These include:
 119 #   DEST     : Destination root dir
 120 #   FILES    : List of files to copy with absolute paths, or path relative to SRC.
 121 #   SRC      : Source root dir; if given keep input files hierarchy relative to
 122 #              SRC in DEST, otherwise flatten structure into DEST.
 123 #   FORMAT   : The target format (defaults to html5)
 124 #   FILE_EXT : The file extension to replace .md with (defaults to .html)
 125 #   OPTIONS  : Additional options to pandoc
 126 #   EXTRA_DEPS : Additional dependencies to add to each pandoc call




  86             $$(PANDOC) $$($1_OPTIONS) -f $$(PANDOC_MARKDOWN_FLAG) \
  87             -t $$($1_FORMAT) --standalone \
  88             $$($1_$2_CSS_OPTION) $$($1_$2_OPTIONS_FROM_SRC) $$($1_$2_OPTIONS) \
  89             '$$($1_$2_PANDOC_INPUT)' -o '$$($1_$2_PANDOC_OUTPUT)')
  90         ifneq ($$(findstring $$(LOG_LEVEL), debug trace),)
  91           TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \
  92           if [ "x$$$$TOO_LONG_LINES" != x ]; then \
  93             $$(ECHO) "Warning: Unsuitable markdown in $$<:" ; \
  94             $$(ECHO) "The following lines are longer than 80 characters:" ; \
  95             $$(GREP) -E -n -e '^.{80}.+$$$$' $$< || true ; \
  96           fi
  97         endif
  98 
  99   # If we have no post processing, PANDOC_OUTPUT is set to OUTPUT_FILE. Otherwise
 100   # PANDOC_OUTPUT is a temporary file, and we must now create the real OUTPUT_FILE.
 101   ifneq ($$($1_POST_PROCESS), )
 102     $$($1_$2_OUTPUT_FILE): $$($1_$2_PANDOC_OUTPUT)
 103         $$(call LogInfo, Post-processing markdown file $2)
 104         $$(call MakeDir, $$(SUPPORT_OUTPUTDIR)/markdown $$($1_$2_TARGET_DIR))
 105         $$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER)_post, \
 106             $$($1_POST_PROCESS) < $$($1_$2_PANDOC_OUTPUT) > $$($1_$2_OUTPUT_FILE))
 107   endif
 108 
 109   $1 += $$($1_$2_OUTPUT_FILE)
 110 endef
 111 
 112 ################################################################################
 113 # Setup make rules for converting a markdown file to html.
 114 #
 115 # Parameter 1 is the name of the rule. This name is used as variable prefix,
 116 # and the targets generated are listed in a variable by that name.
 117 #
 118 # Remaining parameters are named arguments. These include:
 119 #   DEST     : Destination root dir
 120 #   FILES    : List of files to copy with absolute paths, or path relative to SRC.
 121 #   SRC      : Source root dir; if given keep input files hierarchy relative to
 122 #              SRC in DEST, otherwise flatten structure into DEST.
 123 #   FORMAT   : The target format (defaults to html5)
 124 #   FILE_EXT : The file extension to replace .md with (defaults to .html)
 125 #   OPTIONS  : Additional options to pandoc
 126 #   EXTRA_DEPS : Additional dependencies to add to each pandoc call


< prev index next >