forked from dspinellis/dgsh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathformat-eg.sh
50 lines (46 loc) · 932 Bytes
/
format-eg.sh
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/sh
#
# Format the examples into Bootstrap HTML
#
SECTION='compress-compare
commit-stats
code-metrics
duplicate-files
spell-highlight
word-properties
parallel-logresolve
parallel-word-count
web-log-report
web-log-stats
text-properties
static-functions
map-hierarchy
committer-plot
ft2d
NMRPipe
dir'
for NAME in ${SECTION}
do
TITLE="`sed -n 's/^# SYNOPSIS //p;s/^# TITLE //p' example/$NAME.sh | head -1`"
if [ "$1" = '-c' ]
then
echo "<li> <a href='#$NAME'>$TITLE</a></li>"
else
cat <<EOF
<section id="$NAME"> <!-- {{{2 -->
<h2>$TITLE</h2>
</section>
<img src="$NAME-pretty.png" class="img-polaroid" alt="$TITLE" />
<!-- Extracted description -->
<p>
`sed -n '/^# DESCRIPTION/,/^#$/{;/^# DESCRIPTION/d;s/^# //p;}' example/$NAME.sh`
</p>
<!-- Extracted code -->
<pre class="prettyprint lang-bash">
`sed '1a\
2,/^$/d' example/$NAME.sh |
sed 's/&/\&/g;s/</\</g;s/>/\>/g'`
</pre>
EOF
fi
done