~ubuntu-branches/ubuntu/saucy/sgt-puzzles/saucy-proposed

« back to all changes in this revision

Viewing changes to debian/patches/201_make-more-docs.diff

  • Committer: Package Import Robot
  • Author(s): Ben Hutchings
  • Date: 2013-06-30 03:20:16 UTC
  • mfrom: (1.2.13)
  • Revision ID: package-import@ubuntu.com-20130630032016-v8xqt6vtg6tgs420
Tags: 9872-1
* New upstream version
  - Add an explicit -lm to the link lines in Makefile.gtk (Closes: #713476)
  - Add Undead by Steffen Bauer, an implementation of 'Haunted Mirror Maze'
  - Add Unruly by Lennard Sprong, an implementation of a puzzle usually
    called 'Tohu wa Vohu'
* Add DEP-3 headers to patches
* pearl: Require width or height to be at least 6 for Tricky
  (Closes: #667963)
* debian/watch: Update ViewVC URL regex
* Add 'sgt-' prefix to all command names and remove 'game' suffix, but
  retain symlinks under the old names (see #684193)
* Use upstream short descriptions in English manual pages and package
  description
* Update German translation, thanks to Helge Kreutzmann

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
4
 
game's manual page.
5
 
 
6
 
--- sgt-puzzles.orig/Makefile.doc
7
 
+++ sgt-puzzles/Makefile.doc
8
 
@@ -11,12 +11,15 @@
 
1
Author: Ben Hutchings <ben@decadent.org.uk>
 
2
Description: Add rules and script to build manual pages and HTML
 
3
 
 
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.
 
7
 
 
8
--- a/Makefile.doc
 
9
+++ b/Makefile.doc
 
10
@@ -14,12 +14,20 @@ puzzles.hhp: puzzles.but chm.but
9
11
        halibut --html puzzles.but chm.but
10
12
 
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
24
 
@@ -38,6 +41,38 @@
 
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))
27
34
 
28
 
+doc/man-en-stamp: puzzles.but
 
35
+doc/man-en-stamp: preprocessed.but
29
36
+       mkdir -p doc
30
37
+       rm -rf doc/man-en
31
38
+       mkdir doc/man-en
32
39
+       perl mkmanpages.pl en
33
40
+       touch $@
34
 
+doc/man-%-stamp: doc/puzzles.but.%
 
41
+doc/man-%-stamp: doc/preprocessed.but.%
35
42
+       mkdir -p doc
36
43
+       rm -rf doc/man-$*
37
44
+       mkdir doc/man-$*
39
46
+       touch $@
40
47
+man: $(patsubst %,doc/man-%-stamp,$(LANGUAGES))
41
48
+
42
 
+doc/html-en-stamp: puzzles.but
 
49
+doc/html-en-stamp: preprocessed.but
43
50
+       mkdir -p doc
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
47
54
+       touch $@
48
 
+doc/html-%-stamp: doc/puzzles.but.%
 
55
+doc/html-%-stamp: doc/preprocessed.but.%
49
56
+       mkdir -p doc
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.$*
53
60
+       touch $@
54
61
+html: $(patsubst %,doc/html-%-stamp,$(LANGUAGES))
55
62
+
57
64
+all: man html
58
65
+
59
66
 clean:
60
 
        rm -f puzzles.hlp puzzles.txt HACKING *.html *.hh[pck]
 
67
        rm -f puzzles.hlp puzzles.txt preprocessed.but HACKING *.html *.hh[pck]
61
68
+       rm -f puzzles.cnt
62
69
        rm -rf doc
63
70
--- /dev/null
64
 
+++ sgt-puzzles/mkmanpages.pl
65
 
@@ -0,0 +1,214 @@
 
71
+++ b/mkmanpages.pl
 
72
@@ -0,0 +1,154 @@
66
73
+#!/usr/bin/perl -w
67
74
+
68
75
+# Generate manual pages for sgt-puzzles by running extracts of puzzles.but
94
101
+my $section_no = "6";
95
102
+my $man_dir = "doc/man-$language";
96
103
+
97
 
+# Name of command corresponding to each game-specific chapter name
98
 
+my %commands = (blackbox       => 'blackboxgame',
99
 
+               bridges         => 'bridges',
100
 
+               cube            => 'cube',
101
 
+               dominosa        => 'dominosa',
102
 
+               fifteen         => 'fifteen',
103
 
+               filling         => 'filling',
104
 
+               flip            => 'flipgame',
105
 
+               galaxies        => 'galaxies',
106
 
+               guess           => 'guess',
107
 
+               inertia         => 'inertia',
108
 
+               keen            => 'keen',
109
 
+               lightup         => 'lightup',
110
 
+               loopy           => 'loopy',
111
 
+               magnets         => 'magnets',
112
 
+               map             => 'map',
113
 
+               mines           => 'mines',
114
 
+               net             => 'netgame',
115
 
+               netslide        => 'netslide',
116
 
+               pattern         => 'pattern',
117
 
+               pearl           => 'pearl',
118
 
+               pegs            => 'pegs',
119
 
+               range           => 'range',
120
 
+               rectangles      => 'rect',
121
 
+               samegame        => 'samegame',
122
 
+               signpost        => 'signpost',
123
 
+               singles         => 'singles',
124
 
+               sixteen         => 'sixteen',
125
 
+               slant           => 'slant',
126
 
+               solo            => 'solo',
127
 
+               tents           => 'tents',
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'));
 
104
+my %commands;
 
105
+my %short_descs;
 
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;
 
111
+}
 
112
+close $gamedesc;
166
113
+
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
179
126
+
180
127
+# Gather chapters from the original documentation
181
128
+my $source_name =
182
 
+    $language eq 'en' ? 'puzzles.but' : "doc/puzzles.but.$language";
 
129
+    $language eq 'en' ? 'preprocessed.but' : "doc/preprocessed.but.$language";
183
130
+my $source = new IO::File($source_name, 'r') or die "$source_name: $!";
184
131
+while (<$source>) {
185
132
+    # Look for chapter/appendix heading
213
160
+      . $contents{__HEADER__}
214
161
+      . "\\C{man-$command} $command\n\n" # dummy chapter
215
162
+      . "\\H{man-$command-name} " . gettext('NAME') . "\n\n"
216
 
+      . "\\c{$command} \\- $short_descs{$command}\n\n"
 
163
+      . "\\c{$command} \\- $short_descs{$chapter}\n\n"
217
164
+      . "\\H{man-$command-synopsis} " . gettext('SYNOPSIS') . "\n\n"
218
165
+      # Translator: abbreviation for 'number'
219
166
+      . "\\cw{$command} [\\cw{--generate }\\e{" . gettext('n') . "}]\n"