rpeg-multimarkdown 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. data/LICENSE +94 -0
  2. data/README.markdown +58 -0
  3. data/Rakefile +171 -0
  4. data/bin/rpeg-multimarkdown +128 -0
  5. data/ext/extconf.h +3 -0
  6. data/ext/extconf.rb +15 -0
  7. data/ext/markdown.c +88 -0
  8. data/ext/markdown_lib.c +211 -0
  9. data/ext/markdown_lib.h +28 -0
  10. data/ext/markdown_output.c +2704 -0
  11. data/ext/markdown_parser.c +8275 -0
  12. data/ext/markdown_peg.h +142 -0
  13. data/ext/odf.c +179 -0
  14. data/ext/odf.h +3 -0
  15. data/ext/parsing_functions.c +182 -0
  16. data/ext/utility_functions.c +535 -0
  17. data/lib/multimarkdown.rb +1 -0
  18. data/lib/peg_multimarkdown.rb +74 -0
  19. data/test/MultiMarkdownTest/BeamerTests/Beamer-Tables.html +76 -0
  20. data/test/MultiMarkdownTest/BeamerTests/Beamer-Tables.tex +64 -0
  21. data/test/MultiMarkdownTest/BeamerTests/Beamer-Tables.text +38 -0
  22. data/test/MultiMarkdownTest/MarkdownTest.pl +182 -0
  23. data/test/MultiMarkdownTest/MemoirTests/Automatic Labels.html +42 -0
  24. data/test/MultiMarkdownTest/MemoirTests/Automatic Labels.tex +47 -0
  25. data/test/MultiMarkdownTest/MemoirTests/Automatic Labels.text +46 -0
  26. data/test/MultiMarkdownTest/MemoirTests/Base Header Level.html +20 -0
  27. data/test/MultiMarkdownTest/MemoirTests/Base Header Level.tex +19 -0
  28. data/test/MultiMarkdownTest/MemoirTests/Base Header Level.text +16 -0
  29. data/test/MultiMarkdownTest/MemoirTests/BibTeX.html +17 -0
  30. data/test/MultiMarkdownTest/MemoirTests/BibTeX.tex +12 -0
  31. data/test/MultiMarkdownTest/MemoirTests/BibTeX.text +11 -0
  32. data/test/MultiMarkdownTest/MemoirTests/Citations.html +63 -0
  33. data/test/MultiMarkdownTest/MemoirTests/Citations.tex +48 -0
  34. data/test/MultiMarkdownTest/MemoirTests/Citations.text +43 -0
  35. data/test/MultiMarkdownTest/MemoirTests/Definition Lists.html +61 -0
  36. data/test/MultiMarkdownTest/MemoirTests/Definition Lists.tex +63 -0
  37. data/test/MultiMarkdownTest/MemoirTests/Definition Lists.text +40 -0
  38. data/test/MultiMarkdownTest/MemoirTests/Dutch.html +23 -0
  39. data/test/MultiMarkdownTest/MemoirTests/Dutch.tex +18 -0
  40. data/test/MultiMarkdownTest/MemoirTests/Dutch.text +17 -0
  41. data/test/MultiMarkdownTest/MemoirTests/Email.html +48 -0
  42. data/test/MultiMarkdownTest/MemoirTests/Email.tex +61 -0
  43. data/test/MultiMarkdownTest/MemoirTests/Email.text +32 -0
  44. data/test/MultiMarkdownTest/MemoirTests/English.html +23 -0
  45. data/test/MultiMarkdownTest/MemoirTests/English.tex +18 -0
  46. data/test/MultiMarkdownTest/MemoirTests/English.text +17 -0
  47. data/test/MultiMarkdownTest/MemoirTests/Footnotes.html +47 -0
  48. data/test/MultiMarkdownTest/MemoirTests/Footnotes.tex +28 -0
  49. data/test/MultiMarkdownTest/MemoirTests/Footnotes.text +26 -0
  50. data/test/MultiMarkdownTest/MemoirTests/French.html +23 -0
  51. data/test/MultiMarkdownTest/MemoirTests/French.tex +18 -0
  52. data/test/MultiMarkdownTest/MemoirTests/French.text +17 -0
  53. data/test/MultiMarkdownTest/MemoirTests/German.html +23 -0
  54. data/test/MultiMarkdownTest/MemoirTests/German.tex +18 -0
  55. data/test/MultiMarkdownTest/MemoirTests/German.text +17 -0
  56. data/test/MultiMarkdownTest/MemoirTests/GermanGuillemets.html +23 -0
  57. data/test/MultiMarkdownTest/MemoirTests/GermanGuillemets.tex +18 -0
  58. data/test/MultiMarkdownTest/MemoirTests/GermanGuillemets.text +17 -0
  59. data/test/MultiMarkdownTest/MemoirTests/Glossary.html +47 -0
  60. data/test/MultiMarkdownTest/MemoirTests/Glossary.tex +30 -0
  61. data/test/MultiMarkdownTest/MemoirTests/Glossary.text +29 -0
  62. data/test/MultiMarkdownTest/MemoirTests/Line Breaks.html +21 -0
  63. data/test/MultiMarkdownTest/MemoirTests/Line Breaks.tex +16 -0
  64. data/test/MultiMarkdownTest/MemoirTests/Line Breaks.text +16 -0
  65. data/test/MultiMarkdownTest/MemoirTests/Link Attributes.html +40 -0
  66. data/test/MultiMarkdownTest/MemoirTests/Link Attributes.tex +61 -0
  67. data/test/MultiMarkdownTest/MemoirTests/Link Attributes.text +51 -0
  68. data/test/MultiMarkdownTest/MemoirTests/Math.html +22 -0
  69. data/test/MultiMarkdownTest/MemoirTests/Math.tex +16 -0
  70. data/test/MultiMarkdownTest/MemoirTests/Math.text +16 -0
  71. data/test/MultiMarkdownTest/MemoirTests/Memoir Mode.html +24 -0
  72. data/test/MultiMarkdownTest/MemoirTests/Memoir Mode.tex +23 -0
  73. data/test/MultiMarkdownTest/MemoirTests/Memoir Mode.text +20 -0
  74. data/test/MultiMarkdownTest/MemoirTests/MetaData.html +22 -0
  75. data/test/MultiMarkdownTest/MemoirTests/MetaData.tex +14 -0
  76. data/test/MultiMarkdownTest/MemoirTests/MetaData.text +15 -0
  77. data/test/MultiMarkdownTest/MemoirTests/Sanity.html +100 -0
  78. data/test/MultiMarkdownTest/MemoirTests/Sanity.tex +101 -0
  79. data/test/MultiMarkdownTest/MemoirTests/Sanity.text +78 -0
  80. data/test/MultiMarkdownTest/MemoirTests/SmartQuotes.html +26 -0
  81. data/test/MultiMarkdownTest/MemoirTests/SmartQuotes.tex +21 -0
  82. data/test/MultiMarkdownTest/MemoirTests/SmartQuotes.text +19 -0
  83. data/test/MultiMarkdownTest/MemoirTests/Swedish.html +23 -0
  84. data/test/MultiMarkdownTest/MemoirTests/Swedish.tex +18 -0
  85. data/test/MultiMarkdownTest/MemoirTests/Swedish.text +17 -0
  86. data/test/MultiMarkdownTest/MemoirTests/Tables.html +221 -0
  87. data/test/MultiMarkdownTest/MemoirTests/Tables.tex +134 -0
  88. data/test/MultiMarkdownTest/MemoirTests/Tables.text +64 -0
  89. data/test/MultiMarkdownTest/MultiMarkdownTests/Automatic Labels.html +41 -0
  90. data/test/MultiMarkdownTest/MultiMarkdownTests/Automatic Labels.tex +46 -0
  91. data/test/MultiMarkdownTest/MultiMarkdownTests/Automatic Labels.text +45 -0
  92. data/test/MultiMarkdownTest/MultiMarkdownTests/Base Header Level.html +20 -0
  93. data/test/MultiMarkdownTest/MultiMarkdownTests/Base Header Level.tex +19 -0
  94. data/test/MultiMarkdownTest/MultiMarkdownTests/Base Header Level.text +16 -0
  95. data/test/MultiMarkdownTest/MultiMarkdownTests/BibTeX.html +16 -0
  96. data/test/MultiMarkdownTest/MultiMarkdownTests/BibTeX.tex +11 -0
  97. data/test/MultiMarkdownTest/MultiMarkdownTests/BibTex.text +10 -0
  98. data/test/MultiMarkdownTest/MultiMarkdownTests/Citations.html +62 -0
  99. data/test/MultiMarkdownTest/MultiMarkdownTests/Citations.tex +47 -0
  100. data/test/MultiMarkdownTest/MultiMarkdownTests/Citations.text +42 -0
  101. data/test/MultiMarkdownTest/MultiMarkdownTests/Definition Lists.html +60 -0
  102. data/test/MultiMarkdownTest/MultiMarkdownTests/Definition Lists.tex +62 -0
  103. data/test/MultiMarkdownTest/MultiMarkdownTests/Definition Lists.text +39 -0
  104. data/test/MultiMarkdownTest/MultiMarkdownTests/Dutch.html +23 -0
  105. data/test/MultiMarkdownTest/MultiMarkdownTests/Dutch.tex +18 -0
  106. data/test/MultiMarkdownTest/MultiMarkdownTests/Dutch.text +17 -0
  107. data/test/MultiMarkdownTest/MultiMarkdownTests/Email.html +47 -0
  108. data/test/MultiMarkdownTest/MultiMarkdownTests/Email.tex +54 -0
  109. data/test/MultiMarkdownTest/MultiMarkdownTests/Email.text +31 -0
  110. data/test/MultiMarkdownTest/MultiMarkdownTests/English.html +23 -0
  111. data/test/MultiMarkdownTest/MultiMarkdownTests/English.tex +18 -0
  112. data/test/MultiMarkdownTest/MultiMarkdownTests/English.text +17 -0
  113. data/test/MultiMarkdownTest/MultiMarkdownTests/Errors.html +16 -0
  114. data/test/MultiMarkdownTest/MultiMarkdownTests/Errors.tex +11 -0
  115. data/test/MultiMarkdownTest/MultiMarkdownTests/Errors.text +11 -0
  116. data/test/MultiMarkdownTest/MultiMarkdownTests/Footnotes.html +46 -0
  117. data/test/MultiMarkdownTest/MultiMarkdownTests/Footnotes.tex +24 -0
  118. data/test/MultiMarkdownTest/MultiMarkdownTests/Footnotes.text +25 -0
  119. data/test/MultiMarkdownTest/MultiMarkdownTests/French.html +23 -0
  120. data/test/MultiMarkdownTest/MultiMarkdownTests/French.tex +18 -0
  121. data/test/MultiMarkdownTest/MultiMarkdownTests/French.text +17 -0
  122. data/test/MultiMarkdownTest/MultiMarkdownTests/German.html +23 -0
  123. data/test/MultiMarkdownTest/MultiMarkdownTests/German.tex +18 -0
  124. data/test/MultiMarkdownTest/MultiMarkdownTests/German.text +17 -0
  125. data/test/MultiMarkdownTest/MultiMarkdownTests/GermanGuillemets.html +23 -0
  126. data/test/MultiMarkdownTest/MultiMarkdownTests/GermanGuillemets.tex +18 -0
  127. data/test/MultiMarkdownTest/MultiMarkdownTests/GermanGuillemets.text +17 -0
  128. data/test/MultiMarkdownTest/MultiMarkdownTests/Glossary.html +46 -0
  129. data/test/MultiMarkdownTest/MultiMarkdownTests/Glossary.tex +26 -0
  130. data/test/MultiMarkdownTest/MultiMarkdownTests/Glossary.text +28 -0
  131. data/test/MultiMarkdownTest/MultiMarkdownTests/Headers.html +46 -0
  132. data/test/MultiMarkdownTest/MultiMarkdownTests/Headers.tex +52 -0
  133. data/test/MultiMarkdownTest/MultiMarkdownTests/Headers.text +49 -0
  134. data/test/MultiMarkdownTest/MultiMarkdownTests/Line Breaks.html +20 -0
  135. data/test/MultiMarkdownTest/MultiMarkdownTests/Line Breaks.tex +15 -0
  136. data/test/MultiMarkdownTest/MultiMarkdownTests/Line Breaks.text +15 -0
  137. data/test/MultiMarkdownTest/MultiMarkdownTests/Link Attributes.html +54 -0
  138. data/test/MultiMarkdownTest/MultiMarkdownTests/Link Attributes.tex +60 -0
  139. data/test/MultiMarkdownTest/MultiMarkdownTests/Link Attributes.text +50 -0
  140. data/test/MultiMarkdownTest/MultiMarkdownTests/List Parsing.html +20 -0
  141. data/test/MultiMarkdownTest/MultiMarkdownTests/List Parsing.tex +17 -0
  142. data/test/MultiMarkdownTest/MultiMarkdownTests/List Parsing.text +11 -0
  143. data/test/MultiMarkdownTest/MultiMarkdownTests/MarkdownInHTML.html +19 -0
  144. data/test/MultiMarkdownTest/MultiMarkdownTests/MarkdownInHTML.tex +13 -0
  145. data/test/MultiMarkdownTest/MultiMarkdownTests/MarkdownInHTML.text +19 -0
  146. data/test/MultiMarkdownTest/MultiMarkdownTests/Math.html +21 -0
  147. data/test/MultiMarkdownTest/MultiMarkdownTests/Math.tex +15 -0
  148. data/test/MultiMarkdownTest/MultiMarkdownTests/Math.text +15 -0
  149. data/test/MultiMarkdownTest/MultiMarkdownTests/MetaData.html +21 -0
  150. data/test/MultiMarkdownTest/MultiMarkdownTests/MetaData.tex +13 -0
  151. data/test/MultiMarkdownTest/MultiMarkdownTests/MetaData.text +14 -0
  152. data/test/MultiMarkdownTest/MultiMarkdownTests/Sanity.html +104 -0
  153. data/test/MultiMarkdownTest/MultiMarkdownTests/Sanity.tex +100 -0
  154. data/test/MultiMarkdownTest/MultiMarkdownTests/Sanity.text +77 -0
  155. data/test/MultiMarkdownTest/MultiMarkdownTests/SmartQuotes.html +29 -0
  156. data/test/MultiMarkdownTest/MultiMarkdownTests/SmartQuotes.tex +24 -0
  157. data/test/MultiMarkdownTest/MultiMarkdownTests/SmartQuotes.text +22 -0
  158. data/test/MultiMarkdownTest/MultiMarkdownTests/Swedish.html +23 -0
  159. data/test/MultiMarkdownTest/MultiMarkdownTests/Swedish.tex +18 -0
  160. data/test/MultiMarkdownTest/MultiMarkdownTests/Swedish.text +17 -0
  161. data/test/MultiMarkdownTest/MultiMarkdownTests/Tables.html +230 -0
  162. data/test/MultiMarkdownTest/MultiMarkdownTests/Tables.tex +133 -0
  163. data/test/MultiMarkdownTest/MultiMarkdownTests/Tables.text +63 -0
  164. data/test/MultiMarkdownTest/MultiMarkdownTests/bibtex.bib +119 -0
  165. data/test/MultiMarkdownTest/README.md +58 -0
  166. data/test/MultiMarkdownTest/Tests/Amps and angle encoding.html +17 -0
  167. data/test/MultiMarkdownTest/Tests/Amps and angle encoding.text +21 -0
  168. data/test/MultiMarkdownTest/Tests/Auto links.html +18 -0
  169. data/test/MultiMarkdownTest/Tests/Auto links.text +13 -0
  170. data/test/MultiMarkdownTest/Tests/Backslash escapes.html +118 -0
  171. data/test/MultiMarkdownTest/Tests/Backslash escapes.text +120 -0
  172. data/test/MultiMarkdownTest/Tests/Blockquotes with code blocks.html +15 -0
  173. data/test/MultiMarkdownTest/Tests/Blockquotes with code blocks.text +11 -0
  174. data/test/MultiMarkdownTest/Tests/Code Blocks.html +18 -0
  175. data/test/MultiMarkdownTest/Tests/Code Blocks.text +14 -0
  176. data/test/MultiMarkdownTest/Tests/Code Spans.html +6 -0
  177. data/test/MultiMarkdownTest/Tests/Code Spans.text +6 -0
  178. data/test/MultiMarkdownTest/Tests/Compatibility.html +5 -0
  179. data/test/MultiMarkdownTest/Tests/Compatibility.text +9 -0
  180. data/test/MultiMarkdownTest/Tests/Hard-wrapped paragraphs with list-like lines.html +8 -0
  181. data/test/MultiMarkdownTest/Tests/Hard-wrapped paragraphs with list-like lines.text +8 -0
  182. data/test/MultiMarkdownTest/Tests/Horizontal rules.html +71 -0
  183. data/test/MultiMarkdownTest/Tests/Horizontal rules.text +67 -0
  184. data/test/MultiMarkdownTest/Tests/Inline HTML (Advanced).html +15 -0
  185. data/test/MultiMarkdownTest/Tests/Inline HTML (Advanced).text +15 -0
  186. data/test/MultiMarkdownTest/Tests/Inline HTML (Simple).html +72 -0
  187. data/test/MultiMarkdownTest/Tests/Inline HTML (Simple).text +69 -0
  188. data/test/MultiMarkdownTest/Tests/Inline HTML comments.html +13 -0
  189. data/test/MultiMarkdownTest/Tests/Inline HTML comments.text +13 -0
  190. data/test/MultiMarkdownTest/Tests/Links, inline style.html +11 -0
  191. data/test/MultiMarkdownTest/Tests/Links, inline style.text +12 -0
  192. data/test/MultiMarkdownTest/Tests/Links, reference style.html +52 -0
  193. data/test/MultiMarkdownTest/Tests/Links, reference style.text +71 -0
  194. data/test/MultiMarkdownTest/Tests/Links, shortcut references.html +9 -0
  195. data/test/MultiMarkdownTest/Tests/Links, shortcut references.text +20 -0
  196. data/test/MultiMarkdownTest/Tests/Literal quotes in titles.html +3 -0
  197. data/test/MultiMarkdownTest/Tests/Literal quotes in titles.text +7 -0
  198. data/test/MultiMarkdownTest/Tests/Markdown Documentation - Basics.html +314 -0
  199. data/test/MultiMarkdownTest/Tests/Markdown Documentation - Basics.text +306 -0
  200. data/test/MultiMarkdownTest/Tests/Markdown Documentation - Syntax.html +942 -0
  201. data/test/MultiMarkdownTest/Tests/Markdown Documentation - Syntax.text +888 -0
  202. data/test/MultiMarkdownTest/Tests/Nested blockquotes.html +9 -0
  203. data/test/MultiMarkdownTest/Tests/Nested blockquotes.text +5 -0
  204. data/test/MultiMarkdownTest/Tests/Ordered and unordered lists.html +148 -0
  205. data/test/MultiMarkdownTest/Tests/Ordered and unordered lists.text +131 -0
  206. data/test/MultiMarkdownTest/Tests/Strong and em together.html +7 -0
  207. data/test/MultiMarkdownTest/Tests/Strong and em together.text +7 -0
  208. data/test/MultiMarkdownTest/Tests/Tabs.html +25 -0
  209. data/test/MultiMarkdownTest/Tests/Tabs.text +21 -0
  210. data/test/MultiMarkdownTest/Tests/Tidyness.html +8 -0
  211. data/test/MultiMarkdownTest/Tests/Tidyness.text +5 -0
  212. data/test/benchmark.rb +49 -0
  213. data/test/multimarkdown_test.rb +89 -0
  214. metadata +280 -0
