Rename GP_Context -> GP_Pixmap
[gfxprim.git] / doc / gen_examples_page.sh
blobeb94a4d1b3e0c783f1494c82b3b7def03e49d443
1 #!/bin/sh
3 # Autogenerate examples page
5 OUT="$1"
7 get_names()
9 LINKS=$(grep 'include:.*' $1)
10 NAMES=$(echo $LINKS | sed 's/include:://g' | sed 's/\[\]//g')
11 for i in $NAMES; do
12 echo $(basename $i)
13 done
16 table_header()
18 echo ".List $1 examples" >> $OUT
19 echo "[grid=\"rows\"]" >> $OUT
20 echo '[options="autowidth,header",cols="<,<m"]' >> $OUT
21 echo "|===========================" >> $OUT
22 echo "| Example | Source filename(s)" >> $OUT
25 table_footer()
27 echo "|===========================" >> $OUT
30 echo "List of examples" > $OUT
31 echo "----------------" >> $OUT
32 echo "Following pages contains a list of all code examples, the source " >> $OUT
33 echo "files could be found and are compiled in the +demos/c_simple/+ and" >> $OUT
34 echo "+demos/py_simple+ directories in the source tree." >> $OUT
35 echo >> $OUT
37 table_header "C"
38 for i in example_*.txt; do
39 LINK=$(echo $i | sed s/.txt/.html/)
40 DESC=$(head -n 1 $i)
41 FNAMES=$(get_names "$i")
42 if $(echo $i | grep -q '_py_'); then
43 continue
45 echo "| link:$LINK[$DESC] | $FNAMES" >> $OUT
46 done
47 table_footer
49 table_header "Python"
50 for i in example_py_*.txt; do
51 LINK=$(echo $i | sed s/.txt/.html/)
52 DESC=$(head -n 1 $i)
53 FNAMES=$(get_names "$i")
54 echo "| link:$LINK[$DESC] | $FNAMES" >> $OUT
55 done
56 table_footer