docgenerator 1.1.1 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. data/examples/docgenerator_example.rb +34 -17
  2. data/examples/docgenerator_example_footnote.rb +82 -61
  3. data/examples/docgenerator_example_list.rb +24 -18
  4. data/examples/docgenerator_example_restrictions.rb +17 -27
  5. data/examples/docgenerator_example_tabular.rb +20 -20
  6. data/examples/docgenerator_example_tripfalls.rb +28 -20
  7. data/examples/results/readme +1 -0
  8. data/examples/results_expected/docgenerator_example.html +39 -0
  9. data/examples/results_expected/docgenerator_example.pdf +0 -0
  10. data/examples/results_expected/docgenerator_example.tex +56 -0
  11. data/examples/results_expected/docgenerator_example_footnote.html +40 -0
  12. data/examples/results_expected/docgenerator_example_footnote.pdf +0 -0
  13. data/examples/results_expected/docgenerator_example_footnote.tex +50 -0
  14. data/examples/results_expected/docgenerator_example_list.html +18 -0
  15. data/examples/results_expected/docgenerator_example_list.pdf +0 -0
  16. data/examples/results_expected/docgenerator_example_list.tex +46 -0
  17. data/examples/results_expected/docgenerator_example_restrictions.html +22 -0
  18. data/examples/results_expected/docgenerator_example_restrictions.pdf +0 -0
  19. data/examples/results_expected/docgenerator_example_restrictions.tex +31 -0
  20. data/examples/results_expected/docgenerator_example_tabular.html +37 -0
  21. data/examples/results_expected/docgenerator_example_tabular.pdf +0 -0
  22. data/examples/results_expected/docgenerator_example_tabular.tex +41 -0
  23. data/examples/results_expected/docgenerator_example_tripfalls.html +27 -0
  24. data/examples/results_expected/docgenerator_example_tripfalls.pdf +0 -0
  25. data/examples/results_expected/docgenerator_example_tripfalls.tex +31 -0
  26. data/lib/creole/creole2doc.rb +291 -140
  27. data/lib/creole/creole_inclusion_and_plugins.rb +142 -39
  28. data/lib/creole/creole_placeholder.rb +92 -30
  29. data/lib/creole/creole_tabular.rb +119 -20
  30. data/lib/docgenerator.rb +209 -118
  31. data/lib/{docgenerator_attribute.rb → docgenerator/attribute.rb} +2 -1
  32. data/lib/{docgenerator_characters.rb → docgenerator/characters.rb} +75 -6
  33. data/lib/{docgenerator_css.rb → docgenerator/css.rb} +0 -0
  34. data/lib/docgenerator/document.rb +588 -0
  35. data/lib/{docgenerator_element.rb → docgenerator/element.rb} +52 -80
  36. data/lib/{docgenerator_elements.rb → docgenerator/elements.rb} +43 -17
  37. data/lib/{docgenerator_environments.rb → docgenerator/environments.rb} +20 -6
  38. data/lib/{docgenerator_footnote.rb → docgenerator/footnote.rb} +22 -18
  39. data/lib/{docgenerator_lists.rb → docgenerator/lists.rb} +17 -1
  40. data/lib/{docgenerator_sections.rb → docgenerator/sections.rb} +9 -1
  41. data/lib/docgenerator/standard.rb +81 -0
  42. data/lib/{docgenerator_tabular.rb → docgenerator/tabular.rb} +9 -5
  43. data/lib/packages/docgenerator_listings.rb +9 -5
  44. data/lib/packages/docgenerator_pdfpages.rb +17 -11
  45. data/lib/packages/docgenerator_url.rb +0 -2
  46. data/lib/templates/docgenerator_template.rb +66 -29
  47. data/lib/templates/docgenerator_template.yaml +18 -0
  48. data/lib/wiki2doc/wiki2docgenerator.rb +6 -2
  49. data/readme.rd +132 -0
  50. data/unittest/expected/test_document_usepackage_undefined.log +2 -0
  51. data/unittest/expected/test_enumerate.context +4 -0
  52. data/unittest/expected/test_footnote.html +4 -4
  53. data/unittest/expected/test_footnote.latex +4 -4
  54. data/unittest/expected/test_footnote_group.html +6 -6
  55. data/unittest/expected/test_footnote_group.latex +6 -6
  56. data/unittest/expected/test_href.html +2 -2
  57. data/unittest/expected/test_href.latex +2 -2
  58. data/unittest/expected/test_href.text +2 -2
  59. data/unittest/expected/test_itemize.context +4 -0
  60. data/unittest/expected/test_runtex.stdout +3 -0
  61. data/unittest/expected/test_runtex_2.stdout +3 -0
  62. data/unittest/expected/test_section.context +20 -0
  63. data/unittest/expected/test_tabular.html +2 -2
  64. data/unittest/expected/test_verbatim.html +3 -0
  65. data/unittest/expected/test_verbatim.latex +4 -0
  66. data/unittest/expected/test_verbatim_array.html +1 -0
  67. data/unittest/expected/test_verbatim_array.latex +2 -0
  68. data/unittest/expected_creole/test_creole_characters_all.html +12 -5
  69. data/unittest/expected_creole/test_creole_characters_all.latex +20 -6
  70. data/unittest/expected_creole/test_creole_comment.context +11 -0
  71. data/unittest/expected_creole/test_creole_comment.creole +12 -0
  72. data/unittest/expected_creole/test_creole_comment.html +9 -0
  73. data/unittest/expected_creole/test_creole_comment.latex +11 -0
  74. data/unittest/expected_creole/test_creole_creole1.0test.html +3 -3
  75. data/unittest/expected_creole/test_creole_creole1.0test.latex +3 -3
  76. data/unittest/expected_creole/test_creole_creole1.0test.text +4 -4
  77. data/unittest/expected_creole/test_creole_ignore.html +3 -0
  78. data/unittest/expected_creole/test_creole_ignore.latex +4 -0
  79. data/unittest/expected_creole/test_creole_ignore.text +2 -0
  80. data/unittest/expected_creole/test_creole_input.normsource +12 -12
  81. data/unittest/expected_creole/test_creole_input_file_simple.html +15 -0
  82. data/unittest/expected_creole/test_creole_input_file_simple_readlines.html +15 -0
  83. data/unittest/expected_creole/test_creole_links_external_implicit.html +2 -2
  84. data/unittest/expected_creole/test_creole_links_external_implicit.latex +2 -2
  85. data/unittest/expected_creole/test_creole_links_external_implicit.text +2 -2
  86. data/unittest/expected_creole/test_creole_links_implicit_end.creole +4 -0
  87. data/unittest/expected_creole/test_creole_links_implicit_end.html +3 -0
  88. data/unittest/expected_creole/test_creole_links_implicit_end.latex +4 -0
  89. data/unittest/expected_creole/test_creole_list_ul.normsource +42 -42
  90. data/unittest/expected_creole/test_creole_mix_titles_list.html +10 -0
  91. data/unittest/expected_creole/test_creole_mix_titles_list.latex +18 -0
  92. data/unittest/expected_creole/test_creole_mix_titles_list.text +12 -0
  93. data/unittest/expected_creole/test_creole_paragraphs.normsource +15 -15
  94. data/unittest/expected_creole/test_creole_pictures_css.html +4 -1
  95. data/unittest/expected_creole/test_creole_pictures_css.latex +5 -1
  96. data/unittest/expected_creole/test_creole_pictures_longdesc.html +3 -0
  97. data/unittest/expected_creole/test_creole_pictures_width.html +3 -0
  98. data/unittest/expected_creole/test_creole_pictures_width.latex +4 -0
  99. data/unittest/expected_creole/test_creole_short_html.html +3 -0
  100. data/unittest/expected_creole/test_creole_short_html.latex +4 -0
  101. data/unittest/expected_creole/test_creole_short_html.text +2 -0
  102. data/unittest/expected_creole/test_creole_shy.creole +6 -0
  103. data/unittest/expected_creole/test_creole_shy.html +6 -0
  104. data/unittest/expected_creole/test_creole_shy.latex +8 -0
  105. data/unittest/expected_creole/test_creole_shy.text +4 -0
  106. data/unittest/expected_creole/test_creole_tabular_with_cell_option.html +20 -0
  107. data/unittest/expected_creole/test_creole_toc.html +3 -1
  108. data/unittest/expected_creole/test_creole_toc.latex +1 -1
  109. data/unittest/expected_creole/test_creole_toc.text +1 -1
  110. data/unittest/expected_creole/test_creole_toc_level.html +7 -0
  111. data/unittest/expected_creole/test_creole_toc_level.latex +10 -0
  112. data/unittest/expected_creole/test_creole_toc_level.text +3 -0
  113. data/unittest/expected_creole/test_creole_toc_level_text.html +8 -0
  114. data/unittest/expected_creole/test_creole_toc_level_text.latex +9 -0
  115. data/unittest/expected_creole/test_creole_verbatim.html +1 -1
  116. data/unittest/expected_creole/test_creole_verbatim.latex +1 -1
  117. data/unittest/expected_creole/test_creole_verbatim.text +1 -1
  118. data/unittest/expected_creole/test_creole_verbatim_inline.html +1 -1
  119. data/unittest/expected_creole/test_creole_verbatim_inline.latex +1 -1
  120. data/unittest/expected_wiki/test_wiki_description.html +5 -5
  121. data/unittest/expected_wiki/test_wiki_description.latex +5 -5
  122. data/unittest/expected_wiki/test_wiki_description.text +5 -5
  123. data/unittest/expected_wiki/test_wiki_description.wiki +5 -5
  124. data/unittest/test_rakefile_docgenerator.rb +43 -0
  125. data/unittest/unittest_creole2doc.rb +415 -27
  126. data/unittest/unittest_docgenerator.rb +256 -23
  127. data/unittest/unittest_docgenerator_runtex.rb +83 -0
  128. data/unittest/unittest_versions.rb +44 -0
  129. data/unittest/unittest_wiki2doc.rb +28 -27
  130. metadata +473 -106
  131. data/lib/docgenerator_document.rb +0 -525
  132. data/lib/packages/docgenerator_beamer.rb +0 -253
  133. data/lib/yaml2presentation/yaml2presentation.rb +0 -1091
  134. data/unittest/expected/beamer_01_article.tex +0 -13
  135. data/unittest/expected/beamer_01_attachment.tex +0 -15
  136. data/unittest/expected/beamer_01_doc.html +0 -13
  137. data/unittest/expected/beamer_01_doc.tex +0 -18
  138. data/unittest/expected/beamer_01_notes_only.tex +0 -13
  139. data/unittest/expected/beamer_01_notes_onlyslideswithnotes.tex +0 -13
  140. data/unittest/expected/beamer_01_notes_show.tex +0 -13
  141. data/unittest/expected/beamer_01_presentation.tex +0 -13
  142. data/unittest/expected/beamer_02_doc.html +0 -29
  143. data/unittest/expected/beamer_02_doc.tex +0 -34
  144. data/unittest/expected/beamer_block.html +0 -1
  145. data/unittest/expected/beamer_block.latex +0 -1
  146. data/unittest/expected/beamer_doc_fragile_doc.tex +0 -33
  147. data/unittest/expected/beamer_doc_html_overview_with_detailpic_and_text_doc.html +0 -34
  148. data/unittest/expected/beamer_doc_html_overview_with_detailpic_doc.html +0 -34
  149. data/unittest/expected/beamer_doc_key_doc.html +0 -20
  150. data/unittest/expected/beamer_doc_key_doc.tex +0 -29
  151. data/unittest/expected/beamer_doc_note_doc.html +0 -30
  152. data/unittest/expected/beamer_doc_note_doc.tex +0 -37
  153. data/unittest/expected/beamer_doc_pic_bottom_doc.html +0 -24
  154. data/unittest/expected/beamer_doc_pic_doc.html +0 -24
  155. data/unittest/expected/beamer_doc_pic_doc.tex +0 -28
  156. data/unittest/expected/beamer_doc_pic_left_doc.html +0 -24
  157. data/unittest/expected/beamer_doc_pic_left_doc.tex +0 -28
  158. data/unittest/expected/beamer_doc_pic_ratio_doc.tex +0 -29
  159. data/unittest/expected/beamer_doc_pic_right_doc.html +0 -24
  160. data/unittest/expected/beamer_doc_pic_right_doc.tex +0 -28
  161. data/unittest/expected/beamer_doc_pic_top_doc.html +0 -24
  162. data/unittest/expected/beamer_frame.html +0 -5
  163. data/unittest/expected/beamer_frame.tex +0 -11
  164. data/unittest/expected/beamer_frame_fragile.tex +0 -7
  165. data/unittest/expected/beamer_frame_id.html +0 -1
  166. data/unittest/expected/beamer_frame_id.tex +0 -4
  167. data/unittest/expected/beamer_framepic.html +0 -5
  168. data/unittest/expected/beamer_framepic.latex +0 -1
  169. data/unittest/expected/beamer_framepic_link.html +0 -5
  170. data/unittest/expected/beamer_framepic_link.latex +0 -1
  171. data/unittest/expected/beamer_frametitle.html +0 -1
  172. data/unittest/expected/beamer_frametitle.latex +0 -1
  173. data/unittest/expected/beamer_note.html +0 -1
  174. data/unittest/expected/beamer_note.latex +0 -1
  175. data/unittest/expected_privat/test_creole_test_document.html +0 -6
  176. data/unittest/expected_wiki/test_wiki_amazon.html +0 -10
  177. data/unittest/expected_wiki/test_wiki_link.log +0 -3
  178. data/unittest/test_docgenerator.rb +0 -107
  179. data/unittest/unittest_yaml2pres.rb +0 -336
