File: texi2html.sh

package info (click to toggle)
r-base 4.5.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 112,924 kB
  • sloc: ansic: 291,338; fortran: 111,889; javascript: 14,798; yacc: 6,154; sh: 5,689; makefile: 5,239; tcl: 4,562; perl: 963; objc: 791; f90: 758; asm: 258; java: 31; sed: 1
file content (38 lines) | stat: -rw-r--r-- 1,274 bytes parent folder | download | duplicates (2)
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
#!/bin/sh

## For now, only post-process the texi2any --html results.
## Could also do the the generation, but options differ according to
## manual (in particular, R-FAQ uses a different CSS).
## Arguments:
##    maj min html
## with maj and min the maj and min components of the tex2any version,
## and html the name of the HTML *target*: the actual input will have
## '.tmp' appended to html.

SED=${SED-sed}
sedscriptini=`echo "$0" | ${SED} 's/texi2html.sh/quot.sed/'`
sedscriptuse=$3.sed
if test $1 -ge 7; then
  cat ${sedscriptini} | ${SED} '/s\/<table/d' > ${sedscriptuse}
  cat >>${sedscriptuse} <<-EOF
	s/<td width="/<td style="width: /g
	s/<th width="/<th style="width: /g
	s/<table summary=""/<table/
	s/\(<ol class="enumerate"\) type="a"/\1 style="list-style-type: lower-alpha"/
	EOF
elif test "$1" -eq 6 -a "$2" -eq 8; then
  ## drop title (appears duplicated) consistent with Texinfo >= 7.0
  cat "${sedscriptini}" - >>"${sedscriptuse}" <<-EOF
	/<h1 class="settitle"/d
	EOF
else
  ## Texinfo < 6.8 lacks the viewport declaration
  cat "${sedscriptini}" - >"${sedscriptuse}" <<-EOF
	s/<meta name="desc/<meta name="viewport" content="width=device-width,initial-scale=1">\\
	<meta name="desc/
	EOF
fi
${SED} -f ${sedscriptuse} $3.tmp > $3
rm -f ${sedscriptuse}