docgenerator-creole 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/examples/creole_example.rb +76 -0
- data/examples/creole_example_footnote.rb +66 -0
- data/examples/creole_example_new_plugin.rb +51 -0
- data/examples/creole_example_placeholder.rb +77 -0
- data/examples/creole_example_rail.rb +155 -0
- data/examples/creole_example_rubycode.rb +144 -0
- data/examples/creole_example_struktex.rb +170 -0
- data/examples/creole_example_tabular.rb +96 -0
- data/examples/creole_example_tikz.rb +47 -0
- data/lib/docgenerator-creole.rb +5 -0
- data/lib/docgenerator/creole.rb +15 -0
- data/lib/docgenerator/creole/base.rb +170 -0
- data/lib/docgenerator/creole/characters.rb +131 -0
- data/lib/docgenerator/creole/creole.rb +708 -0
- data/lib/docgenerator/creole/document.rb +91 -0
- data/lib/docgenerator/creole/inclusion_and_plugins.rb +91 -0
- data/lib/docgenerator/creole/inclusions.rb +148 -0
- data/lib/docgenerator/creole/placeholder.rb +242 -0
- data/lib/docgenerator/creole/plugins.rb +230 -0
- data/lib/docgenerator/creole/plugins/index.rb +61 -0
- data/lib/docgenerator/creole/plugins/rail.rb +179 -0
- data/lib/docgenerator/creole/plugins/rubycode4creole.rb +136 -0
- data/lib/docgenerator/creole/plugins/struktex.rb +60 -0
- data/lib/docgenerator/creole/plugins/tikz.rb +93 -0
- data/lib/docgenerator/creole/plugins/todonotes.rb +77 -0
- data/lib/docgenerator/creole/tabular.rb +405 -0
- data/readme.rdoc +44 -0
- data/unittest/Red_Flower.jpg +0 -0
- data/unittest/expected_creole/test_creole.html +3 -0
- data/unittest/expected_creole/test_creole_characters_all.creole +28 -0
- data/unittest/expected_creole/test_creole_characters_all.html +18 -0
- data/unittest/expected_creole/test_creole_characters_all.latex +36 -0
- data/unittest/expected_creole/test_creole_characters_special.html +10 -0
- data/unittest/expected_creole/test_creole_characters_special.latex +18 -0
- data/unittest/expected_creole/test_creole_comment.context +11 -0
- data/unittest/expected_creole/test_creole_comment.creole +12 -0
- data/unittest/expected_creole/test_creole_comment.html +9 -0
- data/unittest/expected_creole/test_creole_comment.latex +11 -0
- data/unittest/expected_creole/test_creole_countdown.html +3 -0
- data/unittest/expected_creole/test_creole_countdown.latex +4 -0
- data/unittest/expected_creole/test_creole_creole1.0test.html +182 -0
- data/unittest/expected_creole/test_creole_creole1.0test.latex +253 -0
- data/unittest/expected_creole/test_creole_creole1.0test.text +160 -0
- data/unittest/expected_creole/test_creole_footnotes.html +9 -0
- data/unittest/expected_creole/test_creole_footnotes.latex +14 -0
- data/unittest/expected_creole/test_creole_footnotes_groupid.html +15 -0
- data/unittest/expected_creole/test_creole_footnotes_label.html +9 -0
- data/unittest/expected_creole/test_creole_headings.html +17 -0
- data/unittest/expected_creole/test_creole_headings.latex +19 -0
- data/unittest/expected_creole/test_creole_headings.text +48 -0
- data/unittest/expected_creole/test_creole_headings.wiki +37 -0
- data/unittest/expected_creole/test_creole_hr.html +7 -0
- data/unittest/expected_creole/test_creole_hr.latex +9 -0
- data/unittest/expected_creole/test_creole_hr.text +4 -0
- data/unittest/expected_creole/test_creole_ignore.html +3 -0
- data/unittest/expected_creole/test_creole_ignore.latex +4 -0
- data/unittest/expected_creole/test_creole_ignore.text +2 -0
- data/unittest/expected_creole/test_creole_inline.html +3 -0
- data/unittest/expected_creole/test_creole_inline.latex +4 -0
- data/unittest/expected_creole/test_creole_inline.text +2 -0
- data/unittest/expected_creole/test_creole_inline_apostroph.html +7 -0
- data/unittest/expected_creole/test_creole_inline_apostroph.latex +9 -0
- data/unittest/expected_creole/test_creole_inline_apostroph.text +5 -0
- data/unittest/expected_creole/test_creole_inline_ruby.html +12 -0
- data/unittest/expected_creole/test_creole_inline_ruby.latex +20 -0
- data/unittest/expected_creole/test_creole_inline_ruby_raw.html +6 -0
- data/unittest/expected_creole/test_creole_inline_ruby_raw.latex +8 -0
- data/unittest/expected_creole/test_creole_input.normsource +22 -0
- data/unittest/expected_creole/test_creole_input.normsource_1.8 +23 -0
- data/unittest/expected_creole/test_creole_input_file_simple.html +15 -0
- data/unittest/expected_creole/test_creole_input_file_simple_readlines.html +15 -0
- data/unittest/expected_creole/test_creole_label.html +12 -0
- data/unittest/expected_creole/test_creole_label.latex +15 -0
- data/unittest/expected_creole/test_creole_line_break.html +6 -0
- data/unittest/expected_creole/test_creole_line_break.latex +8 -0
- data/unittest/expected_creole/test_creole_links_explicit_internal.html +6 -0
- data/unittest/expected_creole/test_creole_links_explicit_internal.text +4 -0
- data/unittest/expected_creole/test_creole_links_explicit_with_em.html +3 -0
- data/unittest/expected_creole/test_creole_links_explicit_with_em.latex +4 -0
- data/unittest/expected_creole/test_creole_links_explicit_with_em.text +2 -0
- data/unittest/expected_creole/test_creole_links_external.html +6 -0
- data/unittest/expected_creole/test_creole_links_external.latex +8 -0
- data/unittest/expected_creole/test_creole_links_external.text +4 -0
- data/unittest/expected_creole/test_creole_links_external_implicit.html +9 -0
- data/unittest/expected_creole/test_creole_links_external_implicit.latex +12 -0
- data/unittest/expected_creole/test_creole_links_external_implicit.text +6 -0
- data/unittest/expected_creole/test_creole_links_file.html +6 -0
- data/unittest/expected_creole/test_creole_links_file.latex +8 -0
- data/unittest/expected_creole/test_creole_links_file.text +4 -0
- data/unittest/expected_creole/test_creole_links_implicit_end.creole +4 -0
- data/unittest/expected_creole/test_creole_links_implicit_end.html +3 -0
- data/unittest/expected_creole/test_creole_links_implicit_end.latex +4 -0
- data/unittest/expected_creole/test_creole_list_ol.html +12 -0
- data/unittest/expected_creole/test_creole_list_ol.latex +22 -0
- data/unittest/expected_creole/test_creole_list_ol_after_ul.html +12 -0
- data/unittest/expected_creole/test_creole_list_ol_after_ul.latex +20 -0
- data/unittest/expected_creole/test_creole_list_ol_after_ul.text +6 -0
- data/unittest/expected_creole/test_creole_list_ol_ul.html +15 -0
- data/unittest/expected_creole/test_creole_list_ol_ul.latex +26 -0
- data/unittest/expected_creole/test_creole_list_ul.html +22 -0
- data/unittest/expected_creole/test_creole_list_ul.latex +40 -0
- data/unittest/expected_creole/test_creole_list_ul.normsource +85 -0
- data/unittest/expected_creole/test_creole_list_ul.normsource_1.8 +83 -0
- data/unittest/expected_creole/test_creole_list_ul_too_much.html +24 -0
- data/unittest/expected_creole/test_creole_list_ul_too_much.latex +44 -0
- data/unittest/expected_creole/test_creole_list_ulul_without_ul.html +6 -0
- data/unittest/expected_creole/test_creole_list_ulul_without_ul.latex +12 -0
- data/unittest/expected_creole/test_creole_mix_titles_list.html +10 -0
- data/unittest/expected_creole/test_creole_mix_titles_list.latex +18 -0
- data/unittest/expected_creole/test_creole_mix_titles_list.text +12 -0
- data/unittest/expected_creole/test_creole_newline.html +9 -0
- data/unittest/expected_creole/test_creole_newline.latex +11 -0
- data/unittest/expected_creole/test_creole_newline.text +7 -0
- data/unittest/expected_creole/test_creole_paragraphs.html +6 -0
- data/unittest/expected_creole/test_creole_paragraphs.latex +8 -0
- data/unittest/expected_creole/test_creole_paragraphs.normsource +26 -0
- data/unittest/expected_creole/test_creole_paragraphs.normsource_1.8 +27 -0
- data/unittest/expected_creole/test_creole_paragraphs.text +4 -0
- data/unittest/expected_creole/test_creole_paragraphs.wiki +4 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap.html +5 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap.latex +6 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap.text +4 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap.wiki +4 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap0.html +9 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap0.latex +11 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap0.text +7 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap0.wiki +7 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap60.html +5 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap60.latex +6 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap60.text +4 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap60.wiki +4 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap_with_linebreaks.html +5 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap_with_linebreaks.latex +6 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap_with_linebreaks.text +4 -0
- data/unittest/expected_creole/test_creole_paragraphs_wrap_with_linebreaks.wiki +4 -0
- data/unittest/expected_creole/test_creole_picture_link.html +6 -0
- data/unittest/expected_creole/test_creole_pictures.html +10 -0
- data/unittest/expected_creole/test_creole_pictures.latex +13 -0
- data/unittest/expected_creole/test_creole_pictures_css.html +6 -0
- data/unittest/expected_creole/test_creole_pictures_css.latex +8 -0
- data/unittest/expected_creole/test_creole_pictures_imgclass.html +6 -0
- data/unittest/expected_creole/test_creole_pictures_imgclass.latex +8 -0
- data/unittest/expected_creole/test_creole_pictures_longdesc.html +3 -0
- data/unittest/expected_creole/test_creole_pictures_width.html +3 -0
- data/unittest/expected_creole/test_creole_pictures_width.latex +4 -0
- data/unittest/expected_creole/test_creole_placeholders_html.html +7 -0
- data/unittest/expected_creole/test_creole_placeholders_html.latex +8 -0
- data/unittest/expected_creole/test_creole_placeholders_html.text +4 -0
- data/unittest/expected_creole/test_creole_placeholders_latex.html +6 -0
- data/unittest/expected_creole/test_creole_placeholders_latex.latex +9 -0
- data/unittest/expected_creole/test_creole_placeholders_latex.text +4 -0
- data/unittest/expected_creole/test_creole_short_html.html +3 -0
- data/unittest/expected_creole/test_creole_short_html.latex +4 -0
- data/unittest/expected_creole/test_creole_short_html.text +2 -0
- data/unittest/expected_creole/test_creole_shy.creole +6 -0
- data/unittest/expected_creole/test_creole_shy.html +6 -0
- data/unittest/expected_creole/test_creole_shy.latex +8 -0
- data/unittest/expected_creole/test_creole_shy.text +4 -0
- data/unittest/expected_creole/test_creole_tabular.creole +22 -0
- data/unittest/expected_creole/test_creole_tabular.html +20 -0
- data/unittest/expected_creole/test_creole_tabular.latex +22 -0
- data/unittest/expected_creole/test_creole_tabular_creole.creole +21 -0
- data/unittest/expected_creole/test_creole_tabular_creole.html +20 -0
- data/unittest/expected_creole/test_creole_tabular_creole.latex +21 -0
- data/unittest/expected_creole/test_creole_tabular_css.creole +24 -0
- data/unittest/expected_creole/test_creole_tabular_css.html +20 -0
- data/unittest/expected_creole/test_creole_tabular_css.latex +22 -0
- data/unittest/expected_creole/test_creole_tabular_multicols.creole +16 -0
- data/unittest/expected_creole/test_creole_tabular_multicols.html +14 -0
- data/unittest/expected_creole/test_creole_tabular_multicols.latex +16 -0
- data/unittest/expected_creole/test_creole_tabular_row_parameters.latex +22 -0
- data/unittest/expected_creole/test_creole_tabular_with_cell_option.creole +21 -0
- data/unittest/expected_creole/test_creole_tabular_with_cell_option.html +20 -0
- data/unittest/expected_creole/test_creole_toc.html +13 -0
- data/unittest/expected_creole/test_creole_toc.latex +22 -0
- data/unittest/expected_creole/test_creole_toc.text +4 -0
- data/unittest/expected_creole/test_creole_toc_level.html +7 -0
- data/unittest/expected_creole/test_creole_toc_level.latex +10 -0
- data/unittest/expected_creole/test_creole_toc_level.text +3 -0
- data/unittest/expected_creole/test_creole_toc_level_text.html +8 -0
- data/unittest/expected_creole/test_creole_toc_level_text.latex +9 -0
- data/unittest/expected_creole/test_creole_toc_text.html +5 -0
- data/unittest/expected_creole/test_creole_toc_text.latex +5 -0
- data/unittest/expected_creole/test_creole_ul_multiple_line.html +7 -0
- data/unittest/expected_creole/test_creole_ul_multiple_line.latex +14 -0
- data/unittest/expected_creole/test_creole_ul_with_blank.html +11 -0
- data/unittest/expected_creole/test_creole_ul_with_blank.latex +20 -0
- data/unittest/expected_creole/test_creole_ul_with_bold.creole +0 -0
- data/unittest/expected_creole/test_creole_ul_with_bold.html +11 -0
- data/unittest/expected_creole/test_creole_ul_with_bold.latex +18 -0
- data/unittest/expected_creole/test_creole_ul_with_bold.text +7 -0
- data/unittest/expected_creole/test_creole_verbatim.html +25 -0
- data/unittest/expected_creole/test_creole_verbatim.latex +33 -0
- data/unittest/expected_creole/test_creole_verbatim.text +17 -0
- data/unittest/expected_creole/test_creole_verbatim_inline.html +6 -0
- data/unittest/expected_creole/test_creole_verbatim_inline.latex +8 -0
- data/unittest/expected_creole/test_creole_verbatim_inline_at_start.html +6 -0
- data/unittest/expected_creole/test_creole_verbatim_inline_at_start.latex +8 -0
- data/unittest/expected_creole_rail/test_rail_creole_object.tex +33 -0
- data/unittest/expected_creole_rail/test_rail_creole_placeholder.tex +40 -0
- data/unittest/expected_rubycode4doc/creole_complete.html +26 -0
- data/unittest/expected_rubycode4doc/creole_complete.tex +40 -0
- data/unittest/expected_rubycode4doc/creole_in_tab.html +4 -0
- data/unittest/expected_rubycode4doc/creole_in_tab.tex +6 -0
- data/unittest/expected_rubycode4doc/creole_inline_ruby.html +7 -0
- data/unittest/expected_rubycode4doc/creole_output.html +2 -0
- data/unittest/expected_rubycode4doc/creole_output.tex +4 -0
- data/unittest/expected_rubycode4doc/creole_rubycode.html +1 -0
- data/unittest/expected_rubycode4doc/creole_rubycode.tex +3 -0
- data/unittest/expected_rubycode4doc/creole_rubycode_evaluated.html +1 -0
- data/unittest/expected_rubycode4doc/creole_rubycode_evaluated.tex +3 -0
- data/unittest/expected_rubycode4doc/creole_rubycode_evaluated_listings.html +3 -0
- data/unittest/expected_rubycode4doc/creole_rubycode_evaluated_listings.tex +5 -0
- data/unittest/unittest_creole.rb +1379 -0
- data/unittest/unittest_creole_placeholders.rb +161 -0
- data/unittest/unittest_creole_plugin_rail.rb +148 -0
- data/unittest/unittest_creole_plugin_rubycode4doc.rb +123 -0
- data/unittest/unittest_creole_plugin_struktex.rb +26 -0
- data/unittest/unittest_creole_tabular.rb +212 -0
- metadata +529 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
<<prefix>>
|
2
|
+
\documentclass[ngerman]{scrartcl}
|
3
|
+
\usepackage{babel}
|
4
|
+
\usepackage[ansinew]{inputenc}
|
5
|
+
\usepackage{hyperref}
|
6
|
+
% ----------------------------------------------------------------
|
7
|
+
\usepackage{rail}
|
8
|
+
|
9
|
+
\title{Rail-Diagramms in Creole}
|
10
|
+
\hypersetup{pdftitle={Rail-Diagramms in Creole}}
|
11
|
+
|
12
|
+
% ----------------------------------------------------------------
|
13
|
+
\begin{document}
|
14
|
+
\section{Rail-Diagramms}
|
15
|
+
\subsection{Via Ruby-object}
|
16
|
+
|
17
|
+
|
18
|
+
%
|
19
|
+
% Define a rail-diagramm block
|
20
|
+
%
|
21
|
+
\begin{rail}
|
22
|
+
block :
|
23
|
+
( lbrace | 'begin' )
|
24
|
+
( ( '|' ( variable + ',' ) '|' ) | [Keine Blockvariablen] )
|
25
|
+
comm
|
26
|
+
( rbrace | 'end' )
|
27
|
+
;
|
28
|
+
\end{rail}
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
\end{document}
|
33
|
+
% ----------------------------------------------------------------
|
@@ -0,0 +1,40 @@
|
|
1
|
+
<<prefix>>
|
2
|
+
\documentclass[ngerman]{scrartcl}
|
3
|
+
\usepackage{babel}
|
4
|
+
\usepackage[ansinew]{inputenc}
|
5
|
+
\usepackage{hyperref}
|
6
|
+
% ----------------------------------------------------------------
|
7
|
+
\usepackage{rail}
|
8
|
+
|
9
|
+
\title{Rail-Diagramms in Creole}
|
10
|
+
\hypersetup{pdftitle={Rail-Diagramms in Creole}}
|
11
|
+
|
12
|
+
% ----------------------------------------------------------------
|
13
|
+
\begin{document}
|
14
|
+
\section{Rail-Diagramms}
|
15
|
+
\subsection{Via Placeholder}
|
16
|
+
%
|
17
|
+
% Define a rail-diagramm test
|
18
|
+
%
|
19
|
+
\begin{rail}
|
20
|
+
test :
|
21
|
+
[1] (
|
22
|
+
( '[' string ']' )
|
23
|
+
? body[2--6] + '|'
|
24
|
+
)
|
25
|
+
| [2] body[3--6] '*' body[5--6]
|
26
|
+
| [2] body[3--6] '+' body[5--6]
|
27
|
+
| [3] ( body[4--5] + )
|
28
|
+
| [4] body[5] '?'
|
29
|
+
| [5] identifier ( '[' string ']' ) ?
|
30
|
+
| [5] quote string quote
|
31
|
+
| [5] dquote string dquote
|
32
|
+
| [5] '(' body[1--6] ')'
|
33
|
+
| [5] cr
|
34
|
+
| [6]
|
35
|
+
;
|
36
|
+
;
|
37
|
+
\end{rail}
|
38
|
+
|
39
|
+
\end{document}
|
40
|
+
% ----------------------------------------------------------------
|
@@ -0,0 +1,26 @@
|
|
1
|
+
<p >
|
2
|
+
rubycode
|
3
|
+
</p>
|
4
|
+
<pre style = "rubycode" >1 + 1</pre>
|
5
|
+
<hr />
|
6
|
+
<p >
|
7
|
+
rubycode_output
|
8
|
+
</p>
|
9
|
+
<pre style = "rubycode_output" >2</pre>
|
10
|
+
<hr />
|
11
|
+
<p >
|
12
|
+
rubycode_evaluated
|
13
|
+
</p>
|
14
|
+
<pre style = "rubycode_evaluated" >1 + 1 # -> 2 </pre>
|
15
|
+
<hr />
|
16
|
+
<p >
|
17
|
+
rubycode_in_tab
|
18
|
+
</p>
|
19
|
+
|
20
|
+
<table border = "1" ><tr style = "border-bottom-style: solid;border-bottom-width: medium;" ><td >No</td><td >Code</td><td >Result</td><td >Output</td><td >Output2</td></tr>
|
21
|
+
<tr ><td >1</td><td ><pre class = "rubycode" >1 + 1</pre></td><td >2</td><td ></td><td ><pre class = "ruby_result" ></pre></td></tr>
|
22
|
+
</table>
|
23
|
+
<hr />
|
24
|
+
<pre class = "rubycode_with_result" >
|
25
|
+
1 + 1 # -> 2
|
26
|
+
</pre>
|
@@ -0,0 +1,40 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
rubycode
|
4
|
+
|
5
|
+
|
6
|
+
\begin{verbatim}1 + 1\end{verbatim}
|
7
|
+
|
8
|
+
\hrulefill
|
9
|
+
|
10
|
+
|
11
|
+
rubycode\_output
|
12
|
+
|
13
|
+
|
14
|
+
\begin{verbatim}2\end{verbatim}
|
15
|
+
|
16
|
+
\hrulefill
|
17
|
+
|
18
|
+
|
19
|
+
rubycode\_evaluated
|
20
|
+
|
21
|
+
|
22
|
+
\begin{verbatim}1 + 1 # -> 2 \end{verbatim}
|
23
|
+
|
24
|
+
\hrulefill
|
25
|
+
|
26
|
+
|
27
|
+
rubycode\_in\_tab
|
28
|
+
|
29
|
+
|
30
|
+
\begin{tabular}{lp{3cm}llp{3cm}}No & Code & Result & Output & Output2\\\hline
|
31
|
+
1 & \lstinline[]!1 + 1! & 2 & &
|
32
|
+
\begin{verbatim}\end{verbatim}
|
33
|
+
\\
|
34
|
+
\end{tabular}
|
35
|
+
\hrulefill
|
36
|
+
|
37
|
+
\begin{lstlisting}[numbers={left}, numberstyle={\tiny}]
|
38
|
+
1 + 1 # -> 2
|
39
|
+
\end{lstlisting}
|
40
|
+
|
@@ -0,0 +1,4 @@
|
|
1
|
+
|
2
|
+
<table border = "1" ><tr style = "border-bottom-style: solid;border-bottom-width: medium;" ><td >No</td><td >Code</td><td >Result</td><td >Output</td><td >Output2</td></tr>
|
3
|
+
<tr ><td >1</td><td ><pre class = "rubycode" >1 + 1</pre></td><td >2</td><td ></td><td ><pre class = "ruby_result" ></pre></td></tr>
|
4
|
+
</table>
|
@@ -0,0 +1 @@
|
|
1
|
+
<pre style = "rubycode" >1 + 1</pre>
|
@@ -0,0 +1 @@
|
|
1
|
+
<pre style = "rubycode_evaluated" >1 + 1 # -> 2 </pre>
|
@@ -0,0 +1,1379 @@
|
|
1
|
+
# encoding: cp1252
|
2
|
+
if $0 == __FILE__
|
3
|
+
$:.unshift("../lib")
|
4
|
+
$:.unshift('../../docgenerator/lib')
|
5
|
+
end
|
6
|
+
|
7
|
+
#~ ARGV << '-n' << 'test_creole_paragraphs_wrap_with_linebreaks'
|
8
|
+
|
9
|
+
|
10
|
+
gem 'minitest-filecontent'
|
11
|
+
require 'minitest/filecontent.rb'
|
12
|
+
|
13
|
+
#~ require 'docgenerator.rb'
|
14
|
+
require 'docgenerator-creole.rb'
|
15
|
+
|
16
|
+
#~ Docgenerator.trace_on
|
17
|
+
|
18
|
+
<<missingtests
|
19
|
+
see Text and
|
20
|
+
description
|
21
|
+
labels
|
22
|
+
|
23
|
+
<<ruby>>
|
24
|
+
|
25
|
+
Creole_document
|
26
|
+
*content mit level..., \tableofcontents...
|
27
|
+
|
28
|
+
Bug:
|
29
|
+
http://... am Ende ohne folgenden Text wird falsch erkannt.
|
30
|
+
--> test_creole_links_implicit_end()
|
31
|
+
missingtests
|
32
|
+
|
33
|
+
#thisfile is needed to avoid different values of $thisfile
|
34
|
+
#(Running stand alone it's the filename, with require it's './<<filename>>'
|
35
|
+
$thisfile = File.basename(__FILE__)
|
36
|
+
|
37
|
+
class Docgenerator::Creole::Creole
|
38
|
+
#Access to the options.
|
39
|
+
attr_reader :options
|
40
|
+
end
|
41
|
+
|
42
|
+
require 'yaml'
|
43
|
+
require 'log4r'
|
44
|
+
#
|
45
|
+
#Warn -> report missing important test
|
46
|
+
#Info -> report missing test
|
47
|
+
|
48
|
+
$log = Log4r::Logger.new('Unittest creole', Log4r::ERROR)
|
49
|
+
#~ $log = Log4r::Logger.new('Unittest creole', Log4r::WARN)
|
50
|
+
#~ $log = Log4r::Logger.new('Unittest creole', Log4r::INFO)
|
51
|
+
$log.outputters = Log4r::StdoutOutputter.new('log_stdout')
|
52
|
+
|
53
|
+
#Logger to catch unwanted messages
|
54
|
+
$tmplog = Log4r::Logger.new('Creole', Log4r::FATAL)
|
55
|
+
|
56
|
+
class Test_creole_basics < MiniTest::Test
|
57
|
+
def setup()
|
58
|
+
#Avoid warnings about missing logger in to_doc
|
59
|
+
@opt = { :log => Docgenerator::DOCGENERATOR_DEFAULT_LOGGER }
|
60
|
+
end
|
61
|
+
#Test some basic definitions.
|
62
|
+
def test_creole_initialize()
|
63
|
+
creole = Docgenerator::Creole::Creole.new(
|
64
|
+
:content => 'test'
|
65
|
+
)
|
66
|
+
assert_instance_of( Log4r::Logger, creole.log)
|
67
|
+
assert_equal( Log4r::INFO, creole.log.level, "Default Level of Default-Logger (creole.log) changed:")
|
68
|
+
assert_instance_of( Log4r::StdoutOutputter, creole.log.outputters.first)
|
69
|
+
#~ assert_equal( Log4r::DEBUG, creole.log.outputters.first.level)
|
70
|
+
assert_equal( creole.options[:wrap_at], 75 )
|
71
|
+
end
|
72
|
+
# Get some content and check the content.
|
73
|
+
def test_creole_input_string()
|
74
|
+
source = <<creole
|
75
|
+
Text,
|
76
|
+
more Text.
|
77
|
+
And some more text.
|
78
|
+
|
79
|
+
A new paragraph.
|
80
|
+
creole
|
81
|
+
creole = Docgenerator::Creole::Creole.new(:content => source )
|
82
|
+
assert_equal( [source], creole.source)
|
83
|
+
|
84
|
+
#ruby 1.8: symbols as key, ruby 1.9: Strings
|
85
|
+
#~ omit_if( RUBY_VERSION !~ /1.9/, "Wrong ruby version #{RUBY_VERSION}"){
|
86
|
+
assert_equal_filecontent( "expected_creole/test_creole_input.normsource", creole.normsource.to_yaml)
|
87
|
+
#~ }
|
88
|
+
|
89
|
+
creole = Docgenerator::Creole::Creole.new(:content => source )
|
90
|
+
creole = Docgenerator::Creole::Creole.new()
|
91
|
+
creole << source
|
92
|
+
creole << source
|
93
|
+
assert_equal( [source, source], creole.source)
|
94
|
+
end
|
95
|
+
def test_creole_input_array()
|
96
|
+
|
97
|
+
creole = Docgenerator::Creole::Creole.new(:content => [ "Text1", "Text2" ] )
|
98
|
+
assert_equal( ["Text1\nText2"], creole.source)
|
99
|
+
|
100
|
+
creole = Docgenerator::Creole::Creole.new(:content => [ "Text1\n", "Text2" ] )
|
101
|
+
assert_equal( ["Text1\nText2"], creole.source)
|
102
|
+
|
103
|
+
#Leading spaces keep staying
|
104
|
+
creole = Docgenerator::Creole::Creole.new(:content => [ " Text1\n", "Text2" ] )
|
105
|
+
assert_equal( [" Text1\nText2"], creole.source)
|
106
|
+
|
107
|
+
#Trailing spaces keep staying
|
108
|
+
creole = Docgenerator::Creole::Creole.new(:content => [ "Text1 \n", "Text2" ] )
|
109
|
+
assert_equal( ["Text1 \nText2"], creole.source)
|
110
|
+
|
111
|
+
end #
|
112
|
+
def test_creole_input_undefined()
|
113
|
+
assert_raises(Docgenerator::Creole::Creole::InputError){ Docgenerator::Creole::Creole.new(:content => :source ) }
|
114
|
+
end
|
115
|
+
#Check for open File-handles
|
116
|
+
def test_creole_input_file()
|
117
|
+
creole1 = Docgenerator::Creole::Creole.new( :content => File.read('creole1.0test.txt') )
|
118
|
+
creole2 = nil
|
119
|
+
File.open('creole1.0test.txt'){|filehandle|
|
120
|
+
creole2 = Docgenerator::Creole::Creole.new( :content => filehandle )
|
121
|
+
}
|
122
|
+
assert_equal( creole1.source, creole2.source)
|
123
|
+
end
|
124
|
+
#
|
125
|
+
#Test for filehandle, if the file is a Rubyscript (Take only parts after __END__)
|
126
|
+
def test_creole_input_file_rb()
|
127
|
+
#ignore this test, if tests are loaded via require.
|
128
|
+
return unless $0 == __FILE__
|
129
|
+
|
130
|
+
creole1 = Docgenerator::Creole::Creole.new( :name => 'input_file_rb/DATA', :content => DATA )
|
131
|
+
|
132
|
+
creole2 = nil
|
133
|
+
File.open($thisfile){|filehandle|
|
134
|
+
#~ $log.warn('Test Filehandle auf ruby nicht m�glich (Test $0 == input.path)')
|
135
|
+
#Modify $0 temporary to allow test with condition $0 == input.path
|
136
|
+
$0 = "xxxx#{$thisfile}"
|
137
|
+
creole2 = Docgenerator::Creole::Creole.new( :name => 'input_file_rb', :content => filehandle, :log => $tmplog )
|
138
|
+
$0 = $thisfile
|
139
|
+
}
|
140
|
+
#normalize line ends
|
141
|
+
assert_equal( creole1.source.map{|entry|entry.gsub( /\r\n?/, "\n")}, creole2.source)
|
142
|
+
end
|
143
|
+
def test_creole_input_file_simple
|
144
|
+
assert(File.exist?('creole_testtext.creole'))
|
145
|
+
creole = Docgenerator::Creole::Creole.new()
|
146
|
+
File.open('creole_testtext.creole'){|f| creole << f.readlines }
|
147
|
+
end
|
148
|
+
def test_creole_input_file_simple_readlines
|
149
|
+
creole = Docgenerator::Creole::Creole.new()
|
150
|
+
File.open('creole_testtext.creole'){|f| creole << f }
|
151
|
+
assert_equal_filecontent( "expected_creole/#{__method__}.html", creole.to_doc(:html, @opt))
|
152
|
+
end
|
153
|
+
#
|
154
|
+
#This testcases are taken from http://www.wikicreole.org/wiki/Creole1.0TestCases
|
155
|
+
def test_creole_creole1_0test()
|
156
|
+
$log.info('Testcases uncomplete creole1.0test.txt')
|
157
|
+
#Logger w/o messages
|
158
|
+
@opt_silent = { :log => Log4r::Logger.new('silent') }
|
159
|
+
creole = Docgenerator::Creole::Creole.new(
|
160
|
+
:name => 'creole_creole1_0test',
|
161
|
+
:content => File.readlines('creole1.0test.txt').join,
|
162
|
+
:log => $tmplog #catch warning for [[links]]
|
163
|
+
)
|
164
|
+
|
165
|
+
assert_equal_filecontent( "expected_creole/test_creole_creole1.0test.html", creole.to_doc(:html, @opt_silent))
|
166
|
+
assert_equal_filecontent( "expected_creole/test_creole_creole1.0test.latex", creole.to_doc(:latex, @opt_silent))
|
167
|
+
$log.warn('test_creole_creole1.0test: to_context')
|
168
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_creole1.0test.context", creole.to_doc(:context))
|
169
|
+
$log.info('test_creole_creole1_0test: uncomplete to_creole')
|
170
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_creole1.0test.creole", creole.to_doc(:creole, @opt))
|
171
|
+
assert_equal_filecontent( "expected_creole/test_creole_creole1.0test.text", creole.to_doc(:text, @opt_silent))
|
172
|
+
end
|
173
|
+
end #Test_creole_basics
|
174
|
+
|
175
|
+
class Test_creole_paragraphs < MiniTest::Test
|
176
|
+
def setup()
|
177
|
+
#Avoid warnings about missing logger in to_doc
|
178
|
+
@opt = { :log => Docgenerator::DOCGENERATOR_DEFAULT_LOGGER }
|
179
|
+
end
|
180
|
+
|
181
|
+
def test_creole_paragraphs()
|
182
|
+
source = <<creole
|
183
|
+
This is some text,
|
184
|
+
followed by more Text.
|
185
|
+
And some more text.
|
186
|
+
|
187
|
+
And now a new paragraph with some other text.
|
188
|
+
|
189
|
+
creole
|
190
|
+
creole = Docgenerator::Creole::Creole.new(:content => source )
|
191
|
+
assert_equal( [source], creole.source)
|
192
|
+
|
193
|
+
assert_equal_filecontent( "expected_creole/test_creole_paragraphs.html", creole.to_doc(:html, @opt))
|
194
|
+
assert_equal_filecontent( "expected_creole/test_creole_paragraphs.latex", creole.to_doc(:latex, @opt))
|
195
|
+
$log.warn('test_creole_paragraphs: to_context')
|
196
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_paragraphs.context", creole.to_doc(:context))
|
197
|
+
assert_equal_filecontent( "expected_creole/test_creole_paragraphs.wiki", creole.to_doc(:wiki, @opt))
|
198
|
+
$log.info('test_creole_paragraphs: uncomplete to_creole')
|
199
|
+
assert_equal_filecontent( "expected_creole/test_creole_paragraphs.text", creole.to_doc(:text, @opt))
|
200
|
+
|
201
|
+
#ruby 1.8: symbols as key, ruby 1.9: Strings
|
202
|
+
#~ omit_if( RUBY_VERSION !~ /1.9/, "Wrong ruby version #{RUBY_VERSION}"){
|
203
|
+
assert_equal_filecontent( "expected_creole/test_creole_paragraphs.normsource", creole.normsource.to_yaml)
|
204
|
+
#~ }
|
205
|
+
end
|
206
|
+
def test_creole_paragraphs_wrap()
|
207
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
208
|
+
And now a line which is a bit longer then 80 characters in the input line. Creole should split it at position 75 or a bit later (depending on the word length at position 75).
|
209
|
+
creole
|
210
|
+
)
|
211
|
+
|
212
|
+
assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap.html", creole.to_doc(:html, @opt))
|
213
|
+
assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap.latex", creole.to_doc(:latex, @opt))
|
214
|
+
$log.warn('test_creole_paragraphs_wrap: to_context')
|
215
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap.context", creole.to_doc(:context))
|
216
|
+
assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap.wiki", creole.to_doc(:wiki, @opt))
|
217
|
+
$log.info('test_creole_paragraphs_wrap: uncomplete to_creole')
|
218
|
+
assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap.text", creole.to_doc(:text, @opt))
|
219
|
+
end #test_creole_paragraphs_wrap()
|
220
|
+
def test_creole_paragraphs_wrap60()
|
221
|
+
|
222
|
+
creole = Docgenerator::Creole::Creole.new(:wrap_at => 60, :content => <<creole
|
223
|
+
And now a line which is a bit longer then 80 characters in the input line. Creole should split it at position 60 or a bit later (depending on the word length at position 60).
|
224
|
+
creole
|
225
|
+
)
|
226
|
+
|
227
|
+
assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap60.html", creole.to_doc(:html, @opt))
|
228
|
+
assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap60.latex", creole.to_doc(:latex, @opt))
|
229
|
+
$log.warn('test_creole_paragraphs_wrap60: to_context')
|
230
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap60.context", creole.to_doc(:context))
|
231
|
+
assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap60.wiki", creole.to_doc(:wiki, @opt))
|
232
|
+
$log.info('test_creole_paragraphs_wrap: uncomplete to_creole')
|
233
|
+
assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap60.text", creole.to_doc(:text, @opt))
|
234
|
+
end #test_creole_paragraphs_wrap60()
|
235
|
+
|
236
|
+
def test_creole_paragraphs_wrap0()
|
237
|
+
|
238
|
+
creole = Docgenerator::Creole::Creole.new(:wrap_at => 0, :content => <<creole
|
239
|
+
And now a line which is a bit longer then 80 characters in the input line. Creole should not split it, because we defined split_at to 0.
|
240
|
+
|
241
|
+
And now a line which is a bit longer then 80 characters in the input line.
|
242
|
+
Creole should not split it, because we defined split_at to 0.
|
243
|
+
creole
|
244
|
+
)
|
245
|
+
|
246
|
+
assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap0.html", creole.to_doc(:html, @opt))
|
247
|
+
assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap0.latex", creole.to_doc(:latex, @opt))
|
248
|
+
$log.warn('test_creole_paragraphs_wrap0: to_context')
|
249
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap0.context", creole.to_doc(:context))
|
250
|
+
assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap0.wiki", creole.to_doc(:wiki, @opt))
|
251
|
+
$log.info('test_creole_paragraphs_wrap: uncomplete to_creole')
|
252
|
+
assert_equal_filecontent( "expected_creole/test_creole_paragraphs_wrap0.text", creole.to_doc(:text, @opt))
|
253
|
+
end
|
254
|
+
|
255
|
+
def test_creole_paragraphs_wrap_with_linebreaks()
|
256
|
+
#~ skip 'This does not wrap, it creates one long text'
|
257
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
258
|
+
And now a line which is a bit longer then 80 characters in the input line.
|
259
|
+
Creole should split it at position 75 or a bit later
|
260
|
+
(depending on the word length at position 75).
|
261
|
+
creole
|
262
|
+
)
|
263
|
+
|
264
|
+
assert_equal_filecontent( "expected_creole/#{__method__}.html", creole.to_doc(:html, @opt))
|
265
|
+
assert_equal_filecontent( "expected_creole/#{__method__}.latex", creole.to_doc(:latex, @opt))
|
266
|
+
$log.warn('#{__method__}: to_context')
|
267
|
+
#~ assert_equal_filecontent( "expected_creole/#{__method__}.context", creole.to_doc(:context))
|
268
|
+
assert_equal_filecontent( "expected_creole/#{__method__}.wiki", creole.to_doc(:wiki, @opt))
|
269
|
+
$log.info('#{__method__}: uncomplete to_creole')
|
270
|
+
assert_equal_filecontent( "expected_creole/#{__method__}.text", creole.to_doc(:text, @opt))
|
271
|
+
end #test_creole_paragraphs_wrap()
|
272
|
+
|
273
|
+
end #Test_creole_paragraphs < MiniTest::Test
|
274
|
+
|
275
|
+
class Test_creole_headings < MiniTest::Test
|
276
|
+
def setup()
|
277
|
+
#Avoid warnings about missing logger in to_doc
|
278
|
+
@opt = { :log => Docgenerator::DOCGENERATOR_DEFAULT_LOGGER }
|
279
|
+
end
|
280
|
+
|
281
|
+
def test_creole_headings()
|
282
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
283
|
+
= Top-level heading (1)
|
284
|
+
== This a test for creole 0.1 (2)
|
285
|
+
=== This is a Subheading (3)
|
286
|
+
==== Subsub (4)
|
287
|
+
===== Subsubsub (5)
|
288
|
+
|
289
|
+
The ending equal signs should not be displayed:
|
290
|
+
|
291
|
+
= Top-level heading (1) =
|
292
|
+
== This a test for creole 0.1 (2) ==
|
293
|
+
=== This is a Subheading (3) ===
|
294
|
+
==== Subsub (4) ====
|
295
|
+
===== Subsubsub (5) =====
|
296
|
+
|
297
|
+
|
298
|
+
= **not** //parsed// =
|
299
|
+
The content is not parsed.
|
300
|
+
creole
|
301
|
+
)
|
302
|
+
|
303
|
+
assert_equal_filecontent( "expected_creole/test_creole_headings.html", creole.to_doc(:html, @opt))
|
304
|
+
assert_equal_filecontent( "expected_creole/test_creole_headings.latex", creole.to_doc(:latex, @opt))
|
305
|
+
$log.warn('test_creole_headings: to_context')
|
306
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_headings.context", creole.to_doc(:context))
|
307
|
+
assert_equal_filecontent( "expected_creole/test_creole_headings.wiki", creole.to_doc(:wiki, @opt))
|
308
|
+
$log.info('test_creole_paragraphs: uncomplete to_creole')
|
309
|
+
assert_equal_filecontent( "expected_creole/test_creole_headings.text", creole.to_doc(:text, @opt))
|
310
|
+
end #test_creole_headings
|
311
|
+
#
|
312
|
+
#Modification of standard: Labels for headings.
|
313
|
+
#
|
314
|
+
#Including the definition of a label tor the toc.
|
315
|
+
def test_creole_label()
|
316
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
317
|
+
==Titel 1==
|
318
|
+
Text
|
319
|
+
===Titel 2===
|
320
|
+
Text unter Titel 2
|
321
|
+
===[2b]Titel 2b===
|
322
|
+
Text unter Titel 2b.
|
323
|
+
creole
|
324
|
+
)
|
325
|
+
#Check the manual label
|
326
|
+
assert_equal_filecontent( "expected_creole/test_creole_label.html", creole.to_doc(:html, @opt))
|
327
|
+
assert_equal_filecontent( "expected_creole/test_creole_label.latex", creole.to_doc(:latex, @opt))
|
328
|
+
$log.warn('test_creole_label: to_context')
|
329
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_label.context", creole.to_doc(:context))
|
330
|
+
$log.info('test_creole_label: uncomplete text/to_creole')
|
331
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_label.creole", creole.to_doc(:creole, @opt))
|
332
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_label.text", creole.to_doc(:text, @opt))
|
333
|
+
|
334
|
+
end
|
335
|
+
end #Test_creole_headings < MiniTest::Test
|
336
|
+
|
337
|
+
class Test_creole_toc < MiniTest::Test
|
338
|
+
def setup()
|
339
|
+
#Avoid warnings about missing logger in to_doc
|
340
|
+
@opt = { :log => Docgenerator::DOCGENERATOR_DEFAULT_LOGGER }
|
341
|
+
end
|
342
|
+
def test_creole_toc()
|
343
|
+
creole = Docgenerator::Creole::Creole.new(
|
344
|
+
:name => 'toc',
|
345
|
+
:content => <<creole
|
346
|
+
=one
|
347
|
+
=two
|
348
|
+
==two-one
|
349
|
+
=[drei]three
|
350
|
+
==three-one
|
351
|
+
creole
|
352
|
+
)
|
353
|
+
assert_equal_filecontent( "expected_creole/test_creole_toc.html", creole.toc.to_doc(:html, @opt))
|
354
|
+
assert_equal_filecontent( "expected_creole/test_creole_toc_text.html", creole.to_doc(:html, @opt))
|
355
|
+
assert_equal_filecontent( "expected_creole/test_creole_toc.latex", creole.toc.to_doc(:latex, @opt))
|
356
|
+
assert_equal_filecontent( "expected_creole/test_creole_toc_text.latex", creole.to_doc(:latex, @opt))
|
357
|
+
$log.warn('test_creole_toc_text: to_context')
|
358
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_toc_text.context", creole.to_doc(:context))
|
359
|
+
$log.warn('test_creole_toc: to wiki/creole')
|
360
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_toc.creole", creole.to_doc(:creole, @opt))
|
361
|
+
assert_equal_filecontent( "expected_creole/test_creole_toc.text", creole.toc.to_doc(:text, @opt))
|
362
|
+
end #test_creole_toc
|
363
|
+
#Build the toc, but only up to level toclevel.
|
364
|
+
def test_creole_toc_level()
|
365
|
+
toclevel = 1
|
366
|
+
creole = Docgenerator::Creole::Creole.new(
|
367
|
+
:name => 'toc',
|
368
|
+
:content => <<creole
|
369
|
+
Test for document with toc-level #{toclevel}
|
370
|
+
=one
|
371
|
+
=two
|
372
|
+
==two-one
|
373
|
+
=[drei]three
|
374
|
+
==three-one
|
375
|
+
creole
|
376
|
+
)
|
377
|
+
assert_equal_filecontent( "expected_creole/test_creole_toc_level.html", creole.toc(:level => toclevel).to_doc(:html, @opt))
|
378
|
+
assert_equal_filecontent( "expected_creole/test_creole_toc_level_text.html", creole.to_doc(:html, @opt))
|
379
|
+
assert_equal_filecontent( "expected_creole/test_creole_toc_level.latex", creole.toc(:level => toclevel).to_doc(:latex, @opt))
|
380
|
+
assert_equal_filecontent( "expected_creole/test_creole_toc_level_text.latex", creole.to_doc(:latex, :level => toclevel))
|
381
|
+
$log.warn('test_creole_toc_text: to_context')
|
382
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_toc_text.context", creole.to_doc(:context)
|
383
|
+
$log.warn('test_creole_toc: to wiki/creole')
|
384
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_toc_level.creole", creole.to_doc(:creole, @opt)
|
385
|
+
assert_equal_filecontent( "expected_creole/test_creole_toc_level.text", creole.toc(:level => toclevel).to_doc(:text, @opt))
|
386
|
+
end #test_creole_toc_level
|
387
|
+
end #Test_creole_toc
|
388
|
+
|
389
|
+
class Test_creole_paragraph2 < MiniTest::Test
|
390
|
+
def setup()
|
391
|
+
#Avoid warnings about missing logger in to_doc
|
392
|
+
@opt = { :log => Docgenerator::DOCGENERATOR_DEFAULT_LOGGER }
|
393
|
+
end
|
394
|
+
def test_creole_newline()
|
395
|
+
creole = Docgenerator::Creole::Creole.new(
|
396
|
+
:name => 'newline',
|
397
|
+
:content => <<'creole'
|
398
|
+
You can format an address by simply forcing linebreaks:
|
399
|
+
|
400
|
+
My contact dates:\\
|
401
|
+
Pone: xyz\\
|
402
|
+
Fax: +45\\
|
403
|
+
Mobile: abc
|
404
|
+
|
405
|
+
creole
|
406
|
+
)
|
407
|
+
assert_equal_filecontent( "expected_creole/test_creole_newline.html", creole.to_doc(:html, @opt))
|
408
|
+
assert_equal_filecontent( "expected_creole/test_creole_newline.latex", creole.to_doc(:latex, @opt))
|
409
|
+
$log.warn('test_creole_newline: to_context')
|
410
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_newline.context", creole.to_doc(:context))
|
411
|
+
$log.warn('test_creole_newline: to wiki/creole')
|
412
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_newline.creole", creole.to_doc(:creole, @opt))
|
413
|
+
assert_equal_filecontent( "expected_creole/test_creole_newline.text", creole.to_doc(:text, @opt))
|
414
|
+
end #test_creole_newline
|
415
|
+
def test_creole_hr()
|
416
|
+
creole = Docgenerator::Creole::Creole.new(
|
417
|
+
:name => 'hr',
|
418
|
+
:content => <<creole
|
419
|
+
|
420
|
+
You can use this to draw a line to separate the page:
|
421
|
+
----
|
422
|
+
This is after the horizontal line
|
423
|
+
creole
|
424
|
+
)
|
425
|
+
assert_equal_filecontent( "expected_creole/test_creole_hr.html", creole.to_doc(:html, @opt))
|
426
|
+
assert_equal_filecontent( "expected_creole/test_creole_hr.latex", creole.to_doc(:latex, @opt))
|
427
|
+
$log.warn('test_creole_hr: to_context')
|
428
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_hr.context", creole.to_doc(:context))
|
429
|
+
$log.warn('test_creole_hr: to wiki/creole')
|
430
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_hr.creole", creole.to_doc(:creole, @opt))
|
431
|
+
assert_equal_filecontent( "expected_creole/test_creole_hr.text", creole.to_doc(:text, @opt))
|
432
|
+
end #test_creole_hr
|
433
|
+
|
434
|
+
end #Test_creole_paragraph2
|
435
|
+
|
436
|
+
|
437
|
+
class Test_creole_inline < MiniTest::Test
|
438
|
+
def setup()
|
439
|
+
#Avoid warnings about missing logger in to_doc
|
440
|
+
@opt = { :log => Docgenerator::DOCGENERATOR_DEFAULT_LOGGER }
|
441
|
+
end
|
442
|
+
|
443
|
+
def test_creole_inline_bold_em()
|
444
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
445
|
+
You can make things **bold** or //italic// or **//both//** or //**both**//.
|
446
|
+
creole
|
447
|
+
)
|
448
|
+
assert_equal_filecontent( "expected_creole/test_creole_inline.html", creole.to_doc(:html, @opt))
|
449
|
+
assert_equal_filecontent( "expected_creole/test_creole_inline.latex", creole.to_doc(:latex, @opt))
|
450
|
+
$log.warn('test_creole_inline: to_context')
|
451
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_inline.context", creole.to_doc(:context))
|
452
|
+
$log.info('test_creole_inline_bold_em: inline to wiki/creole')
|
453
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_inline.creole", creole.to_doc(:creole, @opt))
|
454
|
+
$log.warn('test_creole_inline_bold_em: inline text with additional spaces')
|
455
|
+
assert_equal_filecontent( "expected_creole/test_creole_inline.text", creole.to_doc(:text, @opt))
|
456
|
+
end
|
457
|
+
|
458
|
+
def test_creole_inline_bold_line_break()
|
459
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
460
|
+
Character formatting extends across line breaks: **bold,
|
461
|
+
this is still bold. This line deliberately does not end in star-star.
|
462
|
+
|
463
|
+
Not bold. Character formatting does not cross paragraph boundaries.
|
464
|
+
creole
|
465
|
+
)
|
466
|
+
assert_equal_filecontent( "expected_creole/test_creole_line_break.html", creole.to_doc(:html, @opt))
|
467
|
+
assert_equal_filecontent( "expected_creole/test_creole_line_break.latex", creole.to_doc(:latex, @opt))
|
468
|
+
$log.warn('test_creole_line_break: to_context')
|
469
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_line_break.context", creole.to_doc(:context))
|
470
|
+
$log.info('test_creole_inline_bold_line_break: inline to wiki/creole')
|
471
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_line_break.creole", creole.to_doc(:creole, @opt))
|
472
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_line_break.text", creole.to_doc(:text, @opt))
|
473
|
+
end
|
474
|
+
|
475
|
+
def test_creole_inline_apostroph()
|
476
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
477
|
+
You can add text "in apostoph".
|
478
|
+
|
479
|
+
Problem may be german.sty and activated " like in "a.
|
480
|
+
It will be converted to an a-Umlaut.
|
481
|
+
creole
|
482
|
+
)
|
483
|
+
assert_equal_filecontent( "expected_creole/#{__method__}.html", creole.to_doc(:html, @opt))
|
484
|
+
assert_equal_filecontent( "expected_creole/#{__method__}.latex", creole.to_doc(:latex, @opt))
|
485
|
+
$log.warn('#{__method__}: to_context')
|
486
|
+
#~ assert_equal_filecontent( "expected_creole/#{__method__}.context", creole.to_doc(:context))
|
487
|
+
$log.info('#{__method__}_bold_em: inline to wiki/creole')
|
488
|
+
#~ assert_equal_filecontent( "expected_creole/#{__method__}.creole", creole.to_doc(:creole, @opt))
|
489
|
+
$log.warn('#{__method__}_bold_em: inline text with additional spaces')
|
490
|
+
assert_equal_filecontent( "expected_creole/#{__method__}.text", creole.to_doc(:text, @opt))
|
491
|
+
end
|
492
|
+
|
493
|
+
end #Test_creole_inline
|
494
|
+
|
495
|
+
|
496
|
+
class Test_creole_lists < MiniTest::Test
|
497
|
+
def setup()
|
498
|
+
#Avoid warnings about missing logger in to_doc
|
499
|
+
@opt = { :log => Docgenerator::DOCGENERATOR_DEFAULT_LOGGER }
|
500
|
+
end
|
501
|
+
def test_creole_list_ul()
|
502
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
503
|
+
Text before
|
504
|
+
*Listentry 1
|
505
|
+
*Listentry 2
|
506
|
+
**Listentry 2.1
|
507
|
+
**Listentry 2.2
|
508
|
+
*Listentry 3
|
509
|
+
**Listentry 3.2
|
510
|
+
|
511
|
+
|
512
|
+
* You can have
|
513
|
+
multiline list items
|
514
|
+
* this is a second multiline
|
515
|
+
list item
|
516
|
+
|
517
|
+
Text afterwords
|
518
|
+
creole
|
519
|
+
)
|
520
|
+
assert_equal_filecontent( "expected_creole/test_creole_list_ul.html", creole.to_doc(:html, @opt))
|
521
|
+
assert_equal_filecontent( "expected_creole/test_creole_list_ul.latex", creole.to_doc(:latex, @opt))
|
522
|
+
$log.warn('test_creole_list_ul: to_context')
|
523
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_list_ul.context", creole.to_doc(:context))
|
524
|
+
$log.warn('test_creole_list_ul: list to wiki/creole')
|
525
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_list_ul.creole", creole.to_doc(:creole, @opt))
|
526
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_list_ul.wiki", creole.to_doc(:wiki, @opt))
|
527
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_list_ul.text", creole.to_doc(:text, @opt))
|
528
|
+
#ruby 1.8: symbols as key, ruby 1.9: Strings
|
529
|
+
#~ omit_if( RUBY_VERSION !~ /1.9/, "Wrong ruby version #{RUBY_VERSION}"){
|
530
|
+
assert_equal_filecontent( "expected_creole/test_creole_list_ul.normsource", creole.normsource.to_yaml)
|
531
|
+
#~ }
|
532
|
+
end
|
533
|
+
#It works fine here, but LaTeX will give you an error.
|
534
|
+
def test_creole_list_ul_too_much()
|
535
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
536
|
+
Text before
|
537
|
+
*Listentry 1
|
538
|
+
*Listentry 2
|
539
|
+
**Listentry 2.1
|
540
|
+
**Listentry 2.2
|
541
|
+
***Listentry 2.2.1
|
542
|
+
****Listentry 2.2.1.1
|
543
|
+
*****Listentry 2.2.1.1.1
|
544
|
+
*Listentry 3
|
545
|
+
|
546
|
+
Text afterwords
|
547
|
+
creole
|
548
|
+
)
|
549
|
+
assert_equal_filecontent( "expected_creole/test_creole_list_ul_too_much.html", creole.to_doc(:html, @opt))
|
550
|
+
assert_equal_filecontent( "expected_creole/test_creole_list_ul_too_much.latex", creole.to_doc(:latex, @opt))
|
551
|
+
$log.warn('test_creole_list_ul_too_much: to_context')
|
552
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_list_ul_too_much.context", creole.to_doc(:context))
|
553
|
+
$log.warn('test_creole_list_ul_too_much: list to wiki/creole')
|
554
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_list_ul_too_much.creole", creole.to_doc(:creole, @opt))
|
555
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_list_ul_too_much.text", creole.to_doc(:text, @opt))
|
556
|
+
end
|
557
|
+
def test_creole_list_ol()
|
558
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
559
|
+
Text before
|
560
|
+
#Listentry 1
|
561
|
+
#Listentry 2
|
562
|
+
##Listentry 2.1
|
563
|
+
##Listentry 2.2
|
564
|
+
#Listentry 3
|
565
|
+
Text afterwords
|
566
|
+
creole
|
567
|
+
)
|
568
|
+
assert_equal_filecontent( "expected_creole/test_creole_list_ol.html", creole.to_doc(:html, @opt))
|
569
|
+
assert_equal_filecontent( "expected_creole/test_creole_list_ol.latex", creole.to_doc(:latex, @opt))
|
570
|
+
$log.warn('test_creole_list_ol: to_context')
|
571
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_list_ol.context", creole.to_doc(:context))
|
572
|
+
$log.warn('test_creole_list_ol: list to wiki/creole')
|
573
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_list_ol.creole", creole.to_doc(:creole, @opt))
|
574
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_list_ol.text", creole.to_doc(:text, @opt))
|
575
|
+
end #ol
|
576
|
+
|
577
|
+
def test_creole_list_ol_ul()
|
578
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
579
|
+
Text before
|
580
|
+
#Listentry 1
|
581
|
+
#Listentry 2
|
582
|
+
#*Listentry 2.1
|
583
|
+
#*Listentry 2.2
|
584
|
+
#Listentry 3
|
585
|
+
|
586
|
+
Text afterwords
|
587
|
+
creole
|
588
|
+
)
|
589
|
+
assert_equal_filecontent( "expected_creole/test_creole_list_ol_ul.html", creole.to_doc(:html, @opt))
|
590
|
+
assert_equal_filecontent( "expected_creole/test_creole_list_ol_ul.latex", creole.to_doc(:latex, @opt))
|
591
|
+
$log.warn('test_creole_list_ol_ul: to_context')
|
592
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_list_ol_ul.context", creole.to_doc(:context))
|
593
|
+
$log.warn('test_creole_list_ol_ul: list to wiki/creole')
|
594
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_list_ol_ul.creole", creole.to_doc(:creole, @opt))
|
595
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_list_ol_ul.text", creole.to_doc(:text, @opt))
|
596
|
+
end
|
597
|
+
|
598
|
+
def test_creole_list_ol_after_ul()
|
599
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
600
|
+
Text before
|
601
|
+
*Listentry 1
|
602
|
+
#Listentry 2
|
603
|
+
|
604
|
+
Text afterwords
|
605
|
+
creole
|
606
|
+
)
|
607
|
+
assert_equal_filecontent( "expected_creole/test_creole_list_ol_after_ul.html", creole.to_doc(:html, @opt))
|
608
|
+
assert_equal_filecontent( "expected_creole/test_creole_list_ol_after_ul.latex", creole.to_doc(:latex, @opt))
|
609
|
+
$log.warn('test_creole_list_ol_after_ul: to_context')
|
610
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_list_ol_after_ul.context", creole.to_doc(:context))
|
611
|
+
$log.warn('test_creole_list_ol_after_ul: list to wiki/creole')
|
612
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_list_ol_after_ul.creole", creole.to_doc(:creole, @opt))
|
613
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_list_ol_after_ul.text", creole.to_doc(:text, @opt))
|
614
|
+
end
|
615
|
+
|
616
|
+
def test_creole_list_ulul_without_ul()
|
617
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
618
|
+
Text before
|
619
|
+
**Listentry 1
|
620
|
+
Text afterwords
|
621
|
+
creole
|
622
|
+
)
|
623
|
+
@opt[:log] = $tmplog #Suppress error message
|
624
|
+
assert_equal_filecontent( "expected_creole/#{__method__}.html", creole.to_doc(:html, @opt))
|
625
|
+
assert_equal_filecontent( "expected_creole/#{__method__}.latex", creole.to_doc(:latex, @opt))
|
626
|
+
$log.warn("#{__method__}: to_context")
|
627
|
+
#~ assert_equal_filecontent( "expected_creole/#{__method__}.context", creole.to_doc(:context))
|
628
|
+
$log.warn("#{__method__}: list to wiki/creole")
|
629
|
+
#~ assert_equal_filecontent( "expected_creole/#{__method__}.creole", creole.to_doc(:creole, @opt))
|
630
|
+
#~ assert_equal_filecontent( "expected_creole/#{__method__}.text", creole.to_doc(:text, @opt))
|
631
|
+
end
|
632
|
+
|
633
|
+
#Line breaks will be lost.
|
634
|
+
def test_creole_ul_multiple_line()
|
635
|
+
$log.warn('test_creole_ul_multiple_line: latex: grosse textl�cken (wrap mit leerzeichen bereinigen?)')
|
636
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
637
|
+
* vorher
|
638
|
+
* text
|
639
|
+
mehr text zum item
|
640
|
+
* nachher und vorher
|
641
|
+
* text
|
642
|
+
mehr text zum item
|
643
|
+
* nachher
|
644
|
+
creole
|
645
|
+
)
|
646
|
+
assert_equal_filecontent( "expected_creole/test_creole_ul_multiple_line.html", creole.to_doc(:html, @opt))
|
647
|
+
assert_equal_filecontent( "expected_creole/test_creole_ul_multiple_line.latex", creole.to_doc(:latex, @opt))
|
648
|
+
$log.warn('test_creole_ul_multiple_line: to_context')
|
649
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_ul_multiple_line.context", creole.to_doc(:context))
|
650
|
+
$log.warn('test_creole_ul_multiple_line: list to wiki/creole')
|
651
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_ul_multiple_line.creole", creole.to_doc(:creole, @opt))
|
652
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_ul_multiple_line.text", creole.to_doc(:text, @opt)) #fixme
|
653
|
+
end
|
654
|
+
def test_creole_ul_with_bold()
|
655
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
656
|
+
You can use lists, start it at the first column for now, please...
|
657
|
+
|
658
|
+
unnumbered lists are like
|
659
|
+
* item a
|
660
|
+
* item b
|
661
|
+
* **bold item c**
|
662
|
+
Text
|
663
|
+
creole
|
664
|
+
)
|
665
|
+
assert_equal_filecontent( "expected_creole/test_creole_ul_with_bold.html", creole.to_doc(:html, @opt))
|
666
|
+
assert_equal_filecontent( "expected_creole/test_creole_ul_with_bold.latex", creole.to_doc(:latex, @opt))
|
667
|
+
$log.warn('test_creole_ul_with_bold: to_context')
|
668
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_ul_with_bold.context", creole.to_doc(:context))
|
669
|
+
$log.warn('test_creole_ul_with_bold: list to wiki/creole')
|
670
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_ul_with_bold.creole", creole.to_doc(:creole, @opt))
|
671
|
+
assert_equal_filecontent( "expected_creole/test_creole_ul_with_bold.text", creole.to_doc(:text, @opt))
|
672
|
+
end
|
673
|
+
def test_creole_ul_with_blank()
|
674
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
675
|
+
blank space is also permitted before lists like:
|
676
|
+
* item a
|
677
|
+
* item b
|
678
|
+
* item c
|
679
|
+
** item c.a
|
680
|
+
Text
|
681
|
+
creole
|
682
|
+
)
|
683
|
+
assert_equal_filecontent( "expected_creole/test_creole_ul_with_blank.html", creole.to_doc(:html, @opt))
|
684
|
+
assert_equal_filecontent( "expected_creole/test_creole_ul_with_blank.latex", creole.to_doc(:latex, @opt))
|
685
|
+
$log.warn('test_creole_ul_with_blank: to_context')
|
686
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_ul_with_blank.context", creole.to_doc(:context))
|
687
|
+
$log.warn('test_creole_ul_with_blank: list to wiki/creole')
|
688
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_ul_with_blank.creole", creole.to_doc(:creole, @opt))
|
689
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_ul_with_blank.text", creole.to_doc(:text, @opt))
|
690
|
+
end
|
691
|
+
#Check, if the second list is really a second list.
|
692
|
+
def test_creole_mix_titles_list()
|
693
|
+
creole = Docgenerator::Creole::Creole.new(
|
694
|
+
:name => 'mix_titles_list',
|
695
|
+
:content => <<creole
|
696
|
+
=Titel 1
|
697
|
+
*item 1
|
698
|
+
*item 2
|
699
|
+
=Titel 2
|
700
|
+
*item 1
|
701
|
+
*item 2
|
702
|
+
creole
|
703
|
+
)
|
704
|
+
assert_equal_filecontent( "expected_creole/test_creole_mix_titles_list.html", creole.to_doc(:html, @opt))
|
705
|
+
assert_equal_filecontent( "expected_creole/test_creole_mix_titles_list.latex", creole.to_doc(:latex, @opt))
|
706
|
+
$log.warn('test_creole_mix_titles_list: to_context')
|
707
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_mix_titles_list.context", creole.to_doc(:context))
|
708
|
+
$log.warn('test_creole_mix_titles_list: to wiki/creole')
|
709
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_mix_titles_list.creole", creole.to_doc(:creole, @opt))
|
710
|
+
assert_equal_filecontent( "expected_creole/test_creole_mix_titles_list.text", creole.to_doc(:text, @opt))
|
711
|
+
end #test_creole_mix_titles_list
|
712
|
+
|
713
|
+
end #Test_creole_List
|
714
|
+
|
715
|
+
|
716
|
+
|
717
|
+
class Test_creole_links < MiniTest::Test
|
718
|
+
def setup()
|
719
|
+
#Avoid warnings about missing logger in to_doc
|
720
|
+
@opt = { :log => Docgenerator::DOCGENERATOR_DEFAULT_LOGGER }
|
721
|
+
end
|
722
|
+
def test_creole_links_external_explizit()
|
723
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
724
|
+
Here's a external link without a description: [[http://www.wikicreole.org]].
|
725
|
+
|
726
|
+
And here's a external link with a description: [[http://www.wikicreole.org|wikicreole.org]].
|
727
|
+
creole
|
728
|
+
)
|
729
|
+
assert_equal_filecontent( "expected_creole/test_creole_links_external.html", creole.to_doc(:html, @opt))
|
730
|
+
assert_equal_filecontent( "expected_creole/test_creole_links_external.latex", creole.to_doc(:latex, @opt))
|
731
|
+
$log.warn('test_creole_links_external: to_context')
|
732
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_links_external.context", creole.to_doc(:context))
|
733
|
+
$log.warn('test_creole_links_external: to wiki/creole')
|
734
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_links_external.creole", creole.to_doc(:creole, @opt))
|
735
|
+
assert_equal_filecontent( "expected_creole/test_creole_links_external.text", creole.to_doc(:text, @opt))
|
736
|
+
end #test_creole_links_external
|
737
|
+
|
738
|
+
def test_creole_links_external_implicit()
|
739
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
740
|
+
Free links without braces should be rendered as well, like http://www.wikicreole.org/ and [[http://www.wikicreole.org/users/~example]].
|
741
|
+
|
742
|
+
See also description: http://www.wikicreole.org/wiki/Links
|
743
|
+
|
744
|
+
In case of phrase ends with . you should use explicit links like
|
745
|
+
[[http://www.wikicreole.org/users/~example]].
|
746
|
+
creole
|
747
|
+
)
|
748
|
+
assert_equal_filecontent( "expected_creole/test_creole_links_external_implicit.html", creole.to_doc(:html, @opt))
|
749
|
+
assert_equal_filecontent( "expected_creole/test_creole_links_external_implicit.latex", creole.to_doc(:latex, @opt))
|
750
|
+
$log.warn('test_creole_links_external_implicit: to_context')
|
751
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_links_external_implicit.context", creole.to_doc(:context))
|
752
|
+
$log.warn('test_creole_links_external_implicit: to wiki/creole')
|
753
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_links_external_implicit.creole", creole.to_doc(:creole, @opt))
|
754
|
+
assert_equal_filecontent( "expected_creole/test_creole_links_external_implicit.text", creole.to_doc(:text, @opt))
|
755
|
+
end #test_creole_links_external_implicit
|
756
|
+
|
757
|
+
#
|
758
|
+
#Bug 2009-10-14:
|
759
|
+
# <a href = "http:" >http:</a> <em >www.wikicreole.org/users/~example</em>
|
760
|
+
#If the very end of a text is a link, it is not detected correct
|
761
|
+
def test_creole_links_implicit_end()
|
762
|
+
creole = Docgenerator::Creole::Creole.new(
|
763
|
+
:name => 'links_implicit_end',
|
764
|
+
:content => "http://www.wikicreole.org/users/~example"
|
765
|
+
)
|
766
|
+
assert_equal_filecontent( "expected_creole/test_creole_links_implicit_end.html", creole.to_doc(:html, @opt))
|
767
|
+
assert_equal_filecontent( "expected_creole/test_creole_links_implicit_end.latex", creole.to_doc(:latex, @opt))
|
768
|
+
#~ $log.warn('test_creole_links_implicit_end: to_context')
|
769
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_links_implicit_end.context", creole.to_doc(:context))
|
770
|
+
#~ $log.warn('test_creole_links_implicit_end: to wiki/creole')
|
771
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_links_implicit_end.creole", creole.to_doc(:creole, @opt))
|
772
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_links_implicit_end.text", creole.to_doc(:text, @opt))
|
773
|
+
end #test_creole_links_implicit_end
|
774
|
+
|
775
|
+
def test_creole_links_explicit_with_em()
|
776
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
777
|
+
Be careful that italic links are rendered properly: //[[http://my.book.example/|My Book Title]]//
|
778
|
+
creole
|
779
|
+
)
|
780
|
+
assert_equal_filecontent( "expected_creole/test_creole_links_explicit_with_em.html", creole.to_doc(:html, @opt))
|
781
|
+
assert_equal_filecontent( "expected_creole/test_creole_links_explicit_with_em.latex", creole.to_doc(:latex, @opt))
|
782
|
+
$log.warn('test_creole_links_explicit_with_em: to_context')
|
783
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_links_explicit_with_em.context", creole.to_doc(:context))
|
784
|
+
$log.warn('test_creole_links_explicit_with_em: to wiki/creole')
|
785
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_links_explicit_with_em.creole", creole.to_doc(:creole, @opt))
|
786
|
+
assert_equal_filecontent( "expected_creole/test_creole_links_explicit_with_em.text", creole.to_doc(:text, @opt))
|
787
|
+
end #test_creole_links_explicit_with_em
|
788
|
+
|
789
|
+
def test_creole_links_file()
|
790
|
+
|
791
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
792
|
+
[[./#{$thisfile}]]
|
793
|
+
|
794
|
+
[[./#{$thisfile}|This unittest-source]]
|
795
|
+
creole
|
796
|
+
)
|
797
|
+
assert_equal_filecontent( "expected_creole/test_creole_links_file.html", creole.to_doc(:html, @opt))
|
798
|
+
assert_equal_filecontent( "expected_creole/test_creole_links_file.latex", creole.to_doc(:latex, @opt))
|
799
|
+
$log.warn('test_creole_links_file: to_context')
|
800
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_links_file.context", creole.to_doc(:context))
|
801
|
+
$log.warn('test_creole_links_file: to wiki/creole')
|
802
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_links_file.creole", creole.to_doc(:creole, @opt))
|
803
|
+
assert_equal_filecontent( "expected_creole/test_creole_links_file.text", creole.to_doc(:text, @opt))
|
804
|
+
end #test_creole_links_file
|
805
|
+
|
806
|
+
def test_creole_links_explicit_internal()
|
807
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
808
|
+
[[#internal]]
|
809
|
+
|
810
|
+
[[#internal|Links inside]]
|
811
|
+
creole
|
812
|
+
)
|
813
|
+
assert_equal_filecontent( "expected_creole/test_creole_links_explicit_internal.html", creole.to_doc(:html, @opt))
|
814
|
+
$log.warn('test_creole_links_explicit_internal: to latex')
|
815
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_links_explicit_internal.latex", creole.to_doc(:latex, @opt))
|
816
|
+
$log.warn('test_creole_links_explicit_internal: to_context')
|
817
|
+
#~ #~ assert_equal_filecontent( "expected_creole/test_creole_links_explicit_internal.context", creole.to_doc(:context))
|
818
|
+
$log.warn('test_creole_links_explicit_internal: to wiki/creole')
|
819
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_links_explicit_internal.creole", creole.to_doc(:creole, @opt))
|
820
|
+
assert_equal_filecontent( "expected_creole/test_creole_links_explicit_internal.text", creole.to_doc(:text, @opt))
|
821
|
+
end #test_creole_links_explicit_internal
|
822
|
+
|
823
|
+
end #Test_creole_links
|
824
|
+
|
825
|
+
|
826
|
+
class Test_creole_pictures < MiniTest::Test
|
827
|
+
def setup()
|
828
|
+
#Avoid warnings about missing logger in to_doc
|
829
|
+
@opt = { :log => Docgenerator::DOCGENERATOR_DEFAULT_LOGGER }
|
830
|
+
end
|
831
|
+
def test_creole_pictures()
|
832
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
833
|
+
This should be a flower with the ALT text "this is a flower" if your wiki supports ALT text on images:
|
834
|
+
|
835
|
+
{{Red_Flower.jpg}}
|
836
|
+
|
837
|
+
{{Red_Flower.jpg|here is a red flower}}
|
838
|
+
creole
|
839
|
+
)
|
840
|
+
assert_equal_filecontent( "expected_creole/test_creole_pictures.html", creole.to_doc(:html, @opt))
|
841
|
+
assert_equal_filecontent( "expected_creole/test_creole_pictures.latex", creole.to_doc(:latex, @opt))
|
842
|
+
$log.warn('test_creole_pictures: to_context')
|
843
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_pictures.context", creole.to_doc(:context))
|
844
|
+
$log.warn('test_creole_pictures: to wiki/creole')
|
845
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_pictures.creole", creole.to_doc(:creole, @opt))
|
846
|
+
$log.warn('test_creole_pictures: to text/creole')
|
847
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_pictures.text", creole.to_doc(:text, @opt))
|
848
|
+
end #test_creole_pictures
|
849
|
+
def test_creole_picture_link()
|
850
|
+
creole = Docgenerator::Creole::Creole.new(:name => 'Creole_picture_link',
|
851
|
+
:content => <<creole
|
852
|
+
[[./#{$thisfile}|{{Red_Flower.jpg}}]] - if you click on the image, will goto "some link"
|
853
|
+
|
854
|
+
[[http://example.com/|{{Red_Flower.jpg}}]] - same as above: picture links to url
|
855
|
+
creole
|
856
|
+
)
|
857
|
+
assert_equal_filecontent( "expected_creole/test_creole_picture_link.html", creole.to_doc(:html, @opt))
|
858
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_picture_link.latex", creole.to_doc(:latex, @opt))
|
859
|
+
$log.warn('test_creole_picture_link: to_context')
|
860
|
+
#~ #~ assert_equal_filecontent( "expected_creole/test_creole_picture_link.context", creole.to_doc(:context))
|
861
|
+
$log.warn('test_creole_picture_link: to wiki/creole')
|
862
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_picture_link.creole", creole.to_doc(:creole, @opt))
|
863
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_picture_link.text", creole.to_doc(:text, @opt))
|
864
|
+
end #test_creole_picture_link
|
865
|
+
def test_creole_pictures_css()
|
866
|
+
creole = Docgenerator::Creole::Creole.new(
|
867
|
+
:name => 'pictures_css',
|
868
|
+
:content => <<creole
|
869
|
+
{{Red_Flower.jpg|red flower|css=width:50px}}
|
870
|
+
|
871
|
+
{{Red_Flower.jpg|red flower|imgcss=width:100px}}
|
872
|
+
creole
|
873
|
+
)
|
874
|
+
assert_equal_filecontent( "expected_creole/test_creole_pictures_css.html", creole.to_doc(:html, @opt))
|
875
|
+
assert_equal_filecontent( "expected_creole/test_creole_pictures_css.latex", creole.to_doc(:latex, @opt))
|
876
|
+
$log.warn('test_creole_pictures_css: to_context')
|
877
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_pictures_css.context", creole.to_doc(:context))
|
878
|
+
$log.warn('test_creole_pictures_css: to wiki/creole')
|
879
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_pictures_css.creole", creole.to_doc(:creole, @opt))
|
880
|
+
$log.warn('test_creole_pictures_css: to text/creole')
|
881
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_pictures_css.text", creole.to_doc(:text, @opt))
|
882
|
+
end #test_creole_pictures_css
|
883
|
+
def test_creole_pictures_imgclass()
|
884
|
+
creole = Docgenerator::Creole::Creole.new(
|
885
|
+
:name => 'pictures_imgclass',
|
886
|
+
:content => <<creole
|
887
|
+
{{Red_Flower.jpg||class=test}}
|
888
|
+
|
889
|
+
{{Red_Flower.jpg||imgclass=test}}
|
890
|
+
creole
|
891
|
+
)
|
892
|
+
assert_equal_filecontent( "expected_creole/test_creole_pictures_imgclass.html", creole.to_doc(:html, @opt))
|
893
|
+
assert_equal_filecontent( "expected_creole/test_creole_pictures_imgclass.latex", creole.to_doc(:latex, @opt))
|
894
|
+
$log.warn('test_creole_pictures_imgclass: to_context')
|
895
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_pictures_imgclass.context", creole.to_doc(:context))
|
896
|
+
$log.warn('test_creole_pictures_imgclass: to wiki/creole')
|
897
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_pictures_imgclass.creole", creole.to_doc(:creole, @opt))
|
898
|
+
$log.warn('test_creole_pictures_imgclass: to text/creole')
|
899
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_pictures_imgclass.text", creole.to_doc(:text, @opt))
|
900
|
+
end #test_creole_pictures_imgclass
|
901
|
+
|
902
|
+
def test_creole_pictures_longdesc()
|
903
|
+
creole = Docgenerator::Creole::Creole.new(
|
904
|
+
:name => 'pictures_longdesc',
|
905
|
+
:content => <<creole
|
906
|
+
{{Red_Flower.jpg||longdesc=http://www.pixelio.de/details.php?image_id=405788}}
|
907
|
+
creole
|
908
|
+
)
|
909
|
+
assert_equal_filecontent( "expected_creole/test_creole_pictures_longdesc.html", creole.to_doc(:html, @opt))
|
910
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_pictures_longdesc.latex", creole.to_doc(:latex, @opt))
|
911
|
+
#~ $log.warn('test_creole_pictures_longdesc: to_context')
|
912
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_pictures_longdesc.context", creole.to_doc(:context))
|
913
|
+
$log.warn('test_creole_pictures_longdesc: to wiki/creole')
|
914
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_pictures_longdesc.creole", creole.to_doc(:creole, @opt))
|
915
|
+
$log.warn('test_creole_pictures_longdesc: to text/creole')
|
916
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_pictures_longdesc.text", creole.to_doc(:text, @opt))
|
917
|
+
end #test_creole_pictures_longdesc
|
918
|
+
|
919
|
+
def test_creole_pictures_width()
|
920
|
+
creole = Docgenerator::Creole::Creole.new(
|
921
|
+
:name => 'pictures_width',
|
922
|
+
:content => <<creole
|
923
|
+
{{Red_Flower.jpg||width=\\textwidth|css=width:100%}}
|
924
|
+
creole
|
925
|
+
)
|
926
|
+
assert_equal_filecontent( "expected_creole/test_creole_pictures_width.html", creole.to_doc(:html, @opt))
|
927
|
+
assert_equal_filecontent( "expected_creole/test_creole_pictures_width.latex", creole.to_doc(:latex, @opt))
|
928
|
+
#~ $log.warn('test_creole_pictures_width: to_context')
|
929
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_pictures_width.context", creole.to_doc(:context))
|
930
|
+
$log.warn('test_creole_pictures_width: to wiki/creole')
|
931
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_pictures_width.creole", creole.to_doc(:creole, @opt))
|
932
|
+
$log.warn('test_creole_pictures_width: to text/creole')
|
933
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_pictures_width.text", creole.to_doc(:text, @opt))
|
934
|
+
end #test_creole_pictures_width
|
935
|
+
|
936
|
+
end #Test_creole_pictures
|
937
|
+
|
938
|
+
|
939
|
+
class Test_creole_verbatim < MiniTest::Test
|
940
|
+
def setup()
|
941
|
+
#Avoid warnings about missing logger in to_doc
|
942
|
+
@opt = { :log => Docgenerator::DOCGENERATOR_DEFAULT_LOGGER }
|
943
|
+
end
|
944
|
+
def test_creole_verbatim()
|
945
|
+
creole = Docgenerator::Creole::Creole.new( :name => 'creole_verbatim',
|
946
|
+
:content => <<creole
|
947
|
+
You can use nowiki syntax if you would like do stuff like this:
|
948
|
+
|
949
|
+
{{{
|
950
|
+
Guitar Chord C:
|
951
|
+
|
952
|
+
||---|---|---|
|
953
|
+
||-0-|---|---|
|
954
|
+
||---|---|---|
|
955
|
+
||---|-0-|---|
|
956
|
+
||---|---|-0-|
|
957
|
+
||---|---|---|
|
958
|
+
}}}
|
959
|
+
|
960
|
+
before
|
961
|
+
{{{
|
962
|
+
This is some verbatim text
|
963
|
+
}}}
|
964
|
+
after
|
965
|
+
|
966
|
+
See [[http://www.wikicreole.org/wiki/PreformattedAndNowiki]]
|
967
|
+
creole
|
968
|
+
)
|
969
|
+
assert_equal_filecontent( "expected_creole/test_creole_verbatim.html", creole.to_doc(:html, @opt))
|
970
|
+
assert_equal_filecontent( "expected_creole/test_creole_verbatim.latex", creole.to_doc(:latex, @opt))
|
971
|
+
$log.warn('test_creole_verbatim: to_context')
|
972
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_verbatim.context", creole.to_doc(:context))
|
973
|
+
$log.warn('test_creole_verbatim: change < to < ....')
|
974
|
+
$log.warn('test_creole_verbatim: to wiki/creole')
|
975
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_verbatim.creole", creole.to_doc(:creole, @opt))
|
976
|
+
assert_equal_filecontent( "expected_creole/test_creole_verbatim.text", creole.to_doc(:text, @opt))
|
977
|
+
end #test_creole_verbatim
|
978
|
+
def test_creole_verbatim_inline()
|
979
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
980
|
+
|
981
|
+
You can also use inline nowiki {{{ in a sentence }}} like this.
|
982
|
+
See [[http://www.wikicreole.org/wiki/PreformattedAndNowiki]].
|
983
|
+
|
984
|
+
Some examples of markup are: {{{** <i>this</i> ** }}}
|
985
|
+
creole
|
986
|
+
)
|
987
|
+
assert_equal_filecontent( "expected_creole/test_creole_verbatim_inline.html", creole.to_doc(:html, @opt))
|
988
|
+
assert_equal_filecontent( "expected_creole/test_creole_verbatim_inline.latex", creole.to_doc(:latex, @opt))
|
989
|
+
$log.warn('test_creole_verbatim_inline: to_context')
|
990
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_verbatim_inline.context", creole.to_doc(:context))
|
991
|
+
$log.warn('test_creole_verbatim_inline: to wiki/creole')
|
992
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_verbatim_inline.creole", creole.to_doc(:creole, @opt))
|
993
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_verbatim_inline.text", creole.to_doc(:text, @opt))
|
994
|
+
end #test_creole_verbatim_inline
|
995
|
+
def test_creole_verbatim_inline_at_start()
|
996
|
+
creole = Docgenerator::Creole::Creole.new(
|
997
|
+
:name => 'verbatim_inline_at_start',
|
998
|
+
:content => <<creole
|
999
|
+
Short verbatim can also be at the start:
|
1000
|
+
{{{this is verbatim}}}
|
1001
|
+
|
1002
|
+
This test checks, if the differences of normal verbatim is detected.
|
1003
|
+
creole
|
1004
|
+
)
|
1005
|
+
assert_equal_filecontent( "expected_creole/test_creole_verbatim_inline_at_start.html", creole.to_doc(:html, @opt))
|
1006
|
+
assert_equal_filecontent( "expected_creole/test_creole_verbatim_inline_at_start.latex", creole.to_doc(:latex, @opt))
|
1007
|
+
$log.warn('test_creole_verbatim_inline_at_start: to_context')
|
1008
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_verbatim_inline_at_start.context", creole.to_doc(:context))
|
1009
|
+
$log.warn('test_creole_verbatim_inline_at_start: to wiki/creole')
|
1010
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_verbatim_inline_at_start.creole", creole.to_doc(:creole, @opt))
|
1011
|
+
$log.warn('test_creole_verbatim_inline_at_start: to text/creole')
|
1012
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_verbatim_inline_at_start.text", creole.to_doc(:text, @opt))
|
1013
|
+
end #test_creole_verbatim_inline_at_start
|
1014
|
+
|
1015
|
+
end #Test_creole_verbatim
|
1016
|
+
|
1017
|
+
|
1018
|
+
class Test_creole_footnote < MiniTest::Test
|
1019
|
+
def setup()
|
1020
|
+
#Avoid warnings about missing logger in to_doc
|
1021
|
+
@opt = { :log => Docgenerator::DOCGENERATOR_DEFAULT_LOGGER }
|
1022
|
+
end
|
1023
|
+
def test_creole_footnotes()
|
1024
|
+
creole = Docgenerator::Creole::Creole.new(
|
1025
|
+
:name => 'footnotes',
|
1026
|
+
:content => <<creole
|
1027
|
+
<<footnote|This is a footnote>>
|
1028
|
+
----
|
1029
|
+
<<footnotes>>
|
1030
|
+
creole
|
1031
|
+
)
|
1032
|
+
assert_equal_filecontent( "expected_creole/test_creole_footnotes.html", creole.to_doc(:html, @opt))
|
1033
|
+
assert_equal_filecontent( "expected_creole/test_creole_footnotes.latex", creole.to_doc(:latex, @opt))
|
1034
|
+
$log.warn('test_creole_footnotes: to_context')
|
1035
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_footnotes.context", creole.to_doc(:context))
|
1036
|
+
$log.warn('test_creole_footnotes: to wiki/creole')
|
1037
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_footnotes.creole", creole.to_doc(:creole, @opt))
|
1038
|
+
$log.warn('test_creole_footnotes: to text/creole')
|
1039
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_footnotes.text", creole.to_doc(:text, @opt))
|
1040
|
+
end #test_creole_footnotes
|
1041
|
+
def test_creole_footnotes_label()
|
1042
|
+
creole = Docgenerator::Creole::Creole.new(
|
1043
|
+
:name => 'footnotes_label',
|
1044
|
+
:content => <<creole
|
1045
|
+
<<footnote|This is a footnote|label=s>>
|
1046
|
+
This makes only sense in HTML
|
1047
|
+
----
|
1048
|
+
<<footnotes>>
|
1049
|
+
creole
|
1050
|
+
)
|
1051
|
+
assert_equal_filecontent( "expected_creole/#{__method__}.html", creole.to_doc(:html, @opt))
|
1052
|
+
#~ assert_equal_filecontent( "expected_creole/#{__method__}.latex", creole.to_doc(:latex, @opt))
|
1053
|
+
#~ $log.warn('test_creole_footnotes_label: to_context')
|
1054
|
+
#~ #~ assert_equal_filecontent( "expected_creole/#{__method__}.context", creole.to_doc(:context))
|
1055
|
+
#~ $log.warn('test_creole_footnotes_label: to wiki/creole')
|
1056
|
+
#~ assert_equal_filecontent( "expected_creole/#{__method__}.creole", creole.to_doc(:creole, @opt))
|
1057
|
+
#~ $log.warn('test_creole_footnotes_label: to text/creole')
|
1058
|
+
#~ assert_equal_filecontent( "expected_creole/#{__method__}.text", creole.to_doc(:text, @opt))
|
1059
|
+
end #test_creole_footnotes_label
|
1060
|
+
|
1061
|
+
def test_creole_footnotes_groupid()
|
1062
|
+
creole = Docgenerator::Creole::Creole.new(
|
1063
|
+
:name => 'footnotes_group',
|
1064
|
+
:content => <<creole
|
1065
|
+
Text<<footnote|This is a footnote|>>
|
1066
|
+
more text<<footnote|This is a footnote in group g1|groupid=g1>>
|
1067
|
+
----
|
1068
|
+
<<footnotes>>
|
1069
|
+
----
|
1070
|
+
<<footnotes|g1>>
|
1071
|
+
creole
|
1072
|
+
)
|
1073
|
+
assert_equal_filecontent( "expected_creole/#{__method__}.html", creole.to_doc(:html, @opt))
|
1074
|
+
#~ assert_equal_filecontent( "expected_creole/#{__method__}.latex", creole.to_doc(:latex, @opt))
|
1075
|
+
#~ $log.warn('test_creole_footnotes_label: to_context')
|
1076
|
+
#~ #~ assert_equal_filecontent( "expected_creole/#{__method__}.context", creole.to_doc(:context))
|
1077
|
+
#~ $log.warn('test_creole_footnotes_label: to wiki/creole')
|
1078
|
+
#~ assert_equal_filecontent( "expected_creole/#{__method__}l.creole", creole.to_doc(:creole, @opt))
|
1079
|
+
#~ $log.warn('test_creole_footnotes_label: to text/creole')
|
1080
|
+
#~ assert_equal_filecontent( "expected_creole/#{__method__}.text", creole.to_doc(:text, @opt))
|
1081
|
+
end #test_creole_footnotes_label
|
1082
|
+
=begin rdoc
|
1083
|
+
Footnotes in tabulars don't work.
|
1084
|
+
=end
|
1085
|
+
def test_creole_footnotes_in_tabular()
|
1086
|
+
return
|
1087
|
+
#check for warning?
|
1088
|
+
|
1089
|
+
creole = Docgenerator::Creole::Creole.new(
|
1090
|
+
:name => 'footnotes',
|
1091
|
+
:content => <<creole
|
1092
|
+
<<<tabular
|
1093
|
+
|!columns=1
|
1094
|
+
|<<footnote|This is a footnote>>
|
1095
|
+
>>>
|
1096
|
+
----
|
1097
|
+
<<footnotes>>
|
1098
|
+
creole
|
1099
|
+
)
|
1100
|
+
$log.warn('test_creole_footnotes_in_tabular: html')
|
1101
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_footnotes_in_tabular.html", creole.to_doc(:html, @opt))
|
1102
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_footnotes_in_tabular.latex", creole.to_doc(:latex, @opt))
|
1103
|
+
#~ $log.warn('test_creole_footnotes_in_tabular: to_context')
|
1104
|
+
#~ #~ assert_equal_filecontent( "expected_creole/test_creole_footnotes_in_tabular.context", creole.to_doc(:context))
|
1105
|
+
#~ $log.warn('test_creole_footnotes_in_tabular: to wiki/creole')
|
1106
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_footnotes_in_tabular.creole", creole.to_doc(:creole, @opt))
|
1107
|
+
#~ $log.warn('test_creole_footnotes_in_tabular: to text/creole')
|
1108
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_footnotes_in_tabular.text", creole.to_doc(:text, @opt))
|
1109
|
+
end #test_creole_footnotes_in_tabular
|
1110
|
+
end #Test_creole_footnote
|
1111
|
+
|
1112
|
+
class Test_creole_short_html < MiniTest::Test
|
1113
|
+
def setup()
|
1114
|
+
#Avoid warnings about missing logger in to_doc
|
1115
|
+
@opt = { :log => Docgenerator::DOCGENERATOR_DEFAULT_LOGGER }
|
1116
|
+
end
|
1117
|
+
def test_creole_short_html()
|
1118
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
1119
|
+
before
|
1120
|
+
{{html|<em>this is only for HTML</em>}}
|
1121
|
+
after
|
1122
|
+
creole
|
1123
|
+
)
|
1124
|
+
#Really like this? Or should there be no paragraph?
|
1125
|
+
assert_equal_filecontent( "expected_creole/test_creole_short_html.html", creole.to_doc(:html, @opt))
|
1126
|
+
assert_equal_filecontent( "expected_creole/test_creole_short_html.latex", creole.to_doc(:latex, @opt))
|
1127
|
+
$log.warn('test_creole_short_html: to_context')
|
1128
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_short_html.context", creole.to_doc(:context))
|
1129
|
+
$log.warn('test_creole_short_html: to wiki/creole')
|
1130
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_short_html.creole", creole.to_doc(:creole, @opt))
|
1131
|
+
assert_equal_filecontent( "expected_creole/test_creole_short_html.text", creole.to_doc(:text, @opt))
|
1132
|
+
end #test_creole_short_html
|
1133
|
+
end #Test_creole_short_html
|
1134
|
+
|
1135
|
+
|
1136
|
+
class Test_creole_characters < MiniTest::Test
|
1137
|
+
def setup()
|
1138
|
+
#Avoid warnings about missing logger in to_doc
|
1139
|
+
@opt = { :log => Docgenerator::DOCGENERATOR_DEFAULT_LOGGER }
|
1140
|
+
end
|
1141
|
+
def test_creole_characters_all()
|
1142
|
+
creole = Docgenerator::Creole::Creole.new(
|
1143
|
+
:name => 'characters_all',
|
1144
|
+
#~ :content => Creole::CHARACTERS.keys.sort.map{|char| "*#{char}" }.join("\n")
|
1145
|
+
:content => Docgenerator::Creole::CHARACTERS.sort.map{|char, o| "* #{o.class}: #{char}"}.join("\n")
|
1146
|
+
)
|
1147
|
+
assert_equal_filecontent( "expected_creole/test_creole_characters_all.html", creole.to_doc(:html, @opt))
|
1148
|
+
|
1149
|
+
$log.warn('test_creole_characters_all: to_latex Dollar Missing escape mechanism')
|
1150
|
+
assert_equal_filecontent( "expected_creole/test_creole_characters_all.latex", creole.to_doc(:latex, @opt))
|
1151
|
+
$log.warn('test_creole_characters_all: to_context')
|
1152
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_characters_all.context", creole.to_doc(:context))
|
1153
|
+
$log.warn('test_creole_characters_all: to wiki/creole')
|
1154
|
+
#~ assert_equal(creole.source.join , creole.to_doc(:creole, @opt))
|
1155
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_characters_all.creole", creole.source.join)
|
1156
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_characters_all.creole", creole.to_doc(:creole, @opt))
|
1157
|
+
$log.warn('test_creole_characters_all: to text/creole')
|
1158
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_characters_all.text", creole.to_doc(:text, @opt))
|
1159
|
+
end #test_creole_characters_all
|
1160
|
+
def test_creole_characters_special()
|
1161
|
+
creole = Docgenerator::Creole::Creole.new(
|
1162
|
+
:name => 'characters_special',
|
1163
|
+
:content => <<creole
|
1164
|
+
Special Characters:
|
1165
|
+
*$ - Dollar
|
1166
|
+
*% - Percent
|
1167
|
+
*=> Rightarrow
|
1168
|
+
*-> rightarrow
|
1169
|
+
*_ Underscore
|
1170
|
+
creole
|
1171
|
+
)
|
1172
|
+
assert_equal_filecontent( "expected_creole/test_creole_characters_special.html", creole.to_doc(:html, @opt))
|
1173
|
+
assert_equal_filecontent( "expected_creole/test_creole_characters_special.latex", creole.to_doc(:latex, @opt))
|
1174
|
+
$log.warn('test_creole_characters_special: to_context')
|
1175
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_characters_special.context", creole.to_doc(:context))
|
1176
|
+
$log.warn('test_creole_characters_special: to wiki/creole')
|
1177
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_characters_special.creole", creole.to_doc(:creole, @opt))
|
1178
|
+
$log.warn('test_creole_characters_special: to text/creole')
|
1179
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_characters_special.text", creole.to_doc(:text, @opt))
|
1180
|
+
end #test_creole_characters_special
|
1181
|
+
|
1182
|
+
#This is also a test for multiple inclusions in one line.
|
1183
|
+
def test_creole_shy()
|
1184
|
+
creole = Docgenerator::Creole::Creole.new(
|
1185
|
+
:name => 'shy',
|
1186
|
+
:content => <<creole
|
1187
|
+
Donau{{shy}}dampf{{shy}}schiff{{shy}}fahrt
|
1188
|
+
|
1189
|
+
Donau{{-}}dampf{{-}}schiff{{-}}fahrt
|
1190
|
+
creole
|
1191
|
+
)
|
1192
|
+
assert_equal_filecontent( "expected_creole/test_creole_shy.html", creole.to_doc(:html, @opt))
|
1193
|
+
assert_equal_filecontent( "expected_creole/test_creole_shy.latex", creole.to_doc(:latex, @opt))
|
1194
|
+
$log.warn('test_creole_shy: to_context')
|
1195
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_shy.context", creole.to_doc(:context))
|
1196
|
+
assert_equal_filecontent( "expected_creole/test_creole_shy.creole", creole.to_doc(:creole, @opt))
|
1197
|
+
assert_equal_filecontent( "expected_creole/test_creole_shy.text", creole.to_doc(:text, @opt))
|
1198
|
+
end #test_creole_shy
|
1199
|
+
|
1200
|
+
end #Test_creole_characters
|
1201
|
+
|
1202
|
+
class Test_creole_inline_ruby < MiniTest::Test
|
1203
|
+
def setup()
|
1204
|
+
#Avoid warnings about missing logger in to_doc
|
1205
|
+
@opt = { :log => Docgenerator::DOCGENERATOR_DEFAULT_LOGGER }
|
1206
|
+
end
|
1207
|
+
def self.ruby_test()
|
1208
|
+
return '*hallo welt'
|
1209
|
+
end
|
1210
|
+
def test_creole_inline_ruby_raw()
|
1211
|
+
creole = Docgenerator::Creole::Creole.new(
|
1212
|
+
:name => 'inline_ruby_raw',
|
1213
|
+
:content => <<creole
|
1214
|
+
The following Rubycode is added as raw text.
|
1215
|
+
1 + 1 = <<ruby_raw|1+1>>
|
1216
|
+
|
1217
|
+
<<ruby_raw|Test_creole_inline_ruby::ruby_test>>
|
1218
|
+
creole
|
1219
|
+
)
|
1220
|
+
assert_equal_filecontent( "expected_creole/test_creole_inline_ruby_raw.html", creole.to_doc(:html, @opt))
|
1221
|
+
assert_equal_filecontent( "expected_creole/test_creole_inline_ruby_raw.latex", creole.to_doc(:latex, @opt))
|
1222
|
+
$log.warn('test_creole_inline_ruby_raw: to_context')
|
1223
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_inline_ruby_raw.context", creole.to_doc(:context))
|
1224
|
+
$log.warn('test_creole_inline_ruby_raw: to wiki/creole')
|
1225
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_inline_ruby_raw.creole", creole.to_doc(:creole, @opt))
|
1226
|
+
$log.warn('test_creole_inline_ruby_raw: to text/creole')
|
1227
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_inline_ruby_raw.text", creole.to_doc(:text, @opt))
|
1228
|
+
end #test_creole_inline_ruby_raw
|
1229
|
+
def test_creole_inline_ruby()
|
1230
|
+
creole = Docgenerator::Creole::Creole.new(
|
1231
|
+
:name => 'inline_ruby',
|
1232
|
+
:content => <<creole
|
1233
|
+
The following ruby code is added and parsed by the wiki.
|
1234
|
+
*1 + 1 = <<ruby|1+1>>
|
1235
|
+
<<ruby|Test_creole_inline_ruby::ruby_test>>
|
1236
|
+
creole
|
1237
|
+
)
|
1238
|
+
assert_equal_filecontent( "expected_creole/test_creole_inline_ruby.html", creole.to_doc(:html, @opt))
|
1239
|
+
assert_equal_filecontent( "expected_creole/test_creole_inline_ruby.latex", creole.to_doc(:latex, @opt))
|
1240
|
+
$log.warn('test_creole_inline_ruby: to_context')
|
1241
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_inline_ruby.context", creole.to_doc(:context))
|
1242
|
+
$log.warn('test_creole_inline_ruby: to wiki/creole')
|
1243
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_inline_ruby.creole", creole.to_doc(:creole, @opt))
|
1244
|
+
$log.warn('test_creole_inline_ruby: to text/creole')
|
1245
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_inline_ruby.text", creole.to_doc(:text, @opt))
|
1246
|
+
end #test_creole_inline_ruby
|
1247
|
+
def test_creole_countdown()
|
1248
|
+
creole = Docgenerator::Creole::Creole.new(
|
1249
|
+
:name => 'countdown',
|
1250
|
+
:content => <<creole
|
1251
|
+
Countdown: <<ruby_raw|(1..10).to_a.reverse.join("-")>>
|
1252
|
+
creole
|
1253
|
+
)
|
1254
|
+
assert_equal_filecontent( "expected_creole/test_creole_countdown.html", creole.to_doc(:html, @opt))
|
1255
|
+
assert_equal_filecontent( "expected_creole/test_creole_countdown.latex", creole.to_doc(:latex, @opt))
|
1256
|
+
$log.warn('test_creole_countdown: to_context')
|
1257
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_countdown.context", creole.to_doc(:context))
|
1258
|
+
$log.warn('test_creole_countdown: to wiki/creole')
|
1259
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_countdown.creole", creole.to_doc(:creole, @opt))
|
1260
|
+
$log.warn('test_creole_countdown: to text/creole')
|
1261
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_countdown.text", creole.to_doc(:text, @opt))
|
1262
|
+
end #test_creole_countdown
|
1263
|
+
|
1264
|
+
end #Test_creole_inline_ruby
|
1265
|
+
|
1266
|
+
class Test_creole_ignore < MiniTest::Test
|
1267
|
+
def setup()
|
1268
|
+
#Avoid warnings about missing logger in to_doc
|
1269
|
+
@opt = { :log => Docgenerator::DOCGENERATOR_DEFAULT_LOGGER }
|
1270
|
+
end
|
1271
|
+
def test_creole_ignore()
|
1272
|
+
creole = Docgenerator::Creole::Creole.new(
|
1273
|
+
:name => 'ignore',
|
1274
|
+
:ignore => /^#~.*$/,
|
1275
|
+
:log => $tmplog, #catch info about comment
|
1276
|
+
:content => <<creole
|
1277
|
+
Text
|
1278
|
+
#~ this is a comment
|
1279
|
+
more text
|
1280
|
+
creole
|
1281
|
+
)
|
1282
|
+
assert_equal_filecontent( "expected_creole/test_creole_ignore.html", creole.to_doc(:html, @opt))
|
1283
|
+
assert_equal_filecontent( "expected_creole/test_creole_ignore.latex", creole.to_doc(:latex, @opt))
|
1284
|
+
$log.warn('test_creole_ignore: to_context')
|
1285
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_ignore.context", creole.to_doc(:context))
|
1286
|
+
$log.warn('test_creole_ignore: to wiki/creole')
|
1287
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_ignore.creole", creole.to_doc(:creole, @opt))
|
1288
|
+
assert_equal_filecontent( "expected_creole/test_creole_ignore.text", creole.to_doc(:text, @opt))
|
1289
|
+
end #test_creole_ignore
|
1290
|
+
|
1291
|
+
def test_creole_comment()
|
1292
|
+
creole = Docgenerator::Creole::Creole.new(
|
1293
|
+
:name => 'comment',
|
1294
|
+
:content => <<creole
|
1295
|
+
==Titel 1==
|
1296
|
+
Text
|
1297
|
+
<<<comment
|
1298
|
+
This is a comment.
|
1299
|
+
It's part of the document, but not visible to readers.
|
1300
|
+
>>>
|
1301
|
+
Text after
|
1302
|
+
creole
|
1303
|
+
)
|
1304
|
+
assert_equal_filecontent( "expected_creole/test_creole_comment.html", creole.to_doc(:html, @opt))
|
1305
|
+
assert_equal_filecontent( "expected_creole/test_creole_comment.latex", creole.to_doc(:latex, @opt))
|
1306
|
+
assert_equal_filecontent( "expected_creole/test_creole_comment.context", creole.to_doc(:context))
|
1307
|
+
assert_equal_filecontent( "expected_creole/test_creole_comment.creole", creole.to_doc(:creole, @opt))
|
1308
|
+
#~ assert_raise( RuntimeError ) { creole.to_doc(:text, @opt) }
|
1309
|
+
$log.warn('test_creole_comment: to text')
|
1310
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_comment.text", creole.to_doc(:text, @opt))
|
1311
|
+
end #test_creole_comment
|
1312
|
+
|
1313
|
+
end #Test_creole_ignore
|
1314
|
+
|
1315
|
+
|
1316
|
+
def newtest(text, with_class = false )
|
1317
|
+
code = ''
|
1318
|
+
code << "class Test_creole_#{text} < MiniTest::Test\n" if with_class
|
1319
|
+
code << <<code
|
1320
|
+
def test_creole_#{text}()
|
1321
|
+
creole = Docgenerator::Creole::Creole.new(
|
1322
|
+
:name => '#{text}',
|
1323
|
+
:content => <<creole
|
1324
|
+
==Titel 1==
|
1325
|
+
Text
|
1326
|
+
creole
|
1327
|
+
)
|
1328
|
+
assert_equal_filecontent( "expected_creole/test_creole_#{text}.html", creole.to_doc(:html, @opt))
|
1329
|
+
assert_equal_filecontent( "expected_creole/test_creole_#{text}.latex", creole.to_doc(:latex, @opt))
|
1330
|
+
$log.warn('test_creole_#{text}: to_context')
|
1331
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_#{text}.context", creole.to_doc(:context))
|
1332
|
+
$log.warn('test_creole_#{text}: to wiki/creole')
|
1333
|
+
assert_equal_filecontent( "expected_creole/test_creole_#{text}.creole", creole.to_doc(:creole, @opt))
|
1334
|
+
assert_equal_filecontent( "expected_creole/test_creole_#{text}.text", creole.to_doc(:text, @opt))
|
1335
|
+
end #test_creole_#{text}
|
1336
|
+
code
|
1337
|
+
code << "end #Test_creole_#{text}\n" if with_class
|
1338
|
+
puts code
|
1339
|
+
end
|
1340
|
+
#~ newtest('links_implicit_end')
|
1341
|
+
#~ newtest('tabular', true)
|
1342
|
+
#~ newtest('comment')
|
1343
|
+
#~ newtest('ignore', true)
|
1344
|
+
|
1345
|
+
__END__
|
1346
|
+
= Escapes =
|
1347
|
+
Normal Link: http://wikicreole.org/ - now same link, but escaped: ~http://wikicreole.org/
|
1348
|
+
|
1349
|
+
Normal asterisks: ~**not bold~**
|
1350
|
+
|
1351
|
+
a tilde alone: ~
|
1352
|
+
|
1353
|
+
a tilde escapes itself: ~~xxx
|
1354
|
+
|
1355
|
+
--------------------------------------------
|
1356
|
+
Meine Erweiterungen
|
1357
|
+
--------------------------------------------
|
1358
|
+
|
1359
|
+
def test_creole_amazon()
|
1360
|
+
creole = Docgenerator::Creole::Creole.new(:content => <<creole
|
1361
|
+
{{amazon|asin=B000AFEJAM}}
|
1362
|
+
|
1363
|
+
{{amazon|asin=B000AFEJAM|right}}
|
1364
|
+
creole
|
1365
|
+
)
|
1366
|
+
assert_equal_filecontent( "expected_creole/test_creole_amazon.html", creole.to_doc(:html, @opt))
|
1367
|
+
assert_equal_filecontent( "expected_creole/test_creole_amazon.latex", creole.to_doc(:latex, @opt))
|
1368
|
+
$log.warn('test_creole_amazon: to_context')
|
1369
|
+
#~ assert_equal_filecontent( "expected_creole/test_creole_amazon.context", creole.to_doc(:context))
|
1370
|
+
assert_equal_filecontent( "expected_creole/test_creole_amazon.creole", creole.to_doc(:creole, @opt))
|
1371
|
+
assert_equal_filecontent( "expected_creole/test_creole_amazon.text", creole.to_doc(:text, @opt))
|
1372
|
+
end
|
1373
|
+
|
1374
|
+
Option :ignore
|
1375
|
+
|
1376
|
+
---------
|
1377
|
+
neue Ideen
|
1378
|
+
#~ {{{div:css=sss
|
1379
|
+
#~ {{{p:css=sss
|