-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathedoc
executable file
·48 lines (40 loc) · 1.31 KB
/
edoc
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/bash
# Script to generate EDoc documentation.
# It is also possible to (optionally) deploy the documentation to
# the github gh-pages branch. The current branch must be clean (no
# changes in 'git status') when deploying to gh-pages.
#
# Usage:
# ./edoc.sh - will only generate the documentation
# ./edoc.sh deploy - will do the above and deploy to github
mkdir -p tmp
mkdir -p doc
# get edown from github
git clone https://github.com/hdiedrich/markedoc.git tmp
# preprocess README.md because markdown.sed can't handle code blocks
perl -pi.bak -e "s/\`\`\`/\'\'\'/g" README.md
perl -pi -e "s/\'\'\'erlang/\`\`\`/g" README.md
# create overview.edoc
echo "@title libsnarl - SNARL interface library" > doc/overview.edoc
echo "@copyright 2012 Heinz N. Gies" >> doc/overview.edoc
echo "" >> doc/overview.edoc
gsed -r -f tmp/bin/markedoc.sed README.md >> doc/overview.edoc
# restore original README.md
mv README.md.bak README.md
# create edoc and cleanup
make docs
rm -rf tmp
# deploy to gh-pages
if [ "$1" == "deploy" ]; then
CURRENT=`git branch | grep "*" | awk '{print $2}'`
git checkout gh-pages
rm *.html
rm edoc-info
rm erlang.png
rm stylesheet.css
cp doc/* .
git add .
git commit -a -m "Regenerated site documentation."
git push origin gh-pages
git checkout $CURRENT
fi