Skip to content
Permalink
Browse files

Build guide/next/ for next MacPorts release

This makes use of DocBook profiling using the audience="" attribute.

Example:
<para audience="2.4">This is for users of MacPorts 2.4.x</para>
<para audience="2.5">This is for users of MacPorts 2.5.0 or later</para>

See the DocBook XSL guide for all details:
http://www.sagehill.net/docbookxsl/Profiling.html
  • Loading branch information
raimue committed Mar 28, 2018
1 parent b8fa495 commit bf54d374421e9974e1daaa8086cab5aa5df51334
Showing with 25 additions and 7 deletions.
  1. +25 −7 Makefile
@@ -51,14 +51,24 @@ GUIDE_XSL_CHUNK = $(GUIDE)/resources/chunk.xsl
# DocBook HTML stylesheet for the guide.
STYLESHEET = docbook.css

.PHONY: all guide guide-chunked guide-dblatex clean validate
# MacPorts versions
MACPORTS_RELEASED = 2.4 2.4.0 2.4.1 2.4.2
MACPORTS_NEXT = 2.5 2.5.0 2.4.3

all: guide guide-chunked
gen_audience = $(subst $(eval) ,;,$1)
MACPORTS_RELEASED_AUDIENCE = $(call gen_audience,$(MACPORTS_RELEASED))
MACPORTS_NEXT_AUDIENCE = $(call gen_audience,$(MACPORTS_NEXT))

.PHONY: all guide guide-next guide-chunked guide-chunked-next guide-dblatex clean validate

all: guide guide-next guide-chunked guide-chunked-next

# Generate the HTML guide using DocBook from the XML sources
guide: GUIDE_OUTDIR= $(GUIDE_RESULT)
guide-next: GUIDE_OUTDIR = $(GUIDE_RESULT)/next
guide-chunked: GUIDE_OUTDIR = $(GUIDE_RESULT)/chunked
guide-chunked: GUIDE_XSL = $(GUIDE_XSL_CHUNK)
guide-chunked-next: GUIDE_OUTDIR = $(GUIDE_RESULT)/next/chunked
guide-chunked guide-chunked-next: GUIDE_XSL = $(GUIDE_XSL_CHUNK)

$(GUIDE)/resources/xsl:
ifeq ($(UNAME), Linux)
@@ -67,12 +77,14 @@ else
$(LN) -sfh $(DOCBOOK) $(GUIDE)/resources/xsl
endif

guide guide-chunked:: $(GUIDE)/resources/xsl
guide guide-next guide-chunked guide-chunked-next:: $(GUIDE)/resources/xsl
$(MKDIR) -p $(GUIDE_OUTDIR)
$(CP) $(GUIDE)/resources/$(STYLESHEET) $(GUIDE_OUTDIR)/$(STYLESHEET)
$(CP) $(GUIDE)/resources/images/* $(GUIDE_OUTDIR)/
$(CP) $(GUIDE)/resources/*.js $(GUIDE_OUTDIR)/
$(XSLTPROC) --xinclude \
--stringparam profile.audience \
"$(if $(filter %-next,$@),$(MACPORTS_NEXT_AUDIENCE),$(MACPORTS_RELEASED_AUDIENCE))" \
--output $(GUIDE_OUTDIR)/index.html \
$(GUIDE_XSL) $(GUIDE_SRC)/guide.xml
# Convert all sections (h1-h9) to a link so it's easy to link to them.
@@ -81,22 +93,28 @@ guide guide-chunked:: $(GUIDE)/resources/xsl
's|(<h[0-9] [^>]*><a id="([^"]*)"></a>)([^<]*)(</h[0-9]>)|\1<a href="#\2">\3</a>\4|g' \
$(GUIDE_OUTDIR)/index.html

guide-chunked::
guide-chunked guide-chunked-next::
# Add the table of contents to every chunked HTML file.
# If someone knows a better way to do this please change it.
$(TCLSH) toc-for-chunked.tcl $(GUIDE_OUTDIR)

# Generate the guide as a PDF.
guide-dblatex: SUFFIX = pdf
guide-dblatex:
guide-dblatex: $(GUIDE)/resources/xsl
$(MKDIR) -p $(GUIDE_RESULT_DBLATEX)
$(XSLTPROC) --xinclude \
--stringparam profile.audience \
"$(if $(filter %-next,$@),$(MACPORTS_NEXT_AUDIENCE),$(MACPORTS_RELEASED_AUDIENCE))" \
--output $(GUIDE_RESULT_DBLATEX)/guide.xml \
$(GUIDE)/resources/xsl/profiling/profile.xsl \
$(GUIDE_SRC)/guide.xml
$(DBLATEX) \
--fig-path="$(GUIDE)/resources/images" \
--type="$(SUFFIX)" \
--param='toc.section.depth=2' \
--param='doc.section.depth=3' \
--output="$(GUIDE_RESULT_DBLATEX)/macports-guide.$(SUFFIX)" \
$(GUIDE_SRC)/guide.xml
$(GUIDE_RESULT_DBLATEX)/guide.xml

# Remove all temporary files generated by guide:.
clean:

0 comments on commit bf54d37

Please sign in to comment.
You can’t perform that action at this time.