Release 0.12: set version number to 0.12
[docutils.git] / sandbox / paultremblay / python_interface / test.sh
bloba85c97500b33b52e20213f23b4e0ceb465e0f2b1
1 # $Id$
2 set -e
3 set -u # warns if a variable is not assigned.
5 STYLESHEET=../xsl_fo/docutils_to_fo.xsl
6 rm -Rf test_output
7 mkdir test_output
8 cp test_files/* test_output
9 cd test_output
11 echo converting rst to xml
12 # convert the files to XML
13 FILES=`ls *rst`
15 for THE_FILE in $FILES
17 FILENAME=`basename $THE_FILE .rst`
18 NEW_FILE=${FILENAME}.xml
19 rst2xml.py $THE_FILE > $NEW_FILE
20 done
22 echo converting XML to FO
23 # simple page, no numbers, inline; just paragraphs
24 xsltproc --stringparam page-layout "simple" \
25 $STYLESHEET long_plain.xml > simple_no_page_nos.fo
26 xmlformat.pl -i simple_no_page_nos.fo
28 # first page, no numbers, etc; just paragraphs
29 xsltproc --stringparam page-layout "first" \
30 $STYLESHEET long_plain.xml > first_page_diff_no_page_nos.fo
31 xmlformat.pl -i first_page_diff_no_page_nos.fo
33 # odd-even page, no numbers, etc; just paragraphs
34 xsltproc --stringparam page-layout "odd-even" \
35 $STYLESHEET long_plain.xml > odd_even_no_page_nos.fo
36 xmlformat.pl -i odd_even_no_page_nos.fo
38 # first-odd-even page, no numbers, etc; just paragraphs
39 xsltproc --stringparam page-layout "first-odd-even" \
40 $STYLESHEET long_plain.xml > first_odd_even_no_page_nos.fo
41 xmlformat.pl -i first_odd_even_no_page_nos.fo
43 # simple page, with headers and footers, no inline; just paragraphs
44 xsltproc --stringparam page-layout "simple" \
45 $STYLESHEET header_footer.xml > header_footer.fo
46 xmlformat.pl -i header_footer.fo
48 # simple page, with headers and footers, no inline; just paragraphs
49 # the --suppress-page-num has no effect
50 xsltproc --stringparam page-layout "simple" \
51 --stringparam suppress-first-page-header "True" \
52 $STYLESHEET header_footer.xml > header_footer2.fo
53 xmlformat.pl -i header_footer2.fo
55 # first page, with headers and footers, no inline; just paragraphs
56 xsltproc --stringparam page-layout "simple" \
57 $STYLESHEET header_footer.xml > first_page_header_footer.fo
58 xmlformat.pl -i first_page_header_footer.fo
60 # first page, with headers and footers, no inline; just paragraphs
61 # suppress first page header and footer
62 xsltproc --stringparam page-layout "first" \
63 --stringparam suppress-first-page-header "True" \
64 --stringparam suppress-first-page-footer "True" \
65 $STYLESHEET header_footer.xml > first_suppress_header__footer.fo
66 xmlformat.pl -i first_suppress_header__footer.fo
68 # odd-even page, with headers and footers, no inline; just paragraphs
69 xsltproc --stringparam page-layout "odd-even" \
70 $STYLESHEET header_footer.xml > odd_even_page_header_footer.fo
71 xmlformat.pl -i odd_even_page_header_footer.fo
73 # first-odd-even page, with headers and footers, no inline; just paragraphs
74 xsltproc --stringparam page-layout "first-odd-even" \
75 $STYLESHEET header_footer.xml > first_odd_even_page_header_footer.fo
76 xmlformat.pl -i first_odd_even_page_header_footer.fo
78 # first-odd-even page, with headers and footers, no inline; just paragraphs
79 # suppress first header and footer
80 xsltproc --stringparam page-layout "first-odd-even" \
81 --stringparam suppress-first-page-header "True" \
82 --stringparam suppress-first-page-footer "True" \
83 $STYLESHEET header_footer.xml > first_odd_even_page_header_footer_suppress_first.fo
84 xmlformat.pl -i first_odd_even_page_header_footer_suppress_first.fo
86 # TOC test
87 xsltproc $STYLESHEET toc.xml > toc.fo
88 xmlformat.pl -i toc.xml
90 # literal block test
91 xsltproc $STYLESHEET literal_block.xml > literal_block.fo
93 # inline test
94 xsltproc $STYLESHEET inline.xml > inline.fo
95 xmlformat.pl -i inline.xml
97 # transistion test
98 xsltproc $STYLESHEET transition.xml > transition.fo
99 xmlformat.pl -i transition.xml
101 # bullet list test
102 xsltproc $STYLESHEET bullet_list.xml > bullet_list.fo
103 xmlformat.pl -i bullet_list.xml
105 # enumerated list test
106 xsltproc $STYLESHEET enumerated_list.xml > enumerated_list.fo
107 xmlformat.pl -i enumerated_list.xml
109 # definition list test
110 xsltproc $STYLESHEET definition_list.xml > definition_list.fo
111 xmlformat.pl -i definition_list.xml
113 # Field List test
114 xsltproc $STYLESHEET field_lists.xml > field_lists.fo
115 xmlformat.pl -i field_lists.xml
117 # section test
118 xsltproc $STYLESHEET section.xml > section.fo
119 xmlformat.pl -i section.xml
121 # bibliograhic field test
122 xsltproc $STYLESHEET bibliographic_fields.xml > bibliographic_fields.fo
123 xmlformat.pl -i bibliographic_fields.xml
125 # bibliograhic fields with toc test
126 xsltproc $STYLESHEET bibliographic_fields_toc.xml > bibliographic_fields_toc.fo
127 xmlformat.pl -i bibliographic_fields_toc.xml
129 # test for options_list
130 xsltproc $STYLESHEET opt_list.xml > opt_list.fo
131 xmlformat.pl -i opt_list.fo
133 # test for options_list with definition layout
134 xsltproc --stringparam option-list-format "definition" \
135 $STYLESHEET opt_list.xml > opt_list_as_def.fo
136 xmlformat.pl -i opt_list_as_def.fo
138 # literal block
139 xsltproc $STYLESHEET literal_block.xml > literal_block.fo
142 xsltproc $STYLESHEET line_block.xml > line_block.fo
144 xsltproc $STYLESHEET block.xml > block.fo
145 xsltproc $STYLESHEET doctest_blocks.xml > doctest_blocks.fo
147 xsltproc $STYLESHEET table_csv.xml > table_csv.fo
149 # with param of title on toop
150 xsltproc --stringparam table-title-placement "top" \
151 $STYLESHEET table_csv.xml > table_caption_top_csv.fo
153 xsltproc $STYLESHEET table_grid.xml > table_grid.fo
154 xsltproc $STYLESHEET table_simple.xml > table_simple.fo
157 # regular footnotes
158 xsltproc $STYLESHEET footnotes.xml > footnotes.fo
160 xsltproc --stringparam footnote-style "traditional" \
161 $STYLESHEET footnotes.xml > footnotes_traditional.fo
163 xsltproc --stringparam footnote-placement "endnote" \
164 $STYLESHEET endnotes.xml > endnotes.fo
166 xsltproc $STYLESHEET citation.xml > citation.fo
168 xsltproc $STYLESHEET hyperlinks.xml > hyperlinks.fo
170 xsltproc --stringparam internal-link-type "page" \
171 $STYLESHEET hyperlinks.xml > hyperlinks_page.fo
173 xsltproc --stringparam internal-link-type "page-link" \
174 $STYLESHEET hyperlinks.xml > hyperlinks_link_page.fo
176 xsltproc $STYLESHEET admonition.xml > admonition.fo
178 xsltproc $STYLESHEET image.xml > image.fo
180 xsltproc $STYLESHEET figure.xml > image.fo
182 xsltproc $STYLESHEET sidebar.xml > sidebar.fo
183 xsltproc $STYLESHEET rubric.xml > rubric.fo
184 xsltproc $STYLESHEET epigraph.xml > epigraph.fo
185 xsltproc $STYLESHEET highlights.xml > highlights.fo
186 xsltproc $STYLESHEET pull_quote.xml > pull_quote.fo
187 xsltproc $STYLESHEET compound_paragraph.xml > compound_paragraph.fo
188 xsltproc $STYLESHEET topic.xml > topic.fo
189 xsltproc $STYLESHEET container.xml > container.fo
191 echo converting FO to PDF
192 FILES=`ls *\.fo`
194 # get the number of files
195 NUM_FILES=0
196 for THE_FILE in $FILES
198 let "NUM_FILES += 1"
199 done
202 FILES_DONE=1
203 for THE_FILE in $FILES
205 echo converting $THE_FILE to PDF File $FILES_DONE of $NUM_FILES
206 FILENAME=`basename $THE_FILE .fo`
207 NEW_FILE=${FILENAME}.pdf
208 fop -fo $THE_FILE -pdf $NEW_FILE
209 let "FILES_DONE += 1"
210 done