1
Add rules and script to build manual pages and HTML. Halibut already
2
supports these formats but since the documentation is all combined we
3
need to do a bit more work to extract the right information for each
6
--- sgt-puzzles.orig/Makefile.doc
7
+++ sgt-puzzles/Makefile.doc
1
Author: Ben Hutchings <ben@decadent.org.uk>
2
Description: Add rules and script to build manual pages and HTML
4
Halibut already supports these formats but since the documentation is
5
all combined we need to do a bit more work to extract the right
6
information for each game's manual page.
10
@@ -14,12 +14,20 @@ puzzles.hhp: puzzles.but chm.but
9
11
halibut --html puzzles.but chm.but
11
13
TRANSLATIONS := $(patsubst po/%.po,%,$(wildcard po/*.po))
16
18
test -f po/puzzles-doc.pot
17
19
po4a-gettextize -f halibut -m puzzles.but --package-name puzzles \
18
20
-p po/puzzles-doc.tmp1.pot
21
+ awk -F: '{ print ""; \
22
+ print "#: " $$1 ".R"; \
23
+ print "msgid \"" $$4 "\""; \
24
+ print "msgstr \"\""; }' \
25
+ < gamedesc.txt >> po/puzzles-doc.tmp1.pot
19
26
+ xgettext -j -cTranslator: --package-name puzzles \
20
27
+ -o po/puzzles-doc.tmp1.pot mkmanpages.pl
21
28
sed -i '1,/^#$$/d' po/puzzles-doc.tmp1.pot
22
29
cat po/puzzles-doc.pot.head po/puzzles-doc.tmp1.pot \
23
30
> po/puzzles-doc.tmp2.pot
31
@@ -44,6 +52,38 @@ doc/puzzles.txt.%: doc/preprocessed.but.
25
32
halibut --text=$@ --input-charset=UTF-8 $<
26
33
all: $(addprefix doc/puzzles.txt.,$(TRANSLATIONS))
28
+doc/man-en-stamp: puzzles.but
35
+doc/man-en-stamp: preprocessed.but
30
37
+ rm -rf doc/man-en
32
39
+ perl mkmanpages.pl en
34
+doc/man-%-stamp: doc/puzzles.but.%
41
+doc/man-%-stamp: doc/preprocessed.but.%
36
43
+ rm -rf doc/man-$*
40
47
+man: $(patsubst %,doc/man-%-stamp,$(LANGUAGES))
42
+doc/html-en-stamp: puzzles.but
49
+doc/html-en-stamp: preprocessed.but
44
51
+ rm -rf doc/html-en
45
52
+ mkdir doc/html-en
46
+ cd doc/html-en && halibut --html ../../puzzles.but
53
+ cd doc/html-en && halibut --html ../../preprocessed.but
48
+doc/html-%-stamp: doc/puzzles.but.%
55
+doc/html-%-stamp: doc/preprocessed.but.%
50
57
+ rm -rf doc/html-$*
51
58
+ mkdir doc/html-$*
52
+ cd doc/html-$* && halibut --html --input-charset=UTF-8 ../puzzles.but.$*
59
+ cd doc/html-$* && halibut --html --input-charset=UTF-8 ../preprocessed.but.$*
54
61
+html: $(patsubst %,doc/html-%-stamp,$(LANGUAGES))
94
101
+my $section_no = "6";
95
102
+my $man_dir = "doc/man-$language";
97
+# Name of command corresponding to each game-specific chapter name
98
+my %commands = (blackbox => 'blackboxgame',
99
+ bridges => 'bridges',
101
+ dominosa => 'dominosa',
102
+ fifteen => 'fifteen',
103
+ filling => 'filling',
104
+ flip => 'flipgame',
105
+ galaxies => 'galaxies',
107
+ inertia => 'inertia',
109
+ lightup => 'lightup',
111
+ magnets => 'magnets',
115
+ netslide => 'netslide',
116
+ pattern => 'pattern',
120
+ rectangles => 'rect',
121
+ samegame => 'samegame',
122
+ signpost => 'signpost',
123
+ singles => 'singles',
124
+ sixteen => 'sixteen',
128
+ towers => 'towers',
129
+ twiddle => 'twiddle',
130
+ unequal => 'unequal',
131
+ untangle => 'untangle');
132
+my %short_descs = (blackboxgame => gettext('guessing game'),
133
+ bridges => gettext('topological deduction game'),
134
+ cube => gettext('tile manipulation puzzle game'),
135
+ dominosa => gettext('domino puzzle game'),
136
+ fifteen => gettext('tile manipulation puzzle game'),
137
+ filling => gettext('puzzle game'),
138
+ flipgame => gettext('tile manipulation puzzle game'),
139
+ galaxies => gettext('puzzle game'),
140
+ guess => gettext('guessing game based on Mastermind'),
141
+ inertia => gettext('puzzle game'),
142
+ keen => gettext('game based on KenKen'),
143
+ lightup => gettext('puzzle game'),
144
+ loopy => gettext('topological deduction game'),
145
+ magnets => gettext('magnets puzzle game'),
146
+ map => gettext('map colouring game'),
147
+ mines => gettext('game based on Minesweeper'),
148
+ netgame => gettext('tile manipulation puzzle game based on FreeNet'),
149
+ netslide => gettext('tile manipulation puzzle game'),
150
+ pattern => gettext('nonogram puzzle game'),
151
+ pearl => gettext('puzzle game based on Masyu'),
152
+ pegs => gettext('peg solitaire puzzle game'),
153
+ range => gettext('puzzle game based on Kurodoko'),
154
+ rect => gettext('puzzle game based on Divide by Squares'),
155
+ samegame => gettext('puzzle game'),
156
+ signpost => gettext('puzzle game based on Pfeilpfad'),
157
+ singles => gettext('puzzle game based on Hitori'),
158
+ sixteen => gettext('tile manipulation puzzle game'),
159
+ slant => gettext('topological deduction game'),
160
+ solo => gettext('puzzle game based on Sudoku'),
161
+ tents => gettext('puzzle game'),
162
+ towers => gettext('puzzle game based on Skyscrapers'),
163
+ twiddle => gettext('tile manipulation puzzle game'),
164
+ unequal => gettext('puzzle game based on Futoshiki'),
165
+ untangle => gettext('puzzle game based on Planarity'));
106
+my $gamedesc = new IO::File('gamedesc.txt', 'r');
107
+while (<$gamedesc>) {
108
+ (my $name, undef, undef, my $desc) = split /:/;
109
+ $commands{$name} = $ENV{BINPREFIX} . $name;
110
+ $short_descs{$name} = $desc;
167
114
+# We should be able to look these up with strftime('%A') but that
168
115
+# requires the relevant locale to be installed on the build host