summaryrefslogtreecommitdiff
path: root/render_locally
blob: 9e2575603ad3bfb420fe46035aea4725e97e2dad (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/sh

# Render the pages of this repository.

# Written by Thomas Schwinge <tschwinge@gnu.org>.

# See `contributing/web_pages' for further information.

export ROOT && ROOT=$(readlink -f "$(dirname "$0")") &&

# Don't translate.
export LC_MESSAGES && LC_MESSAGES=C &&

case $1 in
  --official)
    # Use this for rendering the set of pages which are to be installed under
    # <http://www.gnu.org/software/hurd/>.
    shift &&
    export TZ && TZ=UTC &&
    export DESTDIR && DESTDIR=$ROOT.rendered.official &&
    # Use ``--no-usedirs'' here, so that not too many separate directories have
    # to be created.
    #
    # ``--gettime --rebuild'':
    # <http://ikiwiki.info/bugs/pagemtime_in_refresh_mode/>
    set x \
      --set wikistatedir="$ROOT"/.ikiwiki-official \
      --url http://www.gnu.org/software/hurd \
      --no-usedirs \
      --gettime --rebuild \
      "$@" &&
    shift;;
  --w3m-wrapper)
    shift &&
    export NO_MSG && NO_MSG=y &&
    # Disable the configured VCS, as the CGI wrapper together with using the
    # anonok plugin inhibits the propagation of authorship information.
    set x \
      --cgi --wrapper ~/.ikiwiki/wrappers/hurd-web.cgi \
      --plugin anonok \
      --rcs norcs \
      "$@" &&
    shift &&
    exec \
      "$0" \
        --w3m \
        "$@";;
  --w3m)
    shift &&
    export DESTDIR && DESTDIR=$ROOT.rendered.w3m &&
    set x \
      --set wikistatedir="$ROOT"/.ikiwiki-w3m \
      --cgiurl hurd-web.cgi --w3mmode \
      "$@" &&
    shift &&
    exec \
      "$0" \
        "$@";;
  *)
    # Use ``--no-usedirs'' here, because when browsing local files, the web
    # browsers don't display `index.html' files by default when a hyperlink
    # referencing a directory is being opened.
    set x \
      --no-usedirs \
      "$@" &&
    shift;;
esac &&

ikiwiki \
  --setup "$ROOT"/ikiwiki.setup \
  --refresh \
  "$@" &&

if [ ${NO_MSG-n} = y ]; then :; else
  echo &&
  echo Now\ open\ \`"${DESTDIR-"$ROOT".rendered}"/index.html\'' to browse the web pages.'
fi