File: generate.sh

package info (click to toggle)
cppreference-doc 20170409-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 259,872 kB
  • sloc: xml: 570,184; python: 1,923; php: 520; makefile: 168; sh: 25; cpp: 9; ansic: 9
file content (50 lines) | stat: -rwxr-xr-x 1,706 bytes parent folder | download | duplicates (4)
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
#!/bin/bash
#   Copyright (C) 2011, 2012  Povilas Kanapickas <povilas@radix.lt>
#
#   This file is part of cppreference-doc
#
#   This program is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with this program.  If not, see http://www.gnu.org/licenses/.

mkdir -p "output"
mkdir -p "output/inheritance"

for i in $(find inheritance -iname "*.dot")
do

    o=${i#*/}

    outdir="output/inheritance/"
    infile="$i"
    setfile="inheritance/settings-dot"
    outfile="$outdir/$o.svg"
    mapfile="$outdir/$o.map"
    wikimapfile="$outdir/$o.wikimap"
    tmpsvgfile="$outdir/$o.tmpsvg"
    tmpdotfile="$outdir/$o.tmpdot"

    python preprocess.py $infile $setfile $tmpdotfile
    dot -Tsvg -o$tmpsvgfile $tmpdotfile
    xsltproc --novalid fix_svg-dot.xsl $tmpsvgfile > $outfile
    dot -Timap $tmpdotfile | sed 1d | awk '{sub(/,/, " ", $3); sub(/,/, " ", $4); print $1" "$3" "$4" [["$2"]]"; };' > $mapfile

    wikiimage=$(echo $o | sed 's/\.\///' | sed 's/\.dot//')
    echo "{{inheritance diagram|image=$wikiimage.svg|notes={{{notes|}}}|map=" > $wikimapfile
    cat $mapfile >> $wikimapfile
    echo "}}" >> $wikimapfile

    rm $tmpsvgfile
    rm $tmpdotfile
done

python math.py