@@ -1,24 +0,0 @@
1
- <!--
2
- <<prefix>>
3
- -->
4
- <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
5
- <html>
6
- <head >
7
- <title>Presentation with picture</title>
8
- <meta name = "shorttitle" content = "Short title" />
9
- <meta name="author" content="Knut Lickert">
10
- <meta name="creation-date" content="2008-05-15">
11
- </head>
12
- <body >
13
- <div class = "frame" >
14
- <p class = "frametitle">Frame with picture</p>
15
-
16
- <div align = "center" >
17
- <img src = "test.jpg" />
18
- </div>
19
- <p >remark: With a picture
20
- </p>
21
- </div>
22
- <br clear = "all" />
23
- </body>
24
- </html>
@@ -1,28 +0,0 @@
1
- <<prefix>>
2
- % ----------------------------------------------------------------
3
- % For Usage with Beamer
4
- % ----------------------------------------------------------------
5
- \bgroup
6
- %BibTeX-Entry>
7
- %BibTeX-Entry<
8
- \egroup \subtitle{Subtitle}
9
- \title[Short title]{Presentation with picture}
10
- \hypersetup{pdftitle={Presentation with picture}}
11
- \author{Knut Lickert}\hypersetup{pdfauthor={Knut Lickert}}
12
- \date{2008-05-15}
13
-
14
- % ----------------------------------------------------------------
15
- \begin{document}
16
-
17
- \begin{frame}
18
- \frametitle{Frame with picture}
19
- \framePic{test.jpg}{
20
-
21
- remark: With a picture
22
-
23
-
24
- }
25
- \end{frame}
26
-
27
- \end{document}
28
- % ----------------------------------------------------------------
@@ -1,24 +0,0 @@
1
- <!--
2
- <<prefix>>
3
- -->
4
- <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
5
- <html>
6
- <head >
7
- <title>Title</title>
8
- <meta name = "shorttitle" content = "Short title" />
9
- <meta name="author" content="Knut Lickert">
10
- <meta name="creation-date" content="2008-05-15">
11
- </head>
12
- <body >
13
- <div class = "frame" >
14
- <p class = "frametitle">Title</p>
15
-
16
- <div style = "float: left;padding: 10px;" align = "center" >
17
- <img src = "test.jpg" />
18
- </div>
19
- <p >remark: With a picture
20
- </p>
21
- </div>
22
- <br clear = "all" />
23
- </body>
24
- </html>
@@ -1,28 +0,0 @@
1
- <<prefix>>
2
- % ----------------------------------------------------------------
3
- % For Usage with Beamer
4
- % ----------------------------------------------------------------
5
- \bgroup
6
- %BibTeX-Entry>
7
- %BibTeX-Entry<
8
- \egroup \subtitle{Subtitle}
9
- \title[Short title]{Title}
10
- \hypersetup{pdftitle={Title}}
11
- \author{Knut Lickert}\hypersetup{pdfauthor={Knut Lickert}}
12
- \date{2008-05-15}
13
-
14
- % ----------------------------------------------------------------
15
- \begin{document}
16
-
17
- \begin{frame}
18
- \frametitle{Title}
19
- \framePic{test.jpg}{
20
-
21
- remark: With a picture
22
-
23
-
24
- }
25
- \end{frame}
26
-
27
- \end{document}
28
- % ----------------------------------------------------------------
@@ -1,29 +0,0 @@
1
- <<prefix>>
2
- % ----------------------------------------------------------------
3
- % For Usage with Beamer
4
- % ----------------------------------------------------------------
5
- \bgroup
6
- %BibTeX-Entry>
7
- %BibTeX-Entry<
8
- \egroup \subtitle{Subtitle}
9
- \title[Short title]{Picture with different ratio}
10
- \hypersetup{pdftitle={Picture with different ratio}}
11
- \author{Knut Lickert}\hypersetup{pdfauthor={Knut Lickert}}
12
- \date{2008-05-15}
13
-
14
- % ----------------------------------------------------------------
15
- \begin{document}
16
-
17
- \begin{frame}
18
- \framepicratio{0.25}{0.5}
19
- \frametitle{Frame with different ratio}
20
- \framePic{test.jpg}{
21
-
22
- remark: Bildgr��e und Textgr��e im Verh�ltnis zur Textbreite.
23
-
24
-
25
- }
26
- \end{frame}
27
-
28
- \end{document}
29
- % ----------------------------------------------------------------
@@ -1,24 +0,0 @@
1
- <!--
2
- <<prefix>>
3
- -->
4
- <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
5
- <html>
6
- <head >
7
- <title>Title</title>
8
- <meta name = "shorttitle" content = "Short title" />
9
- <meta name="author" content="Knut Lickert">
10
- <meta name="creation-date" content="2008-05-15">
11
- </head>
12
- <body >
13
- <div class = "frame" >
14
- <p class = "frametitle">Title</p>
15
-
16
- <div style = "float: right;padding: 10px;" align = "center" >
17
- <img src = "test.jpg" />
18
- </div>
19
- <p >remark: With a picture
20
- </p>
21
- </div>
22
- <br clear = "all" />
23
- </body>
24
- </html>
@@ -1,28 +0,0 @@
1
- <<prefix>>
2
- % ----------------------------------------------------------------
3
- % For Usage with Beamer
4
- % ----------------------------------------------------------------
5
- \bgroup
6
- %BibTeX-Entry>
7
- %BibTeX-Entry<
8
- \egroup \subtitle{Subtitle}
9
- \title[Short title]{Title}
10
- \hypersetup{pdftitle={Title}}
11
- \author{Knut Lickert}\hypersetup{pdfauthor={Knut Lickert}}
12
- \date{2008-05-15}
13
-
14
- % ----------------------------------------------------------------
15
- \begin{document}
16
-
17
- \begin{frame}
18
- \frametitle{Title}
19
- \framePic[right]{test.jpg}{
20
-
21
- remark: With a picture
22
-
23
-
24
- }
25
- \end{frame}
26
-
27
- \end{document}
28
- % ----------------------------------------------------------------
@@ -1,24 +0,0 @@
1
- <!--
2
- <<prefix>>
3
- -->
4
- <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
5
- <html>
6
- <head >
7
- <title>Picture on top</title>
8
- <meta name = "shorttitle" content = "Short title" />
9
- <meta name="author" content="Knut Lickert">
10
- <meta name="creation-date" content="2008-05-15">
11
- </head>
12
- <body >
13
- <div class = "frame" >
14
- <p class = "frametitle">Picture on top</p>
15
-
16
- <div style = "float: none;" align = "center" >
17
- <img src = "test.jpg" />
18
- </div>
19
- <p >remark: Not for TeX
20
- </p>
21
- </div>
22
- <br clear = "all" />
23
- </body>
24
- </html>
@@ -1,5 +0,0 @@
1
- <div class = "frame" ><p class = "frametitle">Titel</p><ul >
2
- <li >top 1</li>
3
- <li >top 2</li>
4
- </ul>
5
- </div>
@@ -1,11 +0,0 @@
1
- \begin{frame}
2
- \frametitle{Titel}
3
- \begin{itemize}
4
-
5
- \item top 1
6
-
7
- \item top 2
8
- \end{itemize}
9
-
10
-
11
- \end{frame}
@@ -1,7 +0,0 @@
1
- \begin{frame}[fragile]
2
- \frametitle{Titel}
3
- \begin{verbatim}
4
- Verbatim requires a fragile flag
5
- \end{verbatim}
6
-
7
- \end{frame}
@@ -1 +0,0 @@
1
- <div id = "frame-id" class = "frame" >content</div>
@@ -1,4 +0,0 @@
1
- \begin{frame}
2
- \label{frame-id}\hypertarget{frame-id}{}
3
- content
4
- \end{frame}
@@ -1,5 +0,0 @@
1
-
2
- <div align = "center" >
3
- <img src = "test.jpg" />
4
- </div>
5
- description
@@ -1 +0,0 @@
1
- \framePic{test.jpg}{description}
@@ -1,5 +0,0 @@
1
-
2
- <div align = "center" >
3
- <img src = "test.jpg" />
4
- </div>
5
- description
@@ -1 +0,0 @@
1
- \framePic{test.jpg}[linktopic]{description}
@@ -1 +0,0 @@
1
- <p class = "frametitle">Title</p>
@@ -1 +0,0 @@
1
- \frametitle{Title}
@@ -1 +0,0 @@
1
- <p class = "note">Notiz</p>
@@ -1 +0,0 @@
1
- \note{Notiz}
@@ -1,6 +0,0 @@
1
- <p >
2
-
3
- <iframe src = "http://rcm-de.amazon.de/e/cm?t=3499138956&o=3&p=8&l=as1&asins=3499138956&fc1=000000&IS2=1&lt1=_blank&lc1=0000ff&bc1=000000&bg1=ffffff&f=ifr" marginwidth = "0" marginheight = "0" frameborder = "0" scrolling = "no" style = "height: 240px;width: 120px;" >
4
- Ihr Browser kann leider keine eingebetteten Frames anzeigen. Sie k&ouml;nnen die eingebettete Seite &uuml;ber den folgenden Verweis aufrufen: <a href = "http://www.amazon.de/exec/obidos/ASIN/3499138956/3499138956" >Amazon</a>
5
- </iframe>
6
- </p>
@@ -1,10 +0,0 @@
1
- <p >
2
- <iframe src = "http://rcm-de.amazon.de/e/cm?t=lickertnet-21&o=3&p=8&l=as1&asins=B000AFEJAM&fc1=000000&IS2=1&lt1=_blank&lc1=0000ff&bc1=000000&bg1=ffffff&f=ifr" marginwidth = "0" marginheight = "0" frameborder = "0" scrolling = "no" style = "height: 240px;width: 120px;" >
3
- Ihr Browser kann leider keine eingebetteten Frames anzeigen. Sie k&ouml;nnen die eingebettete Seite &uuml;ber den folgenden Verweis aufrufen: <a href = "http://www.amazon.de/exec/obidos/ASIN/B000AFEJAM/lickertnet-21" >Amazon</a>
4
- </iframe>
5
- </p>
6
- <p >
7
- <iframe src = "http://rcm-de.amazon.de/e/cm?t=lickertnet-21&o=3&p=8&l=as1&asins=B000AFEJAM&fc1=000000&IS2=1&lt1=_blank&lc1=0000ff&bc1=000000&bg1=ffffff&f=ifr" marginwidth = "0" marginheight = "0" frameborder = "0" scrolling = "no" style = "float: right;height: 240px;width: 120px;" >
8
- Ihr Browser kann leider keine eingebetteten Frames anzeigen. Sie k&ouml;nnen die eingebettete Seite &uuml;ber den folgenden Verweis aufrufen: <a href = "http://www.amazon.de/exec/obidos/ASIN/B000AFEJAM/lickertnet-21" >Amazon</a>
9
- </iframe>
10
- </p>
@@ -1,3 +0,0 @@
1
- WARN Wikitext: Link to unexisting local file ././unexisting_file.xx (from C:/usr/Script/DocumentGenerator/unittest)
2
- WARN Wikitext: Link to unexisting local file ././unexisting_file.xx (from C:/usr/Script/DocumentGenerator/unittest)
3
- WARN Wikitext: Link to unexisting local file ././unexisting_file.xx (from C:/usr/Script/DocumentGenerator/unittest)
@@ -1,107 +0,0 @@
1
- require 'test/unit'
2
- require 'tempfile' #needed to get logger.data
3
-
4
- $: << '../lib'
5
- require 'docgenerator'
6
- puts "==> Version #{DOCGENERATOR_VERSION}"
7
-
8
- $fixmes = []
9
- #
10
- # Mag nicht
11
- #
12
- #~ END{
13
- #~ puts 'Fixmes:'
14
- #~ puts $fixmes.join("\n")
15
- #~ }
16
-
17
- #
18
- #Two methods to catch and check logger content.
19
- module Temp_Logger
20
- #Redirect Logger data to temporary file
21
- def set_temporary_logger( level = Log4r::WARN )
22
- templogfile = Tempfile.new("xxx_warn.log")
23
- @loglevel = DOCGENERATOR_LOGGER.level
24
- @outputter = DOCGENERATOR_LOGGER.outputters.first
25
- DOCGENERATOR_LOGGER.level = level
26
- DOCGENERATOR_LOGGER.outputters = Log4r::IOOutputter.new('log_xxx', templogfile )
27
- return templogfile
28
- end
29
- #Get temporary data and reset logger.
30
- def get_temporary_logger(templogfile)
31
- templogfile.close()
32
- templogfile.open()
33
- templogfile_content = templogfile.readlines.to_s
34
- templogfile.close(true)
35
- DOCGENERATOR_LOGGER.level = @loglevel
36
- DOCGENERATOR_LOGGER.outputters = @outputter
37
- return templogfile_content
38
- end
39
- end
40
-
41
- require 'ftools'
42
- class Test::Unit::TestCase
43
- #
44
- #Takes the content of the file 'filename' and compares it with 'actual' like in assert_equal.
45
- #If 'filname' doesn't exist, the failure
46
- # Reference file <#{filename}> missing
47
- #is returned.
48
- #
49
- #'folder_for_failure' will contain all results with differences.
50
- #
51
- #What will happen:
52
- #1) text.to_doc(:html) is the test. It creates some HTML-Text
53
- #2) "expected/test_section.html" is read and compared to text.to_doc(:html)
54
- #2a) If the file is missing -> error
55
- #2b) If it is the same -> fine
56
- #2c) If there are differences:
57
- #3) A message is given (like in assert_equal)
58
- #4) A folder "failure#{Date.today}" is created if not already exist
59
- #5) The file 'test_section.html' with the result is created in "failure#{Date.today}/"
60
- #6) I can use a compare tool to compare the expected result and the real result.
61
- #
62
- #Recommendation to build up your test.
63
- #1) Create two folders: 'expected' and 'failure'
64
- #2) Define your assertion with a non-existing filename
65
- #3) Run the test with folder_for_failure = 'failure'
66
- #4) You will get a failure (reference file is missing).
67
- #5) Copy the file in 'failure' to 'expected'
68
- #6) Rerun again, you have no failure (hopefully ;-) )
69
- def assert_equal_filecontent( filename, actual, folder_for_failure = "failure#{Date.today}", message = nil )
70
- if File.exist?(filename)
71
- expected = File.read(filename)
72
- full_message = build_message(message, "<?> expected (#{filename}) but was\n<?>.\n", expected, actual)
73
- else
74
- full_message = "Reference file <#{filename}> missing"
75
- end
76
- #Write the real result to a file.
77
- #Folder is defined with Test::Unit::TestCase#folder_for_failure
78
- if folder_for_failure and expected != actual
79
- File.makedirs(folder_for_failure) if ! File.directory?(folder_for_failure)
80
- File.open( "#{folder_for_failure}/#{File.basename(filename)}", 'w'){|f|
81
- f << actual
82
- }
83
- end
84
- assert_block( full_message ){ expected == actual }
85
- end
86
- #
87
- end
88
-
89
- #~ #
90
- #~ # Little helper. assert_equal with another order of data.
91
- #~ # Reason: The here-documents must be the last parameter in a method call.
92
- #~ #
93
- #~ def assert_equal_reverse( code, expectedresult )
94
- #~ assert_equal( expectedresult, code )
95
- #~ end
96
- #~ # Little helper. assert_equal with another order of data.
97
- #~ # Reason: The here-documents must be the last parameter in a method call.
98
- #~ #
99
- #~ def assert_equal_reverse_chomp( code, expectedresult )
100
- #~ assert_equal( expectedresult.chomp, code )
101
- #~ end
102
-
103
-
104
- if $0 == __FILE__
105
- #~ require 'unittest_docgenerator.rb'
106
- #~ require 'unittest_wiki2doc.rb'
107
- end
@@ -1,336 +0,0 @@
1
- require 'test_docgenerator.rb'
2
-
3
- #~ $: << 'C:/usr/Script/DocumentGenerator/yaml2presentation'
4
- #~ $: << 'C:/usr/Script/DocumentGenerator/lib/packages' #for docgenerator_beamer.rb
5
- require '../lib/yaml2presentation/yaml2presentation.rb'
6
- #~ require 'yaml2presentation/yaml2presentation'
7
-
8
- Element.log = true
9
- $log = Log4r::Logger.new( 'test yaml2pres', Log4r::WARN )
10
- $log.outputters = Log4r::StdoutOutputter.new('test yaml2pres')
11
- $log.level = Log4r::INFO
12
- $log.info("Remark: Known errors/problems and missing checks are logged.")
13
- #~ DOCGENERATOR_LOGGER.level = Log4r::DEBUG
14
- #~ DOCGENERATOR_LOGGER.level = Log4r::INFO
15
- #~ DOCGENERATOR_LOGGER.level = Log4r::WARN
16
- #~ DOCGENERATOR_LOGGER.level = Log4r::ERROR
17
-
18
- #~ include Log4r
19
-
20
- class TestBeamer < Test::Unit::TestCase
21
- def test_beamer_frametitle()
22
- text = element(:frametitle,{}, 'Title').cr
23
- assert_equal_filecontent( "expected/beamer_frametitle.html", text.to_doc(:html))
24
- assert_equal_filecontent( "expected/beamer_frametitle.latex", text.to_doc(:latex))
25
- end
26
- def test_beamer_note()
27
- text = element(:note,{}, 'Notiz').cr
28
- assert_equal_filecontent( "expected/beamer_note.html", text.to_doc(:html))
29
- assert_equal_filecontent( "expected/beamer_note.latex", text.to_doc(:latex))
30
- end
31
- def test_beamer_block()
32
- text = element(:block,{}, 'Block').cr
33
- assert_equal_filecontent( "expected/beamer_block.html", text.to_doc(:html))
34
- assert_equal_filecontent( "expected/beamer_block.latex", text.to_doc(:latex))
35
- end
36
- def test_beamer_framepic()
37
- text = element(:framepic,{ :file => 'test.jpg'}, 'description').cr
38
- assert_equal_filecontent( "expected/beamer_framepic.html", text.to_doc(:html))
39
- assert_equal_filecontent( "expected/beamer_framepic.latex", text.to_doc(:latex))
40
-
41
- text = element(:framepic,{ :file => 'test.jpg', :link => 'linktopic'}, 'description').cr
42
- assert_equal_filecontent( "expected/beamer_framepic_link.html", text.to_doc(:html))
43
- assert_equal_filecontent( "expected/beamer_framepic_link.latex", text.to_doc(:latex))
44
-
45
- # ...css-eigenschaften. umbau in Attribute?
46
- end
47
- end #TestBeamer
48
-
49
- class TestFrame < Test::Unit::TestCase
50
- def test_frame()
51
- frame = Frame.new()
52
- frame << element(:frametitle,{}, 'Titel')
53
- frame << element(:ul,{}, [
54
- element(:li,{}, 'top 1' ).cr,
55
- element(:li,{}, 'top 2' ).cr,
56
- ]).cR
57
- assert_equal_filecontent( "expected/beamer_frame.tex", frame.to_latex())
58
- assert_equal_filecontent( "expected/beamer_frame.html", frame.to_html())
59
- end
60
- def test_frame_fragile()
61
- frame = Frame.new()
62
- frame.fragile = true
63
- frame << element(:frametitle,{}, 'Titel')
64
- frame << element(:verbatim,{}, <<-txt
65
-
66
- Verbatim requires a fragile flag
67
- txt
68
- )
69
- assert_equal_filecontent( "expected/beamer_frame_fragile.tex", frame.to_latex())
70
- #~ assert_equal_filecontent( "expected/beamer_frame_fragile.html", frame.to_html())
71
- end
72
- def test_frame_id()
73
- frame = Frame.new(:id => 'frame-id' )
74
- frame << 'content'
75
- assert_equal_filecontent( "expected/beamer_frame_id.tex", frame.to_latex())
76
- assert_equal_filecontent( "expected/beamer_frame_id.html", frame.to_html())
77
- end
78
- def test_frame_pic()
79
- $log.warn("Line #{__LINE__}: Missing test for Frame like test_beamer_pic()")
80
- end
81
- def test_frame_pic_pos()
82
- $log.warn("Line #{__LINE__}: Missing test for Frame like test_beamer_pic_pos()")
83
- end
84
- def test_frame_pic_ratio()
85
- $log.warn("Line #{__LINE__}: Missing test for Frame like test_beamer_pic_ratio()")
86
- end
87
- end #TestFrame
88
-
89
- class DocumentTest < Test::Unit::TestCase
90
- #Always used settings.
91
- def settings()
92
- settings = {
93
- :template => :beamerthemetree,
94
- :shorttitle => 'Short title',
95
- :subtitle => 'Subtitle',
96
- :author => 'Knut Lickert',
97
- :language => [ 'ngerman' ],
98
- # :classoption => ['bib'],
99
- :date => '2008-05-15'
100
- }
101
- end
102
- TESTDOCUMENTS = [:tex, :html, :presentation, :article, :notes , :attachment ]
103
- #Get a presenation and create all document variants.
104
- #Parameter what defines, what should be tested
105
- #complete list in TESTDOCUMENTS
106
- def my_beamer_doc_tests(testcasename, pres, settings, what )
107
- assert_equal( :beamerthemetree, pres.settings[:template])
108
-
109
- assert_equal_filecontent( "expected/#{testcasename}_doc.tex",
110
- pres.build_document(settings).to_latex({
111
- :filename => "#{testcasename}_doc.tex",
112
- :log => pres.log,
113
- :template => DocumentTemplate[:beamer],
114
- })) if what.include?(:tex)
115
- assert_equal_filecontent( "expected/#{testcasename}_doc.html",
116
- pres.build_document(settings).to_html({
117
- :filename => "#{testcasename}_doc.html",
118
- :log => pres.log,
119
- :template => DocumentTemplate[:html],
120
- })) if what.include?(:html)
121
- assert_equal_filecontent( "expected/#{testcasename}_presentation.tex",
122
- pres.build_presentation("#{testcasename}_presentation.tex", settings).to_latex({
123
- :filename => "#{testcasename}_presentation.tex",
124
- :log => pres.log,
125
- :template => DocumentTemplate[pres.settings[:template]],
126
- })) if what.include?(:presentation )
127
- assert_equal_filecontent( "expected/#{testcasename}_article.tex",
128
- pres.build_article("#{testcasename}_article.tex", settings).to_latex({
129
- :filename => "#{testcasename}_article.tex",
130
- :log => pres.log,
131
- :template => DocumentTemplate[:beamerarticle],
132
- })) if what.include?(:article )
133
- if what.include?(:notes )
134
- ["show", "only", "onlyslideswithnotes"].each{|notes_variant|
135
- assert_equal_filecontent( "expected/#{testcasename}_notes_#{notes_variant}.tex",
136
- pres.build_notes("#{testcasename}.tex",
137
- { :beamer_notes => notes_variant}.update(settings)
138
- ).to_latex({
139
- :filename => "#{testcasename}.tex",
140
- :log => pres.log,
141
- :template => DocumentTemplate[pres.settings[:template]],
142
- }))
143
- }
144
- end #what.include?(:notes )
145
- assert_equal_filecontent( "expected/#{testcasename}_attachment.tex",
146
- pres.build_attachment_doc(settings).to_latex({
147
- :filename => "#{testcasename}_attachment.tex",
148
- :log => pres.log,
149
- :template => DocumentTemplate[:include],
150
- })) if what.include?(:attachment )
151
- end #my_beamer_doc_tests
152
- #Check empty presentation
153
- def test_beamer_empty_doc()
154
- pres = Presentation.new( 'Title', settings )
155
- my_beamer_doc_tests('beamer_01', pres, settings, TESTDOCUMENTS )
156
- end
157
- #Check sections and one frame
158
- def test_beamer_doc()
159
- pres = Presentation.new( 'Title', settings )
160
- pres << <<yaml
161
- -
162
- section: Sectiontitle
163
- subsection: Subectiontitle
164
- title: Title
165
- wiki: |
166
- *Top 1
167
- *Top 2
168
- yaml
169
- my_beamer_doc_tests('beamer_02', pres, settings, [:tex, :html ] )
170
- end
171
- def test_beamer_fragile()
172
- pres = Presentation.new( 'Title', settings )
173
- pres << <<yaml
174
- -
175
- title: Title
176
- fragile: true
177
- wiki: |
178
- remark:
179
- Verbatim require fragile flag
180
- yaml
181
- my_beamer_doc_tests('beamer_doc_fragile', pres, settings, [:tex ] )
182
- end
183
- def test_beamer_pic()
184
- pres = Presentation.new( 'Presentation with picture', settings )
185
- pres << <<yaml
186
- -
187
- title: Frame with picture
188
- pic: test.jpg
189
- wiki: |
190
- remark: With a picture
191
- yaml
192
- my_beamer_doc_tests('beamer_doc_pic', pres, settings, [:tex, :html ] )
193
-
194
- #~ *pic: Bildadresse
195
- #~ *pic*: Bild mit Link zu Bild in Fullpage am Dokumentende
196
- #~ *PIC: Bild in Fullpage
197
- #~ *thumb: Vorlage f�r ''pic*'' (sinnvoll f�r HTML)
198
- $log.warn("Line #{__LINE__}: Missing test for picture variants")
199
- end
200
-
201
- def test_beamer_pic_pos()
202
- pres = Presentation.new( 'Title', settings )
203
- pres << <<yaml
204
- -
205
- title: Title
206
- pic: test.jpg
207
- pos: right
208
- wiki: |
209
- remark: With a picture
210
- yaml
211
- my_beamer_doc_tests('beamer_doc_pic_right', pres, settings, [:tex, :html ] )
212
-
213
- pres = Presentation.new( 'Title', settings )
214
- pres << <<yaml
215
- -
216
- title: Title
217
- pic: test.jpg
218
- pos: left
219
- wiki: |
220
- remark: With a picture
221
- yaml
222
- my_beamer_doc_tests('beamer_doc_pic_left', pres, settings, [:tex, :html ] )
223
-
224
- pres = Presentation.new( 'Picture on top', settings )
225
- pres << <<yaml
226
- -
227
- title: Picture on top
228
- pic: test.jpg
229
- pos: top
230
- wiki: |
231
- remark: Not for TeX
232
- yaml
233
- my_beamer_doc_tests('beamer_doc_pic_top', pres, settings, [:html ] )
234
-
235
- pres = Presentation.new( 'Picture at bottom', settings )
236
- pres << <<yaml
237
- -
238
- title: Picture at bottom
239
- pic: test.jpg
240
- pos: bottom
241
- wiki: |
242
- remark: Not for TeX
243
- yaml
244
- $log.error("Line #{__LINE__}: picture at bottom")
245
- my_beamer_doc_tests('beamer_doc_pic_bottom', pres, settings, [:html ] )
246
- end
247
- def test_beamer_key()
248
- #~ *key: Optional, f�r label/Link genutzt
249
- pres = Presentation.new( 'Title', settings )
250
- pres << <<yaml
251
- -
252
- title: Title
253
- key: key
254
- wiki: |
255
- remark: Ids can be defined
256
- yaml
257
- my_beamer_doc_tests('beamer_doc_key', pres, settings, [:tex, :html ] )
258
- end
259
- def test_beamer_pic_options()
260
- #~ href: http://...
261
- #~ picwidth: 12px
262
- #~ alignment: t
263
- #~ html_class: xx
264
- #~ img_class: xx
265
- $log.warn("Line #{__LINE__}: Pic-options")
266
- #~ my_beamer_doc_tests('beamer_doc_pic_options', pres, settings, [:tex, :html ] )
267
- end
268
- def test_beamer_pic_ratio()
269
- pres = Presentation.new( 'Picture with different ratio', settings )
270
- pres << <<yaml
271
- -
272
- title: Frame with different ratio
273
- pic: test.jpg
274
- framepicratio: 0.25;0.5
275
- wiki: |
276
- remark: Bildgr��e und Textgr��e im Verh�ltnis zur Textbreite.
277
- yaml
278
- my_beamer_doc_tests('beamer_doc_pic_ratio', pres, settings, [:tex ] )
279
- end
280
- def test_beamer_notes()
281
- pres = Presentation.new( 'Title', settings )
282
- pres << <<yaml
283
- -
284
- title: Title
285
- wiki: |
286
- remark: You can make notes
287
- notes: |
288
- *This is a note
289
- *Notes are wiki-enabled
290
- yaml
291
- my_beamer_doc_tests('beamer_doc_note', pres, settings, [:tex, :html ] )
292
- $log.warn("Line #{__LINE__}: Missing test notes with splitscreen right/bottom")
293
- end
294
- def test_beamer_html()
295
- pres = Presentation.new( 'Title', settings )
296
- pres << <<yaml
297
- -
298
- title: Title
299
- pic: test.png
300
- wiki: |
301
- remark: You can make notes
302
- notes: |
303
- *This is a note
304
- *Notes are wiki-enabled
305
- yaml
306
-
307
- $log.warn("Line #{__LINE__}: Missing test html-variants")
308
- #~ my_beamer_doc_tests('beamer_doc_html', pres, settings, [:html ] )
309
- #~ #Overview contains the title and a link to the detail page
310
- #~ my_beamer_doc_tests('beamer_doc_html_overview_with_singlepages', pres, {:html => :overview_with_singlepages}.update(settings), [:html ] )
311
- my_beamer_doc_tests('beamer_doc_html_overview_with_detailpic', pres, {:html => :with_detailpic}.update(settings), [:html ] )
312
- my_beamer_doc_tests('beamer_doc_html_overview_with_detailpic_and_text', pres, {:html => :with_detailpic_and_text}.update(settings), [:html ] )
313
- end
314
-
315
-
316
-
317
- end
318
-
319
- __END__
320
- subsection: Weitere Optionen
321
- title: Option Restrict
322
- wiki: |
323
- Werte f�r restrict
324
- *:latex
325
- *:html
326
- Ausgabe auf ein Format begrenzen.
327
- -
328
- title: Option pdftk
329
- wiki: |
330
- Mit der Option ''pdftk'' wird mittels pdftk eine zweite
331
- Screen-Version erzeugt.
332
-
333
- Optionen:
334
- *owner\_pw
335
- *user\_pw
336
- *allow: Ausnahmen f�r Verbote, wenn Passwort gesetzt.