summaryrefslogtreecommitdiff
path: root/doc/fixinfo.sh
blob: b5d91f52ed2a5734b19d91bdd2d82c443cbd2083 (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
#! /bin/sh
#
# Fix a problem with HTML output produced by makeinfo 4.8.
#
# groff.texinfo uses (after macro expansion) something like
#
#   @deffn ...
#   @XXindex ...
#   @deffnx ...
#
# which has worked with earlier versions (using an undocumented feature
# of the implementation of @deffn and @deffnx).  Version 4.8 has new
# code for generating HTML, and the above construction produces wrong
# HTML output: It starts a new <blockquote> without closing it properly.
# The very problem is that, according to the documentation, the @deffnx
# must immediately follow the @deffn line, making it impossible to add
# entries into user-defined indices if supplied with macro wrappers around
# @deffn and @deffnx.
#
# Note that this script is a quick hack and tightly bound to the current
# groff.texinfo macro code.  Hopefully, a new texinfo version makes it
# unnecessary.

t=${TMPDIR-.}/gro$$.tmp

cat $1 | sed '
1 {
  N
  N
}
:b
$b
N
/^<blockquote>\n<p>.*\n\n   \&mdash;/ {
  s/^<blockquote>\n<p>\(.*\n\)\n   \&mdash;/\1\&mdash;/
  n
  N
  N
  bb
}
$b
P
D
' > $t
rm $1
mv $t $1