make/common/ProcessMarkdown.gmk
changeset 54076 4b4745d185eb
parent 53830 e403ff78116c
child 55469 e00591da418d
equal deleted inserted replaced
54075:daec95ed6795 54076:4b4745d185eb
    63       $1_$2_CSS := $$(strip $$(call RelativePath, $$($1_CSS), $$($1_$2_TARGET_DIR)))
    63       $1_$2_CSS := $$(strip $$(call RelativePath, $$($1_CSS), $$($1_$2_TARGET_DIR)))
    64       $1_$2_CSS_OPTION := --css '$$($1_$2_CSS)'
    64       $1_$2_CSS_OPTION := --css '$$($1_$2_CSS)'
    65     endif
    65     endif
    66   endif
    66   endif
    67 
    67 
    68   $1_$2_OPTIONS := $$(shell $$(GREP) _pandoc-options_: $3/$2 | $$(CUT) -d : -f 2-)
    68   # This does not need to be included in VARDEPS since it's from the actual
       
    69   # source file. Only run the shell if the recipe gets executed below.
       
    70   $1_$2_OPTIONS_FROM_SRC = \
       
    71       $$(shell $$(GREP) _pandoc-options_: $3/$2 | $$(CUT) -d : -f 2-)
    69 
    72 
    70   ifneq ($$($1_FILTER), )
    73   ifneq ($$($1_FILTER), )
    71     $1_$2_OPTIONS += --filter $$($1_FILTER)
    74     $1_$2_OPTIONS := --filter $$($1_FILTER)
    72   endif
    75   endif
    73 
    76 
    74   $1_$2_VARDEPS := $$($1_OPTIONS) $$($1_$2_OPTIONS) $$($1_CSS) \
    77   $1_$2_VARDEPS := $$($1_OPTIONS) $$($1_$2_OPTIONS) $$($1_CSS) \
    75       $$($1_REPLACEMENTS) $$($1_POST_PROCESS)
    78       $$($1_REPLACEMENTS) $$($1_POST_PROCESS)
    76   $1_$2_VARDEPS_FILE := $$(call DependOnVariable, $1_$2_VARDEPS, \
    79   $1_$2_VARDEPS_FILE := $$(call DependOnVariable, $1_$2_VARDEPS, \
    80 	$$(call LogInfo, Converting $2 to $$($1_FORMAT))
    83 	$$(call LogInfo, Converting $2 to $$($1_FORMAT))
    81 	$$(call MakeDir, $$(SUPPORT_OUTPUTDIR)/markdown $$(dir $$($1_$2_PANDOC_OUTPUT)))
    84 	$$(call MakeDir, $$(SUPPORT_OUTPUTDIR)/markdown $$(dir $$($1_$2_PANDOC_OUTPUT)))
    82 	$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER), \
    85 	$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER), \
    83 	    $$(PANDOC) $$($1_OPTIONS) -f $$(PANDOC_MARKDOWN_FLAG) \
    86 	    $$(PANDOC) $$($1_OPTIONS) -f $$(PANDOC_MARKDOWN_FLAG) \
    84 	    -t $$($1_FORMAT) --standalone \
    87 	    -t $$($1_FORMAT) --standalone \
    85 	    $$($1_$2_CSS_OPTION) $$($1_$2_OPTIONS) '$$($1_$2_PANDOC_INPUT)' \
    88 	    $$($1_$2_CSS_OPTION) $$($1_$2_OPTIONS_FROM_SRC) $$($1_$2_OPTIONS) \
    86 	    -o '$$($1_$2_PANDOC_OUTPUT)')
    89 	    '$$($1_$2_PANDOC_INPUT)' -o '$$($1_$2_PANDOC_OUTPUT)')
    87         ifneq ($$(findstring $$(LOG_LEVEL), debug trace),)
    90         ifneq ($$(findstring $$(LOG_LEVEL), debug trace),)
    88 	  TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \
    91 	  TOO_LONG_LINES=`$$(GREP) -E -e '^.{80}.+$$$$' $$<` || true ; \
    89 	  if [ "x$$$$TOO_LONG_LINES" != x ]; then \
    92 	  if [ "x$$$$TOO_LONG_LINES" != x ]; then \
    90 	    $$(ECHO) "Warning: Unsuitable markdown in $$<:" ; \
    93 	    $$(ECHO) "Warning: Unsuitable markdown in $$<:" ; \
    91 	    $$(ECHO) "The following lines are longer than 80 characters:" ; \
    94 	    $$(ECHO) "The following lines are longer than 80 characters:" ; \