File: build-htmldocs

package info (click to toggle)
shorewall-doc 5.0.15-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 38,284 kB
  • ctags: 1
  • sloc: xml: 94,124; sh: 86; makefile: 9
file content (109 lines) | stat: -rw-r--r-- 2,923 bytes parent folder | download | duplicates (7)
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/sh

# This script was written by Roberto C. Sánchez and is based on code from the
# "Shorewall Release Processing" script
#
# That script is copyright as follows:
#  -- (C) 2003,2004,2005 -- Tom Eastep (teastep@shorewall.net)
#  -- (C) 2005,2006 -- Cristian Rodriguez (webmaster@shorewall.net)
#
# That script is licensed under the GPLv2
#

STYLESHEET=/usr/share/xml/docbook/stylesheet/nwalsh/xhtml/docbook.xsl

HTMFILES="6to4.htm
          blacklisting_support.htm
          configuration_file_basics.htm
          CorpNetwork.htm
          dhcp.htm
          Documentation.htm
          errata.htm
          fallback.htm
          FAQ.htm
          GnuCopyright.htm
          Install.htm
          IPIP.htm
          IPSEC.htm
          kernel.htm
          myfiles.htm
          NAT.htm
          ports.htm
          PPTP.htm
          ProxyARP.htm
          quotes.htm
          samba.htm
          shorewall_extension_scripts.htm
          shorewall_features.htm
          shorewall_mirrors.htm
          shorewall_prerequisites.htm
          shorewall_quickstart_guide.htm
          shorewall_setup_guide_fr.htm
          shorewall_setup_guide.htm
          Shorewall_sfindex_frame.htm
          standalone.htm
          starting_and_stopping_shorewall.htm
          support.htm
          three-interface.htm
          traffic_shaping.htm
          troubleshoot.htm
          two-interface.htm
          upgrade_issues.htm
          VPN.htm
          whitelisting_under_shorewall.htm"

NOTOC="Documentation_Index.xml
       ECN.xml
       fallback.xml
       GettingStarted.xml
       IPP2P.xml
       ping.xml
       ProxyARP.xml
       Shorewall_Doesnt.xml
       shorewall_features.xml
       shorewall_prerequisites.xml
       SimpleBridge.xml"

list_search() # $1 = element to search for , $2-$n = list
{
    local e=$1

    while [ $# -gt 1 ]; do
        shift
        [ "x$e" = "x$1" ] && return 0
    done

    return 1
}

mkdir html

for file in *.xml; do
    b=${file%.*}
    list_search $b.htm $HTMFILES && b=$b.htm || b=$b.html
    list_search $1 $NOTOC && GENTOC="--stringparam generate.toc ''" || GENTOC=

    case $file in
        *_ru.xml)
            LANGUAGE="--stringparam l10n.gentext.default.language ru"
            ;;
        *_fr.xml)
            LANGUAGE="--stringparam l10n.gentext.default.language fr"
            ;;
        *)
            LANGUAGE=
            ;;
    esac

    echo "Converting $file from XML to HTML (html/$b) ..."
    xsltproc --output html/$b --stringparam html.stylesheet html.css --stringparam ulink.target _self $GENTOC -param toc.section.depth 3 $STYLESHEET $file
done

cd manpages
for f in *.xml; do
    if [ $f != shorewall-template.xml ]; then
        echo "Generating HTML from $f..."
        xsltproc --output ${f%.xml}.html --stringparam html.stylesheet html.css --stringparam ulink.target _self -param toc.section.depth 3 $STYLESHEET $f
    fi
done