8331886: Allow markdown src file overrides
Reviewed-by: ihse
This commit is contained in:
parent
0d1216c7a1
commit
588e314e4b
@ -681,28 +681,25 @@ ifeq ($(ENABLE_PANDOC), true)
|
|||||||
$(TOPDIR)/make/jdk/src/classes/build/tools/pandocfilter)
|
$(TOPDIR)/make/jdk/src/classes/build/tools/pandocfilter)
|
||||||
|
|
||||||
$(foreach m, $(ALL_MODULES), \
|
$(foreach m, $(ALL_MODULES), \
|
||||||
$(eval MAN_$m := $(call FindModuleManDirs, $m)) \
|
$(eval MAN_$m := $(call ApplySpecFilter, $(filter %.md, $(call FindFiles, \
|
||||||
$(foreach d, $(MAN_$m), \
|
$(call FindModuleManDirs, $m))))) \
|
||||||
$(foreach f, $(call ApplySpecFilter, $(filter %.md, $(call FindFiles, $d))), \
|
$(if $(MAN_$m), \
|
||||||
$(eval $m_$f_NAME := MAN_TO_HTML_$m_$(strip $(call RelativePath, $f, $(TOPDIR)))) \
|
$(eval $(call SetupProcessMarkdown, MAN_TO_HTML_$m, \
|
||||||
$(eval $(call SetupProcessMarkdown, $($m_$f_NAME), \
|
FILES := $(MAN_$m), \
|
||||||
SRC := $d, \
|
DEST := $(DOCS_OUTPUTDIR)/specs/man, \
|
||||||
FILES := $f, \
|
FILTER := $(PANDOC_HTML_MANPAGE_FILTER), \
|
||||||
DEST := $(DOCS_OUTPUTDIR)/specs/man, \
|
CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
|
||||||
FILTER := $(PANDOC_HTML_MANPAGE_FILTER), \
|
REPLACEMENTS := \
|
||||||
CSS := $(GLOBAL_SPECS_DEFAULT_CSS_FILE), \
|
@@COPYRIGHT_YEAR@@ => $(COPYRIGHT_YEAR) ; \
|
||||||
REPLACEMENTS := \
|
@@VERSION_SHORT@@ => $(VERSION_SHORT) ; \
|
||||||
@@COPYRIGHT_YEAR@@ => $(COPYRIGHT_YEAR) ; \
|
@@VERSION_SPECIFICATION@@ => $(VERSION_SPECIFICATION), \
|
||||||
@@VERSION_SHORT@@ => $(VERSION_SHORT) ; \
|
OPTIONS := --toc -V include-before='$(SPECS_TOP)' -V include-after='$(SPECS_BOTTOM_1)', \
|
||||||
@@VERSION_SPECIFICATION@@ => $(VERSION_SPECIFICATION), \
|
POST_PROCESS := $(TOOL_FIXUPPANDOC) --insert-nav --nav-right-info '$(HEADER_RIGHT_SIDE_INFO)' \
|
||||||
OPTIONS := --toc -V include-before='$(SPECS_TOP)' -V include-after='$(SPECS_BOTTOM_1)', \
|
--nav-subdirs 1 --nav-link-guides, \
|
||||||
POST_PROCESS := $(TOOL_FIXUPPANDOC) --insert-nav --nav-right-info '$(HEADER_RIGHT_SIDE_INFO)' \
|
EXTRA_DEPS := $(PANDOC_HTML_MANPAGE_FILTER) \
|
||||||
--nav-subdirs 1 --nav-link-guides, \
|
$(PANDOC_HTML_MANPAGE_FILTER_SOURCE), \
|
||||||
EXTRA_DEPS := $(PANDOC_HTML_MANPAGE_FILTER) \
|
)) \
|
||||||
$(PANDOC_HTML_MANPAGE_FILTER_SOURCE), \
|
$(eval JDK_SPECS_TARGETS += $(MAN_TO_HTML_$m)) \
|
||||||
)) \
|
|
||||||
$(eval JDK_SPECS_TARGETS += $($($m_$f_NAME))) \
|
|
||||||
) \
|
|
||||||
) \
|
) \
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -38,48 +38,53 @@ define ProcessMarkdown
|
|||||||
$1_$2_INPUT_FILE := $3/$2
|
$1_$2_INPUT_FILE := $3/$2
|
||||||
$1_$2_MARKER := $$(subst /,_,$1_$2)
|
$1_$2_MARKER := $$(subst /,_,$1_$2)
|
||||||
|
|
||||||
ifneq ($$($1_REPLACEMENTS), )
|
# Only continue if this target file hasn't been processed already. This lets
|
||||||
$1_$2_PANDOC_INPUT := $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER)_pre.tmp
|
# the first found source file override any other with the same name.
|
||||||
|
ifeq ($$($1_$2_OUTPUT_FILE_PROCESSED), )
|
||||||
|
$1_$2_OUTPUT_FILE_PROCESSED := true
|
||||||
|
|
||||||
$$(eval $$(call SetupTextFileProcessing, $1_$2_PREPROCESSED, \
|
ifneq ($$($1_REPLACEMENTS), )
|
||||||
SOURCE_FILES := $$($1_$2_INPUT_FILE), \
|
$1_$2_PANDOC_INPUT := $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER)_pre.tmp
|
||||||
OUTPUT_FILE := $$($1_$2_PANDOC_INPUT), \
|
|
||||||
REPLACEMENTS := $$($1_REPLACEMENTS), \
|
|
||||||
))
|
|
||||||
else
|
|
||||||
$1_$2_PANDOC_INPUT := $$($1_$2_INPUT_FILE)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifneq ($$($1_POST_PROCESS), )
|
$$(eval $$(call SetupTextFileProcessing, $1_$2_PREPROCESSED, \
|
||||||
$1_$2_PANDOC_OUTPUT := $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER)_post.tmp
|
SOURCE_FILES := $$($1_$2_INPUT_FILE), \
|
||||||
else
|
OUTPUT_FILE := $$($1_$2_PANDOC_INPUT), \
|
||||||
$1_$2_PANDOC_OUTPUT := $$($1_$2_OUTPUT_FILE)
|
REPLACEMENTS := $$($1_REPLACEMENTS), \
|
||||||
endif
|
))
|
||||||
|
|
||||||
ifneq ($$($1_CSS), )
|
|
||||||
ifneq ($$(findstring https:/, $$($1_CSS)), )
|
|
||||||
$1_$2_CSS_OPTION := --css '$$($1_CSS)'
|
|
||||||
else
|
else
|
||||||
$1_$2_CSS := $$(strip $$(call RelativePath, $$($1_CSS), $$($1_$2_TARGET_DIR)))
|
$1_$2_PANDOC_INPUT := $$($1_$2_INPUT_FILE)
|
||||||
$1_$2_CSS_OPTION := --css '$$($1_$2_CSS)'
|
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
# This does not need to be included in VARDEPS since it's from the actual
|
ifneq ($$($1_POST_PROCESS), )
|
||||||
# source file. Only run the shell if the recipe gets executed below.
|
$1_$2_PANDOC_OUTPUT := $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER)_post.tmp
|
||||||
$1_$2_OPTIONS_FROM_SRC = \
|
else
|
||||||
$$(shell $$(GREP) _pandoc-options_: $3/$2 | $$(CUT) -d : -f 2-)
|
$1_$2_PANDOC_OUTPUT := $$($1_$2_OUTPUT_FILE)
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq ($$($1_FILTER), )
|
ifneq ($$($1_CSS), )
|
||||||
$1_$2_OPTIONS := --filter $$($1_FILTER)
|
ifneq ($$(findstring https:/, $$($1_CSS)), )
|
||||||
endif
|
$1_$2_CSS_OPTION := --css '$$($1_CSS)'
|
||||||
|
else
|
||||||
|
$1_$2_CSS := $$(strip $$(call RelativePath, $$($1_CSS), $$($1_$2_TARGET_DIR)))
|
||||||
|
$1_$2_CSS_OPTION := --css '$$($1_$2_CSS)'
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
$1_$2_VARDEPS := $$($1_OPTIONS) $$($1_$2_OPTIONS) $$($1_CSS) \
|
# This does not need to be included in VARDEPS since it's from the actual
|
||||||
$$($1_REPLACEMENTS) $$($1_POST_PROCESS)
|
# source file. Only run the shell if the recipe gets executed below.
|
||||||
$1_$2_VARDEPS_FILE := $$(call DependOnVariable, $1_$2_VARDEPS, \
|
$1_$2_OPTIONS_FROM_SRC = \
|
||||||
$$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER).vardeps)
|
$$(shell $$(GREP) _pandoc-options_: $3/$2 | $$(CUT) -d : -f 2-)
|
||||||
|
|
||||||
$$($1_$2_PANDOC_OUTPUT): $$($1_$2_PANDOC_INPUT) $$($1_$2_VARDEPS_FILE) $$($1_EXTRA_DEPS)
|
ifneq ($$($1_FILTER), )
|
||||||
|
$1_$2_OPTIONS := --filter $$($1_FILTER)
|
||||||
|
endif
|
||||||
|
|
||||||
|
$1_$2_VARDEPS := $$($1_OPTIONS) $$($1_$2_OPTIONS) $$($1_CSS) \
|
||||||
|
$$($1_REPLACEMENTS) $$($1_POST_PROCESS)
|
||||||
|
$1_$2_VARDEPS_FILE := $$(call DependOnVariable, $1_$2_VARDEPS, \
|
||||||
|
$$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER).vardeps)
|
||||||
|
|
||||||
|
$$($1_$2_PANDOC_OUTPUT): $$($1_$2_PANDOC_INPUT) $$($1_$2_VARDEPS_FILE) $$($1_EXTRA_DEPS)
|
||||||
$$(call LogInfo, Converting $2 to $$($1_FORMAT))
|
$$(call LogInfo, Converting $2 to $$($1_FORMAT))
|
||||||
$$(call MakeDir, $$(SUPPORT_OUTPUTDIR)/markdown $$(dir $$($1_$2_PANDOC_OUTPUT)))
|
$$(call MakeDir, $$(SUPPORT_OUTPUTDIR)/markdown $$(dir $$($1_$2_PANDOC_OUTPUT)))
|
||||||
$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER), \
|
$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER), \
|
||||||
@ -96,17 +101,18 @@ define ProcessMarkdown
|
|||||||
fi
|
fi
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# If we have no post processing, PANDOC_OUTPUT is set to OUTPUT_FILE. Otherwise
|
# If we have no post processing, PANDOC_OUTPUT is set to OUTPUT_FILE. Otherwise
|
||||||
# PANDOC_OUTPUT is a temporary file, and we must now create the real OUTPUT_FILE.
|
# PANDOC_OUTPUT is a temporary file, and we must now create the real OUTPUT_FILE.
|
||||||
ifneq ($$($1_POST_PROCESS), )
|
ifneq ($$($1_POST_PROCESS), )
|
||||||
$$($1_$2_OUTPUT_FILE): $$($1_$2_PANDOC_OUTPUT)
|
$$($1_$2_OUTPUT_FILE): $$($1_$2_PANDOC_OUTPUT)
|
||||||
$$(call LogInfo, Post-processing markdown file $2)
|
$$(call LogInfo, Post-processing markdown file $2)
|
||||||
$$(call MakeDir, $$(SUPPORT_OUTPUTDIR)/markdown $$($1_$2_TARGET_DIR))
|
$$(call MakeDir, $$(SUPPORT_OUTPUTDIR)/markdown $$($1_$2_TARGET_DIR))
|
||||||
$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER)_post, \
|
$$(call ExecuteWithLog, $$(SUPPORT_OUTPUTDIR)/markdown/$$($1_$2_MARKER)_post, \
|
||||||
( $$($1_POST_PROCESS) $$($1_$2_PANDOC_OUTPUT) > $$($1_$2_OUTPUT_FILE) ) )
|
( $$($1_POST_PROCESS) $$($1_$2_PANDOC_OUTPUT) > $$($1_$2_OUTPUT_FILE) ) )
|
||||||
endif
|
endif
|
||||||
|
|
||||||
$1 += $$($1_$2_OUTPUT_FILE)
|
$1 += $$($1_$2_OUTPUT_FILE)
|
||||||
|
endif
|
||||||
endef
|
endef
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
Loading…
Reference in New Issue
Block a user