Skip to content

Commit

Permalink
docparse: Generate html and pdf using asciidoc{,tor}
Browse files Browse the repository at this point in the history
Rewrite testinfo.pl to generate *.txt pages in asciidoc format which is
then regenerated to html (and pdf if enabled) using asciidoc,{tor}.

Replace getting Linux kernel git commit messages from local git
repository (needed after having all tests in single page, because API
has access limits; it's also better to generate everything once thus
don't depend on network connection).

Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
Reviewed-by: Li Wang <liwang@redhat.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
  • Loading branch information
pevik committed Nov 16, 2020
1 parent 31085e0 commit 6f36270
Show file tree
Hide file tree
Showing 3 changed files with 458 additions and 11 deletions.
5 changes: 5 additions & 0 deletions docparse/.gitignore
@@ -1,2 +1,7 @@
/*.txt
/docbook-xsl.css
/docparse
/metadata.json
/metadata.html
/metadata.pdf
/metadata.chunked/
58 changes: 58 additions & 0 deletions docparse/Makefile
@@ -1,19 +1,77 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2019 Cyril Hrubis <chrubis@suse.cz>
# Copyright (c) 2020 Petr Vorel <pvorel@suse.cz>

top_srcdir ?= ..

include $(top_srcdir)/include/mk/env_pre.mk
include $(top_srcdir)/include/mk/functions.mk

ifeq ($(METADATA_GENERATOR),asciidoctor)
METADATA_GENERATOR_CMD := asciidoctor
METADATA_GENERATOR_PARAMS := -d book metadata.txt
METADATA_GENERATOR_PARAMS_HTML := -b xhtml
METADATA_GENERATOR_PARAMS_PDF := -b pdf -r asciidoctor-pdf
else ifeq ($(METADATA_GENERATOR),asciidoc)
METADATA_GENERATOR_CMD := a2x
METADATA_GENERATOR_PARAMS := --xsltproc-opts "--stringparam toc.section.depth 1" -d book -L --resource="$(PWD)" metadata.txt
METADATA_GENERATOR_PARAMS_HTML := -f xhtml
METADATA_GENERATOR_PARAMS_PDF := -f pdf
METADATA_GENERATOR_PARAMS_HTML_CHUNKED := -f chunked
else ifeq ($(METADATA_GENERATOR),)
$(error 'METADATA_GENERATOR' not not configured, run ./configure in the root directory)
else
$(error '$(METADATA_GENERATOR)' not supported, only asciidoctor and asciidoc are supported)
endif

ifdef VERBOSE
METADATA_GENERATOR_PARAMS += -v
endif

CLEAN_TARGETS := *.css *.js *.txt
MAKE_TARGETS := metadata.json

ifeq ($(WITH_METADATA_HTML),yes)
MAKE_TARGETS += metadata.html
ifneq ($(METADATA_GENERATOR_PARAMS_HTML_CHUNKED),)
MAKE_TARGETS += metadata.chunked
endif
endif

ifeq ($(WITH_METADATA_PDF),yes)
MAKE_TARGETS += metadata.pdf
endif

HOST_MAKE_TARGETS := docparse

INSTALL_DIR = metadata
INSTALL_TARGETS = *.css *.js

ifndef METADATA_GENERATOR
METADATA_GENERATOR := asciidoctor
endif

.PHONY: metadata.json

metadata.json: docparse
$(abs_srcdir)/parse.sh > metadata.json

txt: metadata.json
$(abs_srcdir)/testinfo.pl metadata.json

ifeq ($(WITH_METADATA_HTML),yes)
metadata.html: txt
$(METADATA_GENERATOR_CMD) $(METADATA_GENERATOR_PARAMS) $(METADATA_GENERATOR_PARAMS_HTML)

ifneq ($(METADATA_GENERATOR_PARAMS_HTML_CHUNKED),)
metadata.chunked: txt
$(METADATA_GENERATOR_CMD) $(METADATA_GENERATOR_PARAMS) $(METADATA_GENERATOR_PARAMS_HTML_CHUNKED)
endif
endif

ifeq ($(WITH_METADATA_PDF),yes)
metadata.pdf: txt
$(METADATA_GENERATOR_CMD) $(METADATA_GENERATOR_PARAMS) $(METADATA_GENERATOR_PARAMS_PDF)
endif

include $(top_srcdir)/include/mk/generic_leaf_target.mk

0 comments on commit 6f36270

Please sign in to comment.