Skip to content

Commit 9beeadb

Browse files
committed
Add support for extracting the tags into JSON
1 parent 76729e1 commit 9beeadb

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[submodule "docs-resources"]
22
path = docs-resources
3-
url = https://github.com/riscv/docs-resources
3+
url = https://github.com/Timmmm/docs-resources

Makefile

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,18 +72,23 @@ BUILD_DIR := build
7272
DOCS_PDF := $(addprefix $(BUILD_DIR)/, $(addsuffix .pdf, $(DOCS)))
7373
DOCS_HTML := $(addprefix $(BUILD_DIR)/, $(addsuffix .html, $(DOCS)))
7474
DOCS_EPUB := $(addprefix $(BUILD_DIR)/, $(addsuffix .epub, $(DOCS)))
75+
DOCS_TAGS := $(addprefix $(BUILD_DIR)/, $(addsuffix .tags.json, $(DOCS)))
7576

7677
ENV := LANG=C.utf8
7778
XTRA_ADOC_OPTS :=
79+
7880
ASCIIDOCTOR_PDF := $(ENV) asciidoctor-pdf
7981
ASCIIDOCTOR_HTML := $(ENV) asciidoctor
8082
ASCIIDOCTOR_EPUB := $(ENV) asciidoctor-epub3
83+
ASCIIDOCTOR_TAGS := $(ENV) asciidoctor --backend tags --require=./docs-resources/converters/tags.rb
84+
8185
OPTIONS := --trace \
8286
-a compress \
8387
-a mathematical-format=svg \
8488
-a pdf-fontsdir=docs-resources/fonts \
8589
-a pdf-theme=docs-resources/themes/riscv-pdf.yml \
8690
-a docinfo=shared \
91+
-a tags-prefix=qx_ \
8792
$(XTRA_ADOC_OPTS) \
8893
-D build \
8994
--failure-level=ERROR
@@ -92,7 +97,7 @@ REQUIRES := --require=asciidoctor-bibtex \
9297
--require=asciidoctor-lists \
9398
--require=asciidoctor-mathematical
9499

95-
.PHONY: all build clean build-container build-no-container build-docs build-pdf build-html build-epub submodule-check
100+
.PHONY: all build clean build-container build-no-container build-docs build-pdf build-html build-epub build-tags submodule-check
96101

97102
all: build
98103

@@ -108,6 +113,7 @@ build-docs: $(DOCS_PDF) $(DOCS_HTML) $(DOCS_EPUB)
108113
build-pdf: $(DOCS_PDF)
109114
build-html: $(DOCS_HTML)
110115
build-epub: $(DOCS_EPUB)
116+
build-tags: $(DOCS_TAGS)
111117

112118
ALL_SRCS := $(shell git ls-files $(SRC_DIR))
113119

@@ -126,6 +132,11 @@ $(BUILD_DIR)/%.epub: $(SRC_DIR)/%.adoc $(ALL_SRCS)
126132
$(DOCKER_CMD) $(DOCKER_QUOTE) $(ASCIIDOCTOR_EPUB) $(OPTIONS) $(REQUIRES) $< $(DOCKER_QUOTE)
127133
$(WORKDIR_TEARDOWN)
128134

135+
$(BUILD_DIR)/%.tags.json: $(SRC_DIR)/%.adoc $(ALL_SRCS) docs-resources/converters/tags.rb
136+
$(WORKDIR_SETUP)
137+
$(DOCKER_CMD) $(DOCKER_QUOTE) $(ASCIIDOCTOR_TAGS) $(OPTIONS) $(REQUIRES) $< $(DOCKER_QUOTE)
138+
$(WORKDIR_TEARDOWN)
139+
129140
build: submodule-check
130141
@echo "Checking if Docker is available..."
131142
@if command -v docker >/dev/null 2>&1 ; then \

0 commit comments

Comments
 (0)