summaryrefslogtreecommitdiff
path: root/fix-website.sh
blob: 3a2b4afd5402725747f9b085c628aba060ca213c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#! /bin/bash

set -eu
shopt -s nullglob

cd "doc/manual/html_node"
destdir="../html"

rm -rf "$destdir"
mkdir -p "$destdir"

for n in *.html; do
  echo fixing "$n"
  out="${n//_005f/_}"
  name="${out%%.html}"
  sed <"$n" \
    -e 's|<html lang="en">|<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN" "http://www.w3.org/TR/html4/strict.dtd"><html lang="en">|' \
    -e "s|<a name=\"${name}\"></a>||" \
    -e 's|_005f|_|g' \
    -e 's|href="../index.html#dir">(dir)</a>|href="http://savannah.gnu.org/projects/autoconf-archive/">Home Page at Savannah</a>|g' \
  | tidy >"$destdir/${out}" -q --indent yes --indent-spaces 1 -wrap 80 --tidy-mark no --hide-comments yes
done