@@ -8,18 +8,17 @@ GOPATH:=$(shell go env GOPATH)
88OUTPUT_DIRNAME ?= output
99DOC_FILENAME ?= oci-image-spec
1010
11- PANDOC_CONTAINER ?= ghcr.io/opencontainers/pandoc:2.9.2.1-8.fc33.x86_64@sha256:5d81ff930a043295a557be8b003ece2a33d14e91b28c50d368413b83372f8d28
11+ # pinned to a 3.1 release due to a regression, see https://github.com/jgm/pandoc/issues/10952 before upgrading
12+ PANDOC_CONTAINER ?= docker.io/pandoc/latex:3.1@sha256:1cf54d9214a9b52de2f58cf5895cc596a5960711a54d7938dc72f2b23473caf3
1213ifeq "$(strip $(PANDOC ) ) " ''
1314 ifneq "$(strip $(DOCKER))" ''
1415 PANDOC = $(DOCKER) run \
1516 --rm \
16- -v $(shell pwd )/:/input /:ro \
17- -v $(shell pwd )/$(OUTPUT_DIRNAME)/:/$(OUTPUT_DIRNAME)/ \
18- -u $(shell id -u) \
19- --workdir /input \
17+ -v "$(CURDIR )/:/workdir /:ro" \
18+ -v "$(CURDIR )/$(OUTPUT_DIRNAME)/:/workdir/ $(OUTPUT_DIRNAME)/" \
19+ -u " $(shell id -u):$(shell id -g)" \
20+ --workdir /workdir \
2021 $(PANDOC_CONTAINER)
21- PANDOC_SRC := /input/
22- PANDOC_DST := /
2322 endif
2423endif
2524
@@ -55,24 +54,22 @@ fmt: ## format the json with indentation
5554docs : $(OUTPUT_DIRNAME ) /$(DOC_FILENAME ) .pdf $(OUTPUT_DIRNAME ) /$(DOC_FILENAME ) .html # # generate a PDF/HTML version of the OCI image specification
5655
5756ifeq "$(strip $(PANDOC ) ) " ''
58- $(OUTPUT_DIRNAME ) /$(DOC_FILENAME ) .pdf : $(DOC_FILES ) $(FIGURE_FILES )
57+ $(OUTPUT_DIRNAME ) /$(DOC_FILENAME ) .% : $(DOC_FILES ) $(FIGURE_FILES )
5958 $(error cannot build $@ without either pandoc or docker)
6059else
6160$(OUTPUT_DIRNAME ) /$(DOC_FILENAME ) .pdf : $(DOC_FILES ) $(FIGURE_FILES )
6261 @mkdir -p $(OUTPUT_DIRNAME ) / && \
63- $(PANDOC ) -f gfm -t latex --pdf-engine=xelatex -V geometry:margin=0.5in,bottom=0.8in -V block-headings -o $(PANDOC_DST ) $@ $(patsubst % ,$(PANDOC_SRC ) % ,$(DOC_FILES ) )
64- ls -sh $(realpath $@ )
62+ version=" v$$ (go run .tool/curver.go)" && \
63+ $(PANDOC ) -f gfm -t latex -o $@ --metadata " title=image-spec $$ {version}" --standalone --file-scope --pdf-engine=xelatex -V geometry:margin=0.5in,bottom=0.8in -V block-headings $(DOC_FILES )
64+ ls -sh $@
6565
66- $(OUTPUT_DIRNAME ) /$(DOC_FILENAME ) .html : header.html $(DOC_FILES ) $(FIGURE_FILES )
66+ $(OUTPUT_DIRNAME ) /$(DOC_FILENAME ) .html : $(DOC_FILES ) $(FIGURE_FILES )
6767 @mkdir -p $(OUTPUT_DIRNAME ) / && \
68- cp -ap img/ $( shell pwd) / $( OUTPUT_DIRNAME ) / && \
69- $(PANDOC ) -f gfm -t html5 -H $( PANDOC_SRC ) header.html --standalone -o $( PANDOC_DST ) $@ $( patsubst % , $( PANDOC_SRC ) % , $( DOC_FILES ) )
70- ls -sh $( realpath $@ )
68+ version= " v $$ (go run .tool/curver.go) " && \
69+ $(PANDOC ) -f gfm -t html5 -o $@ --metadata " title=image-spec $$ {version} " --standalone --file-scope --embed-resources -V " maxwidth:95% " $( DOC_FILES )
70+ ls -sh $@
7171endif
7272
73- header.html : .tool/genheader.go specs-go/version.go
74- go run .tool/genheader.go > $@
75-
7673.PHONY : validate-examples
7774validate-examples : schema/schema.go # # validate examples in the specification markdown files
7875 cd schema && go test -run TestValidate .
0 commit comments