parkdown-libertree 1.4.26

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 (104) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +68 -0
  3. data/README.markdown +86 -0
  4. data/Rakefile +170 -0
  5. data/bin/parkdown +13 -0
  6. data/ext/extconf.h +3 -0
  7. data/ext/extconf.rb +15 -0
  8. data/ext/markdown.c +104 -0
  9. data/ext/markdown_lib.c +186 -0
  10. data/ext/markdown_lib.h +44 -0
  11. data/ext/markdown_output.c +1275 -0
  12. data/ext/markdown_parser.c +7275 -0
  13. data/ext/markdown_peg.h +90 -0
  14. data/ext/parsing_functions.c +128 -0
  15. data/ext/utility_functions.c +217 -0
  16. data/lib/markdown.rb +1 -0
  17. data/lib/peg_markdown.rb +104 -0
  18. data/test/MarkdownTest_1.0/MarkdownTest.pl +157 -0
  19. data/test/MarkdownTest_1.0/Tests/Amps and angle encoding.html +17 -0
  20. data/test/MarkdownTest_1.0/Tests/Amps and angle encoding.text +21 -0
  21. data/test/MarkdownTest_1.0/Tests/Auto links.html +18 -0
  22. data/test/MarkdownTest_1.0/Tests/Auto links.text +13 -0
  23. data/test/MarkdownTest_1.0/Tests/Backslash escapes.html +102 -0
  24. data/test/MarkdownTest_1.0/Tests/Backslash escapes.text +104 -0
  25. data/test/MarkdownTest_1.0/Tests/Blockquotes with code blocks.html +15 -0
  26. data/test/MarkdownTest_1.0/Tests/Blockquotes with code blocks.text +11 -0
  27. data/test/MarkdownTest_1.0/Tests/Hard-wrapped paragraphs with list-like lines.html +8 -0
  28. data/test/MarkdownTest_1.0/Tests/Hard-wrapped paragraphs with list-like lines.text +8 -0
  29. data/test/MarkdownTest_1.0/Tests/Horizontal rules.html +71 -0
  30. data/test/MarkdownTest_1.0/Tests/Horizontal rules.text +67 -0
  31. data/test/MarkdownTest_1.0/Tests/Inline HTML (Advanced).html +14 -0
  32. data/test/MarkdownTest_1.0/Tests/Inline HTML (Advanced).text +14 -0
  33. data/test/MarkdownTest_1.0/Tests/Inline HTML (Simple).html +72 -0
  34. data/test/MarkdownTest_1.0/Tests/Inline HTML (Simple).text +69 -0
  35. data/test/MarkdownTest_1.0/Tests/Inline HTML comments.html +13 -0
  36. data/test/MarkdownTest_1.0/Tests/Inline HTML comments.text +13 -0
  37. data/test/MarkdownTest_1.0/Tests/Links, inline style.html +9 -0
  38. data/test/MarkdownTest_1.0/Tests/Links, inline style.text +9 -0
  39. data/test/MarkdownTest_1.0/Tests/Links, reference style.html +18 -0
  40. data/test/MarkdownTest_1.0/Tests/Links, reference style.text +31 -0
  41. data/test/MarkdownTest_1.0/Tests/Literal quotes in titles.html +3 -0
  42. data/test/MarkdownTest_1.0/Tests/Literal quotes in titles.text +7 -0
  43. data/test/MarkdownTest_1.0/Tests/Markdown Documentation - Basics.html +314 -0
  44. data/test/MarkdownTest_1.0/Tests/Markdown Documentation - Basics.text +306 -0
  45. data/test/MarkdownTest_1.0/Tests/Markdown Documentation - Syntax.html +942 -0
  46. data/test/MarkdownTest_1.0/Tests/Markdown Documentation - Syntax.text +888 -0
  47. data/test/MarkdownTest_1.0/Tests/Nested blockquotes.html +9 -0
  48. data/test/MarkdownTest_1.0/Tests/Nested blockquotes.text +5 -0
  49. data/test/MarkdownTest_1.0/Tests/Ordered and unordered lists.html +137 -0
  50. data/test/MarkdownTest_1.0/Tests/Ordered and unordered lists.text +122 -0
  51. data/test/MarkdownTest_1.0/Tests/Strong and em together.html +7 -0
  52. data/test/MarkdownTest_1.0/Tests/Strong and em together.text +7 -0
  53. data/test/MarkdownTest_1.0/Tests/Tabs.html +25 -0
  54. data/test/MarkdownTest_1.0/Tests/Tabs.text +21 -0
  55. data/test/MarkdownTest_1.0/Tests/Tidyness.html +8 -0
  56. data/test/MarkdownTest_1.0/Tests/Tidyness.text +5 -0
  57. data/test/MarkdownTest_1.0.3/MarkdownTest.pl +176 -0
  58. data/test/MarkdownTest_1.0.3/Tests/Amps and angle encoding.html +17 -0
  59. data/test/MarkdownTest_1.0.3/Tests/Amps and angle encoding.text +21 -0
  60. data/test/MarkdownTest_1.0.3/Tests/Auto links.html +18 -0
  61. data/test/MarkdownTest_1.0.3/Tests/Auto links.text +13 -0
  62. data/test/MarkdownTest_1.0.3/Tests/Backslash escapes.html +118 -0
  63. data/test/MarkdownTest_1.0.3/Tests/Backslash escapes.text +120 -0
  64. data/test/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.html +15 -0
  65. data/test/MarkdownTest_1.0.3/Tests/Blockquotes with code blocks.text +11 -0
  66. data/test/MarkdownTest_1.0.3/Tests/Code Blocks.html +18 -0
  67. data/test/MarkdownTest_1.0.3/Tests/Code Blocks.text +14 -0
  68. data/test/MarkdownTest_1.0.3/Tests/Code Spans.html +6 -0
  69. data/test/MarkdownTest_1.0.3/Tests/Code Spans.text +6 -0
  70. data/test/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.html +8 -0
  71. data/test/MarkdownTest_1.0.3/Tests/Hard-wrapped paragraphs with list-like lines.text +8 -0
  72. data/test/MarkdownTest_1.0.3/Tests/Horizontal rules.html +71 -0
  73. data/test/MarkdownTest_1.0.3/Tests/Horizontal rules.text +67 -0
  74. data/test/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).html +15 -0
  75. data/test/MarkdownTest_1.0.3/Tests/Inline HTML (Advanced).text +15 -0
  76. data/test/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).html +72 -0
  77. data/test/MarkdownTest_1.0.3/Tests/Inline HTML (Simple).text +69 -0
  78. data/test/MarkdownTest_1.0.3/Tests/Inline HTML comments.html +13 -0
  79. data/test/MarkdownTest_1.0.3/Tests/Inline HTML comments.text +13 -0
  80. data/test/MarkdownTest_1.0.3/Tests/Links, inline style.html +11 -0
  81. data/test/MarkdownTest_1.0.3/Tests/Links, inline style.text +12 -0
  82. data/test/MarkdownTest_1.0.3/Tests/Links, reference style.html +52 -0
  83. data/test/MarkdownTest_1.0.3/Tests/Links, reference style.text +71 -0
  84. data/test/MarkdownTest_1.0.3/Tests/Links, shortcut references.html +9 -0
  85. data/test/MarkdownTest_1.0.3/Tests/Links, shortcut references.text +20 -0
  86. data/test/MarkdownTest_1.0.3/Tests/Literal quotes in titles.html +3 -0
  87. data/test/MarkdownTest_1.0.3/Tests/Literal quotes in titles.text +7 -0
  88. data/test/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.html +314 -0
  89. data/test/MarkdownTest_1.0.3/Tests/Markdown Documentation - Basics.text +306 -0
  90. data/test/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.html +942 -0
  91. data/test/MarkdownTest_1.0.3/Tests/Markdown Documentation - Syntax.text +888 -0
  92. data/test/MarkdownTest_1.0.3/Tests/Nested blockquotes.html +9 -0
  93. data/test/MarkdownTest_1.0.3/Tests/Nested blockquotes.text +5 -0
  94. data/test/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.html +148 -0
  95. data/test/MarkdownTest_1.0.3/Tests/Ordered and unordered lists.text +131 -0
  96. data/test/MarkdownTest_1.0.3/Tests/Strong and em together.html +7 -0
  97. data/test/MarkdownTest_1.0.3/Tests/Strong and em together.text +7 -0
  98. data/test/MarkdownTest_1.0.3/Tests/Tabs.html +25 -0
  99. data/test/MarkdownTest_1.0.3/Tests/Tabs.text +21 -0
  100. data/test/MarkdownTest_1.0.3/Tests/Tidyness.html +8 -0
  101. data/test/MarkdownTest_1.0.3/Tests/Tidyness.text +5 -0
  102. data/test/benchmark.rb +49 -0
  103. data/test/markdown_test.rb +84 -0
  104. metadata +150 -0
