| 1 |
#!/bin/ksh |
| 2 |
|
| 3 |
|
| 4 |
# create any directories that do not already exist |
| 5 |
|
| 6 |
mkdir -p examples/manual/xml |
| 7 |
|
| 8 |
|
| 9 |
# for each chapter, take all the program listings and the outputs |
| 10 |
# from each, and insert them into an xml file. We'll have one xml file |
| 11 |
# per chapter which includes all the listings and outputs for that chapter. |
| 12 |
|
| 13 |
xmlchapterheading='<?xml version="1.0" encoding="UTF-8"?>' |
| 14 |
magml_path="examples/manual/magml/source" |
| 15 |
|
| 16 |
|
| 17 |
for chapter in text wind contour data obs boxplot using pline |
| 18 |
do |
| 19 |
echo "Chapter: $chapter" |
| 20 |
examples_xml_file="examples/manual/xml/${chapter}_examples.xml" |
| 21 |
print $xmlchapterheading > $examples_xml_file |
| 22 |
print "<section id=\"${chapter}_examples\">" >> $examples_xml_file |
| 23 |
# print " <title>${chapter} Examples</title>" >> $examples_xml_file |
| 24 |
|
| 25 |
for source_file in examples/manual/fortran/source/${chapter}*.f |
| 26 |
do |
| 27 |
if [[ ! -a "$source_file" ]] |
| 28 |
then |
| 29 |
echo "not found: $source_file" |
| 30 |
continue |
| 31 |
fi |
| 32 |
|
| 33 |
bname=`basename $source_file .f` |
| 34 |
echo " Source : $source_file ($bname)" |
| 35 |
|
| 36 |
print "<?pagebreak?>" >> $examples_xml_file |
| 37 |
print "<section id=\"Program_$bname\">" >> $examples_xml_file |
| 38 |
print " <title>Program: $bname</title>" >> $examples_xml_file |
| 39 |
|
| 40 |
|
| 41 |
print " <programlisting><xi:include href=\"../fortran/source/$bname.f_cc\" parse=\"xml\"" >> $examples_xml_file |
| 42 |
print " xmlns:xi=\"http://www.w3.org/2001/XInclude\" />" >> $examples_xml_file |
| 43 |
print " </programlisting>" >> $examples_xml_file |
| 44 |
|
| 45 |
|
| 46 |
# if there exists a corresponding MagML example, then include its source too |
| 47 |
|
| 48 |
magml_file="$bname.magml" |
| 49 |
|
| 50 |
if [[ -a $magml_path/$magml_file ]] |
| 51 |
then |
| 52 |
echo " MagML : $magml_file" |
| 53 |
|
| 54 |
print "<?pagebreak?>" >> $examples_xml_file |
| 55 |
print "<section id=\"Program_${bname}_magml\">" >> $examples_xml_file |
| 56 |
print " <title>Program: $magml_file</title>" >> $examples_xml_file |
| 57 |
|
| 58 |
|
| 59 |
print " <programlisting><xi:include href=\"../magml/source/${magml_file}_cc\" parse=\"xml\"" >> $examples_xml_file |
| 60 |
print " xmlns:xi=\"http://www.w3.org/2001/XInclude\" />" >> $examples_xml_file |
| 61 |
print " </programlisting>" >> $examples_xml_file |
| 62 |
print " </section>" >> $examples_xml_file |
| 63 |
fi |
| 64 |
|
| 65 |
|
| 66 |
for ps_file in examples/manual/fortran/ps/${bname}*.ps |
| 67 |
do |
| 68 |
echo " PS : $ps_file" |
| 69 |
bnameplot=`basename $ps_file .ps` |
| 70 |
plot_id="${bnameplot}Plot" |
| 71 |
pngname="examples/manual//fortran/png/$bnameplot.png" |
| 72 |
# epsname="examples/manual/fortran/epsi/$bnameplot.epsi" |
| 73 |
pnghtml="images/fortran/$bnameplot.png" |
| 74 |
|
| 75 |
print " <?pagebreak?>" >> $examples_xml_file |
| 76 |
print " <section id=\"${plot_id}_Output\">" >> $examples_xml_file |
| 77 |
print " <title>Plot $bnameplot</title>" >> $examples_xml_file |
| 78 |
print " <mediaobject id=\"$plot_id\">" >> $examples_xml_file |
| 79 |
print " <imageobject role=\"html\">" >> $examples_xml_file |
| 80 |
print " <imagedata format=\"PNG\" fileref=\"$pnghtml\"/>" >> $examples_xml_file |
| 81 |
print " </imageobject>" >> $examples_xml_file |
| 82 |
print " <imageobject role=\"fo\">" >> $examples_xml_file |
| 83 |
print " <imagedata format=\"PNG\" depth=\"10cm\" fileref=\"$pngname\"/>" >> $examples_xml_file |
| 84 |
print " </imageobject>" >> $examples_xml_file |
| 85 |
print " </mediaobject>" >> $examples_xml_file |
| 86 |
print " </section>" >> $examples_xml_file |
| 87 |
|
| 88 |
|
| 89 |
done |
| 90 |
|
| 91 |
print "</section>" >> $examples_xml_file |
| 92 |
|
| 93 |
done |
| 94 |
|
| 95 |
print "</section>" >> $examples_xml_file |
| 96 |
|
| 97 |
done |
| 98 |
|
| 99 |
|
| 100 |
# for psfile in examples/ps/*.ps |
| 101 |
# do |
| 102 |
# bname=`basename $psfile .ps` |
| 103 |
# ps2epsi $psfile "examples/epsi/$bname.epsi" |
| 104 |
# convert $psfile "examples/png/$bname.png" |
| 105 |
# done |