aboutsummaryrefslogtreecommitdiff
path: root/web/mkdemos.sh
blob: f612ffc35958bf527084d3abe825a84cbf5dfc8e (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
#!/bin/sh -e
# creates demo page for pandoc
# argument #1 is the destination directory
# argument #2 is the directory containing pandoc, html2markdown, markdown2pdf

DEST=$1
PROGPATH=$2

NEWLINE='
'
DEMOS='pandoc README -o demo0.html
pandoc -s -S README -o demo0.html
pandoc -s -S -c main.css -B header.html -A footer.html README -o demo0.html
pandoc -s README -o demo0.tex
pandoc -s README.tex -o demo0.txt
pandoc -s -w rst README -o demo0.txt
pandoc -s README -o demo0.rtf 
pandoc -s -m -i -w s5 S5DEMO -o demo0.html
html2markdown http://www.gnu.org/software/make/ -o demo0.txt
markdown2pdf README -o demo0.pdf
markdown2pdf -C myheader.tex README -o demo0.pdf'

oldifs=$IFS
IFS=$NEWLINE
set -- $DEMOS
IFS=$oldifs

cd $DEST
PATH=$PROGPATH:$PATH

echo '% Pandoc demos

To see the output created by each of the commands below,
click on the name of the output file:

'
num=0
for command in "$@"; do
    num=$(($num + 1))
    command=$(echo $command | sed -e "s/0/$num/")
    firstpart=$(echo $command | sed -e 's/\(.*\) [^ ]* -o.*/\1/')
    input=$(echo $command | sed -e 's/.* \([^ ]*\) -o.*/\1/') 
    output=$(echo $command | sed -e 's/.*-o \(.*\)/\1/')
    echo "1. <code>$firstpart <a href=\""$input"\" title=\""View input file"\">$input</a> -o <a href=\""$output"\" title=\""View pandoc output"\">$output</a></code>"
    echo $command >&2
    result=$($command) # run the command and create output file
done