@@ -0,0 +1,157 @@
1
+ #!/usr/bin/perl
2
+
3
+ #
4
+ # MarkdownTester -- Run tests for Markdown implementations
5
+ #
6
+ # Copyright (c) 2004 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';
16
+ # Mon 13 Dec 2004
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
+
24
+ GetOptions (
25
+ "script=s" => \$script,
26
+ "testdir=s" => \$test_dir,
27
+ "tidy" => \$use_tidy,
28
+ "version" => \$flag_version,
29
+ );
30
+
31
+ if($flag_version) {
32
+ my $progname = $0;
33
+ $progname =~ s{.*/}{};
34
+ die "$progname version $VERSION\n";
35
+ }
36
+
37
+ unless (-d $test_dir) { die "'$test_dir' is not a directory.\n"; }
38
+ unless (-f $script) { die "$script does not exist.\n"; }
39
+ unless (-x $script) { die "$script is not executable.\n"; }
40
+
41
+ my $tests_passed = 0;
42
+ my $tests_failed = 0;
43
+
44
+ foreach my $testfile (glob "$test_dir/*.text") {
45
+ my $testname = $testfile;
46
+ $testname =~ s{.*/(.+)\.text$}{$1}i;
47
+ print "$testname ... ";
48
+
49
+ # Look for a corresponding .html file for each .text file:
50
+ my $resultfile = $testfile;
51
+ $resultfile =~ s{\.text$}{\.html}i;
52
+ unless (-f $resultfile) {die "'$resultfile' does not exist.\n";}
53
+
54
+ # open(TEST, $testfile) || die("Can't open testfile: $!");
55
+ open(RESULT, $resultfile) || die("Can't open resultfile: $!");
56
+ undef $/;
57
+ # my $t_input = <TEST>;
58
+ my $t_result = <RESULT>;
59
+
60
+ my $t_output = `$script '$testfile'`;
61
+
62
+ # Normalize the output and expected result strings:
63
+ $t_result =~ s/\s+\z//; # trim trailing whitespace
64
+ $t_output =~ s/\s+\z//; # trim trailing whitespace
65
+ if ($use_tidy) {
66
+ # Escape the strings, pass them through to CLI tidy tool for tag-level equivalency
67
+ $t_result =~ s{'}{'\\''}g; # escape ' chars for shell
68
+ $t_output =~ s{'}{'\\''}g;
69
+ $t_result = `echo '$t_result' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
70
+ $t_output = `echo '$t_output' | tidy --show-body-only 1 --quiet 1 --show-warnings 0`;
71
+ }
72
+
73
+ if ($t_output eq $t_result) {
74
+ print "OK\n";
75
+ $tests_passed++;
76
+ }
77
+ else {
78
+ print "FAILED\n\n";
79
+ $tests_failed++;
80
+ }
81
+ }
82
+
83
+ print "\n\n";
84
+ print "$tests_passed passed; $tests_failed failed.\n";
85
+
86
+ my $time_end = new Benchmark;
87
+ my $time_diff = timediff($time_end, $time_start);
88
+ print "Benchmark: ", timestr($time_diff), "\n";
89
+
90
+
91
+ __END__
92
+
93
+ =pod
94
+
95
+ =head1 NAME
96
+
97
+ B<MarkdownTest>
98
+
99
+
100
+ =head1 SYNOPSIS
101
+
102
+ B<MarkdownTest.pl> [ B<--options> ] [ I<file> ... ]
103
+
104
+
105
+ =head1 DESCRIPTION
106
+
107
+
108
+ =head1 OPTIONS
109
+
110
+ Use "--" to end switch parsing. For example, to open a file named "-z", use:
111
+
112
+ MarkdownTest.pl -- -z
113
+
114
+ =over 4
115
+
116
+ =item B<--script>
117
+
118
+ Specify the path to the Markdown script to test. Defaults to
119
+ "./Markdown.pl". Example:
120
+
121
+ ./MarkdownTest.pl --script ./PHP-Markdown/php-markdown
122
+
123
+ =item B<--testdir>
124
+
125
+ Specify the path to a directory containing test data. Defaults to "Tests".
126
+
127
+ =item B<--tidy>
128
+
129
+ Flag to turn on using the command line 'tidy' tool to normalize HTML
130
+ output before comparing script output to the expected test result.
131
+ Assumes that the 'tidy' command is available in your PATH. Defaults to
132
+ off.
133
+
134
+ =back
135
+
136
+
137
+
138
+ =head1 BUGS
139
+
140
+
141
+
142
+ =head1 VERSION HISTORY
143
+
144
+ 1.0 Mon 13 Dec 2004
145
+
146
+
147
+
148
+ =head1 COPYRIGHT AND LICENSE
149
+
150
+ Copyright (c) 2004 John Gruber
151
+ <http://daringfireball.net/>
152
+ All rights reserved.
153
+
154
+ This is free software; you may redistribute it and/or modify it under
155
+ the same terms as Perl itself.
156
+
157
+ =cut
@@ -0,0 +1,17 @@
1
+ <p>AT&amp;T has an ampersand in their name.</p>
2
+
3
+ <p>AT&amp;T is another way to write it.</p>
4
+
5
+ <p>This &amp; that.</p>
6
+
7
+ <p>4 &lt; 5.</p>
8
+
9
+ <p>6 > 5.</p>
10
+
11
+ <p>Here's a <a href="http://example.com/?foo=1&amp;bar=2">link</a> with an ampersand in the URL.</p>
12
+
13
+ <p>Here's a link with an amersand in the link text: <a href="http://att.com/" title="AT&amp;T">AT&amp;T</a>.</p>
14
+
15
+ <p>Here's an inline <a href="/script?foo=1&amp;bar=2">link</a>.</p>
16
+
17
+ <p>Here's an inline <a href="/script?foo=1&amp;bar=2">link</a>.</p>
@@ -0,0 +1,21 @@
1
+ AT&T has an ampersand in their name.
2
+
3
+ AT&amp;T is another way to write it.
4
+
5
+ This & that.
6
+
7
+ 4 < 5.
8
+
9
+ 6 > 5.
10
+
11
+ Here's a [link] [1] with an ampersand in the URL.
12
+
13
+ Here's a link with an amersand in the link text: [AT&T] [2].
14
+
15
+ Here's an inline [link](/script?foo=1&bar=2).
16
+
17
+ Here's an inline [link](</script?foo=1&bar=2>).
18
+
19
+
20
+ [1]: http://example.com/?foo=1&bar=2
21
+ [2]: http://att.com/ "AT&T"
@@ -0,0 +1,18 @@
1
+ <p>Link: <a href="http://example.com/">http://example.com/</a>.</p>
2
+
3
+ <p>With an ampersand: <a href="http://example.com/?foo=1&amp;bar=2">http://example.com/?foo=1&amp;bar=2</a></p>
4
+
5
+ <ul>
6
+ <li>In a list?</li>
7
+ <li><a href="http://example.com/">http://example.com/</a></li>
8
+ <li>It should.</li>
9
+ </ul>
10
+
11
+ <blockquote>
12
+ <p>Blockquoted: <a href="http://example.com/">http://example.com/</a></p>
13
+ </blockquote>
14
+
15
+ <p>Auto-links should not occur here: <code>&lt;http://example.com/&gt;</code></p>
16
+
17
+ <pre><code>or here: &lt;http://example.com/&gt;
18
+ </code></pre>
@@ -0,0 +1,13 @@
1
+ Link: <http://example.com/>.
2
+
3
+ With an ampersand: <http://example.com/?foo=1&bar=2>
4
+
5
+ * In a list?
6
+ * <http://example.com/>
7
+ * It should.
8
+
9
+ > Blockquoted: <http://example.com/>
10
+
11
+ Auto-links should not occur here: `<http://example.com/>`
12
+
13
+ or here: <http://example.com/>
@@ -0,0 +1,102 @@
1
+ <p>These should all get escaped:</p>
2
+
3
+ <p>Backslash: \</p>
4
+
5
+ <p>Backtick: `</p>
6
+
7
+ <p>Asterisk: *</p>
8
+
9
+ <p>Underscore: _</p>
10
+
11
+ <p>Left brace: {</p>
12
+
13
+ <p>Right brace: }</p>
14
+
15
+ <p>Left bracket: [</p>
16
+
17
+ <p>Right bracket: ]</p>
18
+
19
+ <p>Left paren: (</p>
20
+
21
+ <p>Right paren: )</p>
22
+
23
+ <p>Greater-than: ></p>
24
+
25
+ <p>Hash: #</p>
26
+
27
+ <p>Period: .</p>
28
+
29
+ <p>Bang: !</p>
30
+
31
+ <p>Plus: +</p>
32
+
33
+ <p>Minus: -</p>
34
+
35
+ <p>These should not, because they occur within a code block:</p>
36
+
37
+ <pre><code>Backslash: \\
38
+
39
+ Backtick: \`
40
+
41
+ Asterisk: \*
42
+
43
+ Underscore: \_
44
+
45
+ Left brace: \{
46
+
47
+ Right brace: \}
48
+
49
+ Left bracket: \[
50
+
51
+ Right bracket: \]
52
+
53
+ Left paren: \(
54
+
55
+ Right paren: \)
56
+
57
+ Greater-than: \&gt;
58
+
59
+ Hash: \#
60
+
61
+ Period: \.
62
+
63
+ Bang: \!
64
+
65
+ Plus: \+
66
+
67
+ Minus: \-
68
+ </code></pre>
69
+
70
+ <p>Nor should these, which occur in code spans:</p>
71
+
72
+ <p>Backslash: <code>\\</code></p>
73
+
74
+ <p>Backtick: <code>\`</code></p>
75
+
76
+ <p>Asterisk: <code>\*</code></p>
77
+
78
+ <p>Underscore: <code>\_</code></p>
79
+
80
+ <p>Left brace: <code>\{</code></p>
81
+
82
+ <p>Right brace: <code>\}</code></p>
83
+
84
+ <p>Left bracket: <code>\[</code></p>
85
+
86
+ <p>Right bracket: <code>\]</code></p>
87
+
88
+ <p>Left paren: <code>\(</code></p>
89
+
90
+ <p>Right paren: <code>\)</code></p>
91
+
92
+ <p>Greater-than: <code>\&gt;</code></p>
93
+
94
+ <p>Hash: <code>\#</code></p>
95
+
96
+ <p>Period: <code>\.</code></p>
97
+
98
+ <p>Bang: <code>\!</code></p>
99
+
100
+ <p>Plus: <code>\+</code></p>
101
+
102
+ <p>Minus: <code>\-</code></p>
@@ -0,0 +1,104 @@
1
+ These should all get escaped:
2
+
3
+ Backslash: \\
4
+
5
+ Backtick: \`
6
+
7
+ Asterisk: \*
8
+
9
+ Underscore: \_
10
+
11
+ Left brace: \{
12
+
13
+ Right brace: \}
14
+
15
+ Left bracket: \[
16
+
17
+ Right bracket: \]
18
+
19
+ Left paren: \(
20
+
21
+ Right paren: \)
22
+
23
+ Greater-than: \>
24
+
25
+ Hash: \#
26
+
27
+ Period: \.
28
+
29
+ Bang: \!
30
+
31
+ Plus: \+
32
+
33
+ Minus: \-
34
+
35
+
36
+
37
+ These should not, because they occur within a code block:
38
+
39
+ Backslash: \\
40
+
41
+ Backtick: \`
42
+
43
+ Asterisk: \*
44
+
45
+ Underscore: \_
46
+
47
+ Left brace: \{
48
+
49
+ Right brace: \}
50
+
51
+ Left bracket: \[
52
+
53
+ Right bracket: \]
54
+
55
+ Left paren: \(
56
+
57
+ Right paren: \)
58
+
59
+ Greater-than: \>
60
+
61
+ Hash: \#
62
+
63
+ Period: \.
64
+
65
+ Bang: \!
66
+
67
+ Plus: \+
68
+
69
+ Minus: \-
70
+
71
+
72
+ Nor should these, which occur in code spans:
73
+
74
+ Backslash: `\\`
75
+
76
+ Backtick: `` \` ``
77
+
78
+ Asterisk: `\*`
79
+
80
+ Underscore: `\_`
81
+
82
+ Left brace: `\{`
83
+
84
+ Right brace: `\}`
85
+
86
+ Left bracket: `\[`
87
+
88
+ Right bracket: `\]`
89
+
90
+ Left paren: `\(`
91
+
92
+ Right paren: `\)`
93
+
94
+ Greater-than: `\>`
95
+
96
+ Hash: `\#`
97
+
98
+ Period: `\.`
99
+
100
+ Bang: `\!`
101
+
102
+ Plus: `\+`
103
+
104
+ Minus: `\-`
@@ -0,0 +1,15 @@
1
+ <blockquote>
2
+ <p>Example:</p>
3
+
4
+ <pre><code>sub status {
5
+ print "working";
6
+ }
7
+ </code></pre>
8
+
9
+ <p>Or:</p>
10
+
11
+ <pre><code>sub status {
12
+ return "working";
13
+ }
14
+ </code></pre>
15
+ </blockquote>