@@ -0,0 +1 @@
1
+ require 'peg_multimarkdown'
@@ -0,0 +1,74 @@
1
+ require 'peg_multimarkdown.so'
2
+
3
+ # Front-end to fletcher penney's peg-multimarkdown implementation of MultiMarkdown
4
+ #
5
+ # A simple processor:
6
+ # >>> puts MultiMarkdown.new("Hello, World.").to_html
7
+ # <p>Hello, World.</p>
8
+ #
9
+ # With other stuff:
10
+ # >>> puts MultiMarkdown.new("_Hello -- World!_", :smart, :filter_html).to_html
11
+ # <p><em>Hello World!</em></p>
12
+ #
13
+ class PEGMultiMarkdown
14
+
15
+ # Original MultiMarkdown formatted text.
16
+ attr_reader :text
17
+
18
+ # Set true to have smarty-like quote translation performed.
19
+ attr_accessor :smart
20
+
21
+ # Set true to have footnotes processed.
22
+ attr_accessor :notes
23
+
24
+ # Do not output <style> tags included in the source text.
25
+ attr_accessor :filter_styles
26
+
27
+ # Do not output any raw HTML included in the source text.
28
+ attr_accessor :filter_html
29
+
30
+ # Process MultiMarkdown inside of raw HTML
31
+ attr_accessor :process_html
32
+
33
+ # Markdown compatibility mode
34
+ attr_accessor :compatibility
35
+
36
+ # Included for compatibility with RedCloth's interface.
37
+ attr_accessor :fold_lines
38
+
39
+ # Create a new MultiMarkdown processor. The +text+ argument is a string
40
+ # containing MultiMarkdown text. Variable other arguments may be supplied to
41
+ # set various processing options:
42
+ #
43
+ # * <tt>:smart</tt> - Enable SmartyPants processing.
44
+ # * <tt>:notes</tt> - Enable footnotes.
45
+ # * <tt>:filter_styles</tt> - Do not output <style> tags included in the
46
+ # source text.
47
+ # * <tt>:filter_html</tt> - Do not output raw HTML included in the
48
+ # source text.
49
+ # * <tt>:process_html</tt> - Process MultiMarkdown code inside HTML tags.
50
+ # * <tt>:compatibility</tt> - Process MultiMarkdown code in Markdown
51
+ # compatibility mode.
52
+ # * <tt>:fold_lines</tt> - RedCloth compatible line folding (not used).
53
+ #
54
+ def initialize(text, *extensions)
55
+ @text = text
56
+ @smart = true
57
+ @notes = true
58
+ @filter_styles = false
59
+ @filter_html = false
60
+ @process_html = false
61
+ @compatibility = false
62
+ extensions.each { |e| send("#{e}=", true) }
63
+ if @compatibility
64
+ @smart = false
65
+ @notes = false
66
+ @process_html = false
67
+ end
68
+ end
69
+
70
+ alias to_s text
71
+
72
+ end
73
+
74
+ MultiMarkdown = PEGMultiMarkdown unless defined? MultiMarkdown
@@ -0,0 +1,76 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+ <head>
5
+ <meta name="latexinput" content="mmd-beamer-header"/>
6
+ <title>Test </title>
7
+ <meta name="latexmode" content="beamer"/>
8
+ <meta name="theme" content="keynote-gradient"/>
9
+ <meta name="latexinput" content="mmd-beamer-begin-doc"/>
10
+ <meta name="latexfooter" content="mmd-beamer-footer"/>
11
+ </head>
12
+ <body>
13
+ <h3 id="tables">Tables</h3>
14
+
15
+ <table>
16
+ <col align="left"/>
17
+ <col align="center"/>
18
+ <col align="center"/>
19
+
20
+ <thead>
21
+ <tr>
22
+ <th align="left">Features </th>
23
+ <th align="center">MultiMarkdown </th>
24
+ <th align="center">Crayons </th>
25
+ </tr>
26
+ </thead>
27
+
28
+ <tbody>
29
+ <tr>
30
+ <td align="left">Melts in warm places </td>
31
+ <td align="center">No </td>
32
+ <td align="center">Yes </td>
33
+ </tr>
34
+ <tr>
35
+ <td align="left">Mistakes can be easily fixed </td>
36
+ <td align="center">Yes </td>
37
+ <td align="center">No </td>
38
+ </tr>
39
+ <tr>
40
+ <td align="left">Easy to copy documents for friends </td>
41
+ <td align="center">Yes </td>
42
+ <td align="center">No </td>
43
+ </tr>
44
+ <tr>
45
+ <td align="left">Fun at parties </td>
46
+ <td align="center">No </td>
47
+ <td align="center">Why not? </td>
48
+ </tr>
49
+ </tbody>
50
+
51
+ <tbody>
52
+ <tr>
53
+ <td align="left">Minimum markup for maximum quality? </td>
54
+ <td align="center">Yes </td>
55
+ <td align="center">No </td>
56
+ </tr>
57
+ </tbody>
58
+ </table>
59
+ <h3 id="theoldwaywascomplicated">The old way was complicated</h3>
60
+
61
+ <pre><code>&lt;p&gt;In order to create valid
62
+ &lt;a href=&quot;http://en.wikipedia.org/wiki/HTML&quot;&gt;HTML&lt;/a&gt;, you
63
+ need properly coded syntax that can be cumbersome for
64
+ &amp;#8220;non-programmers&amp;#8221; to write. Sometimes, you
65
+ just want to easily make certain words &lt;strong&gt;bold
66
+ &lt;/strong&gt;, and certain words &lt;em&gt;italicized&lt;/em&gt; without
67
+ having to remember the syntax. Additionally, for example,
68
+ creating lists:&lt;/p&gt;
69
+
70
+ &lt;ul&gt;
71
+ &lt;li&gt;should be easy&lt;/li&gt;
72
+ &lt;li&gt;should not involve programming&lt;/li&gt;
73
+ &lt;/ul&gt;
74
+ </code></pre>
75
+ </body>
76
+ </html>
@@ -0,0 +1,64 @@
1
+ \input{mmd-beamer-header}
2
+ \def\mytitle{Test}
3
+ \def\latexmode{beamer}
4
+ \def\theme{keynote-gradient}
5
+ \input{mmd-beamer-begin-doc}
6
+ \begin{frame}
7
+
8
+ \frametitle{Tables}
9
+ \label{tables}
10
+
11
+ \begin{table}[htbp]
12
+ \begin{minipage}{\linewidth}
13
+ \setlength{\tymax}{0.5\linewidth}
14
+ \centering
15
+ \small
16
+ \begin{tabular}{@{}lcc@{}} \toprule
17
+ Features&MultiMarkdown&Crayons\\
18
+ \midrule
19
+ Melts in warm places&No&Yes\\
20
+ Mistakes can be easily fixed&Yes&No\\
21
+ Easy to copy documents for friends&Yes&No\\
22
+ Fun at parties&No&Why not?\\
23
+
24
+ \midrule
25
+ Minimum markup for maximum quality?&Yes&No\\
26
+
27
+ \bottomrule
28
+
29
+ \end{tabular}
30
+ \end{minipage}
31
+ \end{table}
32
+
33
+
34
+ \end{frame}
35
+
36
+ \begin{frame}[fragile]
37
+
38
+ \frametitle{The old way was complicated}
39
+ \label{theoldwaywascomplicated}
40
+
41
+ \begin{verbatim}
42
+ <p>In order to create valid
43
+ <a href="http://en.wikipedia.org/wiki/HTML">HTML</a>, you
44
+ need properly coded syntax that can be cumbersome for
45
+ &#8220;non-programmers&#8221; to write. Sometimes, you
46
+ just want to easily make certain words <strong>bold
47
+ </strong>, and certain words <em>italicized</em> without
48
+ having to remember the syntax. Additionally, for example,
49
+ creating lists:</p>
50
+
51
+ <ul>
52
+ <li>should be easy</li>
53
+ <li>should not involve programming</li>
54
+ </ul>
55
+ \end{verbatim}
56
+
57
+
58
+ \end{frame}
59
+
60
+ \mode<all>
61
+ \input{mmd-beamer-footer}
62
+
63
+ \end{document}\mode*
64
+
@@ -0,0 +1,38 @@
1
+ latex input: mmd-beamer-header
2
+ Title: Test
3
+ base header level: 3
4
+ latex mode: beamer
5
+ Theme: keynote-gradient
6
+ latex input: mmd-beamer-begin-doc
7
+ latex footer: mmd-beamer-footer
8
+
9
+
10
+ # Tables #
11
+
12
+
13
+ | Features | MultiMarkdown | Crayons |
14
+ ----------------------------------- | :-----------: | :------: |
15
+ Melts in warm places | No | Yes |
16
+ Mistakes can be easily fixed | Yes | No |
17
+ Easy to copy documents for friends | Yes | No |
18
+ Fun at parties | No | Why not? |
19
+
20
+ Minimum markup for maximum quality? | Yes | No |
21
+
22
+
23
+ # The old way was complicated #
24
+
25
+ <p>In order to create valid
26
+ <a href="http://en.wikipedia.org/wiki/HTML">HTML</a>, you
27
+ need properly coded syntax that can be cumbersome for
28
+ &#8220;non-programmers&#8221; to write. Sometimes, you
29
+ just want to easily make certain words <strong>bold
30
+ </strong>, and certain words <em>italicized</em> without
31
+ having to remember the syntax. Additionally, for example,
32
+ creating lists:</p>
33
+
34
+ <ul>
35
+ <li>should be easy</li>
36
+ <li>should not involve programming</li>
37
+ </ul>
38
+
@@ -0,0 +1,182 @@
1
+ #!/usr/bin/perl
2
+
3
+ #
4
+ # MarkdownTester -- Run tests for Markdown implementations
5
+ #
6
+ # Copyright (c) 2004-2005 John Gruber
7
+ # <http://daringfireball.net/projects/markdown/>
8
+ #
9
+
10
+ use strict;
11
+ use warnings;
12
+ use Getopt::Long;
13
+ use Benchmark;
14
+
15
+ our $VERSION = '1.0.2';
16
+ # Sat 24 Dec 2005
17
+
18
+ my $time_start = new Benchmark;
19
+ my $test_dir = "Tests";
20
+ my $script = "./Markdown.pl";
21
+ my $use_tidy = 0;
22
+ my ($flag_version);
23
+ my $flags = "";
24
+ my $file_ext = "\.html";
25
+ my $trail = "";
26
+
27
+ GetOptions (
28
+ "script=s" => \$script,
29
+ "testdir=s" => \$test_dir,
30
+ "tidy" => \$use_tidy,
31
+ "version" => \$flag_version,
32
+ "flags=s" => \$flags,
33
+ "ext=s" => \$file_ext,
34
+ "trailflags=s" => \$trail,
35
+ );
36
+
37
+ if($flag_version) {
38
+ my $progname = $0;
39
+ $progname =~ s{.*/}{};
40
+ die "$progname version $VERSION\n";
41
+ }
42
+
43
+ unless (-d $test_dir) { die "'$test_dir' is not a directory.\n"; }
44
+ unless (-f $script) { die "$script does not exist.\n"; }
45
+ unless (-x $script) { die "$script is not executable.\n"; }
46
+
47
+ my $tests_passed = 0;
48
+ my $tests_failed = 0;
49
+
50
+ TEST:
51
+ foreach my $testfile (glob "$test_dir/*.text") {
52
+ my $testname = $testfile;
53
+ $testname =~ s{.*/(.+)\.text$}{$1}i;
54
+ print "$testname ... ";
55
+
56
+ # Look for a corresponding .html file for each .text file:
57
+ my $resultfile = $testfile;
58
+ $resultfile =~ s{\.text$}{$file_ext}i;
59
+ unless (-f $resultfile) {
60
+ print "'$resultfile' does not exist.\n\n";
61
+ next TEST;
62
+ }
63
+
64
+ # open(TEST, $testfile) || die("Can't open testfile: $!");
65
+ open(RESULT, $resultfile) || die("Can't open resultfile: $!");
66
+ undef $/;
67
+ # my $t_input = <TEST>;
68
+ my $t_result = <RESULT>;
69
+
70
+ my $t_output = `'$script' $flags '$testfile' $trail`;
71
+
72
+ # Normalize the output and expected result strings:
73
+ $t_result =~ s/\s+\z//; # trim trailing whitespace
74
+ $t_output =~ s/\s+\z//; # trim trailing whitespace
75
+ if ($use_tidy) {
76
+ # Escape the strings, pass them through to CLI tidy tool for tag-level equivalency
77
+ $t_result =~ s{'}{'\\''}g; # escape ' chars for shell
78
+ $t_output =~ s{'}{'\\''}g;
79
+ $t_result = `echo '$t_result' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
80
+ $t_output = `echo '$t_output' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
81
+ }
82
+
83
+ if ($t_output eq $t_result) {
84
+ print "OK\n";
85
+ $tests_passed++;
86
+ }
87
+ else {
88
+ print "FAILED\n\n";
89
+ # This part added by JM to print diffs
90
+ open(OUT, '>tmp1') or die $!;
91
+ print OUT $t_output or die $!;
92
+ open(RES, '>tmp2') or die $!;
93
+ print RES $t_result or die $!;
94
+ print `diff tmp1 tmp2`;
95
+ close RES;
96
+ close OUT;
97
+ print "\n";
98
+ `rm tmp?`;
99
+ # End of added part
100
+ $tests_failed++;
101
+ }
102
+ }
103
+
104
+ print "\n\n";
105
+ print "$tests_passed passed; $tests_failed failed.\n";
106
+
107
+ my $time_end = new Benchmark;
108
+ my $time_diff = timediff($time_end, $time_start);
109
+ print "Benchmark: ", timestr($time_diff), "\n";
110
+
111
+
112
+ __END__
113
+
114
+ =pod
115
+
116
+ =head1 NAME
117
+
118
+ B<MarkdownTest>
119
+
120
+
121
+ =head1 SYNOPSIS
122
+
123
+ B<MarkdownTest.pl> [ B<--options> ] [ I<file> ... ]
124
+
125
+
126
+ =head1 DESCRIPTION
127
+
128
+
129
+ =head1 OPTIONS
130
+
131
+ Use "--" to end switch parsing. For example, to open a file named "-z", use:
132
+
133
+ MarkdownTest.pl -- -z
134
+
135
+ =over 4
136
+
137
+ =item B<--script>
138
+
139
+ Specify the path to the Markdown script to test. Defaults to
140
+ "./Markdown.pl". Example:
141
+
142
+ ./MarkdownTest.pl --script ./PHP-Markdown/php-markdown
143
+
144
+ =item B<--testdir>
145
+
146
+ Specify the path to a directory containing test data. Defaults to "Tests".
147
+
148
+ =item B<--tidy>
149
+
150
+ Flag to turn on using the command line 'tidy' tool to normalize HTML
151
+ output before comparing script output to the expected test result.
152
+ Assumes that the 'tidy' command is available in your PATH. Defaults to
153
+ off.
154
+
155
+ =back
156
+
157
+
158
+
159
+ =head1 BUGS
160
+
161
+
162
+
163
+ =head1 VERSION HISTORY
164
+
165
+ 1.0 Mon 13 Dec 2004-2005
166
+
167
+ 1.0.1 Mon 19 Sep 2005
168
+
169
+ + Better handling of case when foo.text exists, but foo.html doesn't.
170
+ It now prints a message and moves on, rather than dying.
171
+
172
+
173
+ =head1 COPYRIGHT AND LICENSE
174
+
175
+ Copyright (c) 2004-2005 John Gruber
176
+ <http://daringfireball.net/>
177
+ All rights reserved.
178
+
179
+ This is free software; you may redistribute it and/or modify it under
180
+ the same terms as Perl itself.
181
+
182
+ =cut
@@ -0,0 +1,42 @@
1
+ <?xml version="1.0" encoding="UTF-8" ?>
2
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+ <html xmlns="http://www.w3.org/1999/xhtml">
4
+ <head>
5
+ <meta name="latexinput" content="mmd-article-header"/>
6
+ <title>MultiMarkdown Autoreference Test</title>
7
+ <meta name="latexmode" content="memoir"/>
8
+ <meta name="latexinput" content="mmd-article-begin-doc"/>
9
+ <meta name="latexfooter" content="mmd-memoir-footer"/>
10
+ </head>
11
+ <body>
12
+ <h2 id="muststartwithalpha">109&amp;^*&amp;#^() Must Start With Alpha</h2>
13
+
14
+ <h2 id="stripoutcharacters">Strip out &amp;^% characters ^&amp;*^</h2>
15
+
16
+ <h2 id="specialcrossreferencecases">Special Cross Reference Cases</h2>
17
+
18
+ <h3 id="cross-references:specialcharacters">1 Cross-References: Special Characters!@#$%^&amp;*()&lt;&gt;</h3>
19
+
20
+ <p>And now, link to <a href="#cross-references:specialcharacters">1 Cross-References: Special Characters!@#$%^&amp;*()&lt;&gt;</a></p>
21
+
22
+ <h2 id="setext1">Setext 1</h2>
23
+
24
+ <h3 id="setext2">Setext 2</h3>
25
+
26
+ <h2 id="atx1">Atx 1</h2>
27
+
28
+ <p>Link to <a href="#setext1">Setext 1</a>.</p>
29
+
30
+ <p>And <a href="#setext2">Setext 2</a>.</p>
31
+
32
+ <p>And <a href="#atx1">Atx 1</a>.</p>
33
+
34
+ <p>And [Atx 2] should fail.</p>
35
+
36
+ <h2 id="label">Manual Header</h2>
37
+
38
+ <h2 id="label2">Manual Header 2</h2>
39
+
40
+ <h3 id="label3">Manual Header 3</h3>
41
+ </body>
42
+ </html>