aboutsummaryrefslogtreecommitdiff
path: root/doc/doc.sh
blob: 36b96e2be59538f9b38d9b04984698ccb2357e5f (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
#! /usr/bin/env bash

version=3.3.0.a10

trap 'exit 1' ERR
set -o errtrace # Trap in functions.

function info () { echo "$*" 1>&2; }
function error () { info "$*"; exit 1; }

date="$(date +"%B %Y")"
copyright="$(sed -n -re 's%^Copyright \(c\) (.+)\.$%\1%p' ../LICENSE)"

while [ $# -gt 0 ]; do
  case $1 in
    --clean)
      rm -f xsde.xhtml xsde.1
      rm -f cxx/hybrid/guide/cxx-hybrid-e-guide.{ps,pdf}
      rm -f cxx/parser/guide/cxx-parser-e-guide.{ps,pdf}
      rm -f cxx/serializer/guide/cxx-serializer-e-guide.{ps,pdf}
      exit 0
      ;;
    *)
      error "unexpected $1"
      ;;
  esac
done

ops=(\
-v project="xsde" \
-v version="$version" \
-v date="$date" \
-v copyright="$copyright" \
-I ../xsde \
--stdout \
--suppress-undocumented \
--exclude-base)

# XHTML
#
# Common options.
#
cli "${ops[@]}" --generate-html --class CXX::options --class options \
--html-prologue-file xsde-prologue.xhtml \
../xsde/cxx/options.cli >xsde.xhtml

# C++/Hybrid options.
#
cli "${ops[@]}" --generate-html \
--html-prologue-file xsde-hybrid-header.xhtml \
../xsde/cxx/hybrid/options.cli >>xsde.xhtml

# C++/Parser options.
#
cli "${ops[@]}" --generate-html \
--html-prologue-file xsde-parser-header.xhtml \
../xsde/cxx/parser/options.cli >>xsde.xhtml

# C++/Serializer options.
#
cli "${ops[@]}" --generate-html \
--html-prologue-file xsde-serializer-header.xhtml \
--html-epilogue-file xsde-epilogue.xhtml \
../xsde/cxx/serializer/options.cli >>xsde.xhtml

# MAN
#
# Common options.
#
cli "${ops[@]}" --generate-man --class CXX::options --class options \
--man-prologue-file xsde-prologue.1 \
../xsde/cxx/options.cli >xsde.1

# C++/Hybrid options.
#
cli "${ops[@]}" --generate-man \
--man-prologue-file xsde-hybrid-header.1 \
../xsde/cxx/hybrid/options.cli >>xsde.1

# C++/Parser options.
#
cli "${ops[@]}" --generate-man \
--man-prologue-file xsde-parser-header.1 \
../xsde/cxx/parser/options.cli >>xsde.1

# C++/Serializer options.
#
cli "${ops[@]}" --generate-man \
--man-prologue-file xsde-serializer-header.1 \
--man-epilogue-file xsde-epilogue.1 \
../xsde/cxx/serializer/options.cli >>xsde.1

# PS, PDF
#
# C++/Hybrid guide.
#
html2ps -f cxx/hybrid/guide/guide.html2ps \
-o cxx/hybrid/guide/cxx-hybrid-e-guide.ps cxx/hybrid/guide/index.xhtml

ps2pdf14 -dOptimize=true -dEmbedAllFonts=true \
cxx/hybrid/guide/cxx-hybrid-e-guide.ps cxx/hybrid/guide/cxx-hybrid-e-guide.pdf

# C++/Parser guide.
#
html2ps -f cxx/parser/guide/guide.html2ps \
-o cxx/parser/guide/cxx-parser-e-guide.ps cxx/parser/guide/index.xhtml

ps2pdf14 -dOptimize=true -dEmbedAllFonts=true \
cxx/parser/guide/cxx-parser-e-guide.ps cxx/parser/guide/cxx-parser-e-guide.pdf

# C++/Serializer guide.
#
html2ps -f cxx/serializer/guide/guide.html2ps \
-o cxx/serializer/guide/cxx-serializer-e-guide.ps cxx/serializer/guide/index.xhtml

ps2pdf14 -dOptimize=true -dEmbedAllFonts=true \
cxx/serializer/guide/cxx-serializer-e-guide.ps cxx/serializer/guide/cxx-serializer-e-guide.pdf