summaryrefslogtreecommitdiff
path: root/examples/website/main.aap
blob: 4758564870b50691c3d6bbfa5b4886f9290b3531 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# A-A-P file for making AsciiDoc Web pages.

:execute ../../common.aap

WEB_NAME = asciidoc

LAYOUT ?= layout1

# Various document locations.
PROJ_DIR = ../..
DOCS_DIR = $PROJ_DIR/doc
LOCAL_WEB = ~/tmp/asciidoc-web # Local web marshalling location.

# List of web pages.
WEB_ROOT =
    a2x.1
    asciidoc-docbook-xsl
    asciidoc-graphviz-sample
    asciimathml
    CHANGELOG
    downloads
    faq
    index
    INSTALL
    latex-backend
    latexmathml
    manpage
    music-filter
    README
    README-website
    source-highlight-filter
    support
    userguide
    version83
    version9
    newtables
    newlists
WEB_PAGES = $*(WEB_ROOT).html
WEB_SOURCE = $*(WEB_ROOT).txt

# Web site specific pages to spell check.
SPELL_CHECK =
    index.txt
    downloads.txt
    README-website.txt
    support.txt
    source-highlight-filter.txt
    music-filter.txt

# Accompanying documents in DOCS_DIR.
DOCS_ROOT =
    asciidoc
    asciidoc.1
DOCS =
    $*(DOCS_ROOT).txt
    $*(DOCS_ROOT).html
    $*(DOCS_ROOT).css-embedded.html
    $*(DOCS_ROOT).xml
    asciidoc.pdf
    asciidoc.1
    article.txt article.html
    book.txt book.html
    book-multi.txt book-multi.html
    docbook-xsl.css
    article.pdf
    latexmath.pdf

# Client applications.
@if OSTYPE == 'posix':
    ASCIIDOC = `program_path("asciidoc")`
    @if not ASCIIDOC:
        :print ERROR: asciidoc(1) not found
        :exit
    TAR = `program_path("tar")`
    ASPELL = `program_path("aspell")`
@else:
    :print ERROR: Unsupported operating system $OSTYPE
    :exit

:syseval which xmllint | :assign XMLLINT    # Validates XML.

# AsciiDoc options to generate documentation HTML.
ASCIIDOC_HTML =
    python ../../asciidoc.py --unsafe -b xhtml11 -f $(LAYOUT).conf -a icons -a badges -a revision=$(VERS)@ -a date="$(DATE)@"
@if LAYOUT == 'layout2':
    ASCIIDOC_HTML += -a quirks!

:rule %.html : %.txt $(LAYOUT).conf
    @if target in ('userguide.html','faq.html'):
        # User guide has author, revision, date in header.
        opts = -a toc -a numbered
    @elif target == 'index.html':
        # Index has description and keywords meta tags.
        opts = -a index-only
    @elif target in ('manpage.html','a2x.1.html'):
        opts = -d manpage
    @elif target == 'asciimathml.html':
        opts = -a asciimath
    @elif target == 'latexmathml.html':
        opts = -a latexmath
    @else:
        opts =
    @if target in ('index.html','INSTALL.html','downloads.html','manpage.html','a2x.1.html'):
        opts += -a toc -a toclevels=1
    :sys $ASCIIDOC_HTML $opts $(source[0])
    @if _no.XMLLINT:
        :sys $XMLLINT --nonet --noout --valid $target
    @else:
        :print WARNING: xmllint(1) unavailable: skipping validation

all: $(WEB_PAGES)

copy: all
    # Copy to local web page.
    :sys rm -rf $LOCAL_WEB/*
    :sys mkdir -p $LOCAL_WEB/images/icons/callouts
    :sys cp $WEB_PAGES $LOCAL_WEB
    :sys cp $WEB_SOURCE $LOCAL_WEB
    :sys cp *.css $LOCAL_WEB
    :sys cp *.js $LOCAL_WEB
    :execute $PROJ_DIR/main.aap distribution    # Make docs and tarball.
    :sys cp $DOCS_DIR/$*DOCS $LOCAL_WEB
    :sys cp $PROJ_DIR/asciidoc-$(VERS).tar.gz $LOCAL_WEB
    :sys cp $PROJ_DIR/asciidoc-$(VERS).zip $LOCAL_WEB
    # Copy images.
    :sys cp $DOCS_DIR/images/*.png $LOCAL_WEB/images/
    :sys cp $DOCS_DIR/images/icons/*.png $LOCAL_WEB/images/icons/
    :sys cp $DOCS_DIR/images/icons/callouts/*.png $LOCAL_WEB/images/icons/callouts/
    # Copy chunked User Guide.
    :sys rm -rf $LOCAL_WEB/chunked/
    :sys mkdir -p $LOCAL_WEB/chunked/
    :sys cp $DOCS_DIR/asciidoc.chunked/*.html $LOCAL_WEB/chunked/
    :sys cp music?.* $LOCAL_WEB
    :sys cp sample?.png $LOCAL_WEB

clean:
    :del {f} $WEB_PAGES
    :del {f} *.bak          # Remove aspell backups.

spell: $(SPELL_CHECK)
    # Interactively spell check all files.
    @if _no.ASPELL:
        @for s in source_list:
            :sys {i} $ASPELL check -p ./$(WEB_NAME)-website.dict $s
    @else:
        :print WARNING: aspell(1) unavailable, skipping spell checking