Skip to content

Commit

Permalink
Merge branch 'bc/asciidoctor'
Browse files Browse the repository at this point in the history
Add machinery to alternatively use AsciiDoctor to format our
documentation.

* bc/asciidoctor:
  Documentation: remove Asciidoctor linkgit macro
  Documentation: refactor common operations into variables
  Documentation: implement linkgit macro for Asciidoctor
  Documentation: move some AsciiDoc parameters into variables
  • Loading branch information
gitster committed Oct 29, 2014
2 parents fbecd99 + c6c3e0d commit 853878d
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions Documentation/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ man7dir = $(mandir)/man7

ASCIIDOC = asciidoc
ASCIIDOC_EXTRA =
ASCIIDOC_HTML = xhtml11
ASCIIDOC_DOCBOOK = docbook
ASCIIDOC_CONF = -f asciidoc.conf
ASCIIDOC_COMMON = $(ASCIIDOC) $(ASCIIDOC_EXTRA) $(ASCIIDOC_CONF) \
-agit-version=$(GIT_VERSION)
TXT_TO_HTML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_HTML)
TXT_TO_XML = $(ASCIIDOC_COMMON) -b $(ASCIIDOC_DOCBOOK)
MANPAGE_XSL = manpage-normal.xsl
XMLTO = xmlto
XMLTO_EXTRA =
Expand Down Expand Up @@ -306,14 +313,12 @@ clean:

$(MAN_HTML): %.html : %.txt asciidoc.conf
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
$(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
$(TXT_TO_HTML) -d manpage -o $@+ $< && \
mv $@+ $@

$(OBSOLETE_HTML): %.html : %.txto asciidoc.conf
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
$(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
$(TXT_TO_HTML) -o $@+ $< && \
mv $@+ $@

manpage-base-url.xsl: manpage-base-url.xsl.in
Expand All @@ -325,13 +330,12 @@ manpage-base-url.xsl: manpage-base-url.xsl.in

%.xml : %.txt asciidoc.conf
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
$(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) -o $@+ $< && \
$(TXT_TO_XML) -d manpage -o $@+ $< && \
mv $@+ $@

user-manual.xml: user-manual.txt user-manual.conf
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b docbook -d article -o $@+ $< && \
$(TXT_TO_XML) -d article -o $@+ $< && \
mv $@+ $@

technical/api-index.txt: technical/api-index-skel.txt \
Expand All @@ -340,8 +344,7 @@ technical/api-index.txt: technical/api-index-skel.txt \

technical/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
$(patsubst %,%.html,$(API_DOCS) technical/api-index $(TECH_DOCS)): %.html : %.txt asciidoc.conf
$(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 -f asciidoc.conf \
$(ASCIIDOC_EXTRA) -agit_version=$(GIT_VERSION) $*.txt
$(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt

XSLT = docbook.xsl
XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css
Expand Down Expand Up @@ -388,14 +391,15 @@ howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
mv $@+ $@

$(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
$(QUIET_ASCIIDOC)$(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 $*.txt
$(QUIET_ASCIIDOC)$(TXT_TO_HTML) $*.txt

WEBDOC_DEST = /pub/software/scm/git/docs

howto/%.html: ASCIIDOC_EXTRA += -a git-relative-html-prefix=../
$(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
$(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
sed -e '1,/^$$/d' $< | $(ASCIIDOC) $(ASCIIDOC_EXTRA) -b xhtml11 - >$@+ && \
sed -e '1,/^$$/d' $< | \
$(TXT_TO_HTML) - >$@+ && \
mv $@+ $@

install-webdoc : html
Expand Down

0 comments on commit 853878d

Please sign in to comment.