tartan 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/History.txt +11 -0
  2. data/Manifest.txt +42 -0
  3. data/{README → README.txt} +12 -8
  4. data/Rakefile +78 -0
  5. data/lib/core_ext/array.rb +9 -10
  6. data/lib/core_ext/module.rb +2 -0
  7. data/lib/{symbolize.rb → core_ext/symbolize.rb} +0 -0
  8. data/lib/core_ext.rb +7 -0
  9. data/lib/{markdown.yml → tartan/markdown/markdown.yml} +67 -25
  10. data/lib/tartan/markdown/rules.rb +11 -0
  11. data/lib/tartan/markdown.rb +14 -0
  12. data/lib/tartan/table/rules.rb +11 -0
  13. data/lib/{table.yml → tartan/table/table.yml} +1 -1
  14. data/lib/tartan/test/base_rules.rb +9 -0
  15. data/lib/{test_base.yml → tartan/test/test_base.yml} +0 -0
  16. data/lib/{wiki-test.rb → tartan/test/wiki-test.rb} +15 -12
  17. data/lib/tartan/wiki_rule.rb +242 -0
  18. data/lib/tartan/wikilink/rules.rb +18 -0
  19. data/lib/{wikilink.yml → tartan/wikilink/wikilink.yml} +4 -2
  20. data/lib/tartan.rb +259 -270
  21. data/test/test-combo.rb +21 -14
  22. data/test/test-combo.yml +17 -0
  23. data/test/test-markdown-and-wikilink.rb +22 -0
  24. data/test/test-markdown-and-wikilink.yml +6 -0
  25. data/test/test-markdown.rb +4 -5
  26. data/test/test-markdown.yml +194 -1
  27. data/test/test-readme-example.rb +6 -5
  28. data/test/test-tables.rb +11 -7
  29. data/test/test-tartan.rb +8 -7
  30. data/test/test-wikilink.rb +13 -9
  31. data/test/test-wikilink.yml +3 -0
  32. metadata +47 -86
  33. data/lib/tartan_markdown.rb +0 -8
  34. data/lib/tartan_markdown_def.rb +0 -7
  35. data/lib/tartan_table_def.rb +0 -7
  36. data/lib/tartan_test_base_def.rb +0 -5
  37. data/lib/tartan_wikilink_def.rb +0 -14
  38. data/lib/wiki_rule.rb +0 -240
  39. data/test/MarkdownTest_1.0/Amps and angle encoding.html +0 -17
  40. data/test/MarkdownTest_1.0/Amps and angle encoding.text +0 -21
  41. data/test/MarkdownTest_1.0/Auto links.html +0 -18
  42. data/test/MarkdownTest_1.0/Auto links.text +0 -13
  43. data/test/MarkdownTest_1.0/Backslash codeescapes.html +0 -68
  44. data/test/MarkdownTest_1.0/Backslash codeescapes.text +0 -68
  45. data/test/MarkdownTest_1.0/Backslash simpleescapes.html +0 -33
  46. data/test/MarkdownTest_1.0/Backslash simpleescapes.text +0 -33
  47. data/test/MarkdownTest_1.0/Blockquotes with code blocks.html +0 -15
  48. data/test/MarkdownTest_1.0/Blockquotes with code blocks.text +0 -11
  49. data/test/MarkdownTest_1.0/Hard-wrapped paragraphs with list-like lines.html +0 -8
  50. data/test/MarkdownTest_1.0/Hard-wrapped paragraphs with list-like lines.text +0 -8
  51. data/test/MarkdownTest_1.0/Horizontal rules.html +0 -71
  52. data/test/MarkdownTest_1.0/Horizontal rules.text +0 -67
  53. data/test/MarkdownTest_1.0/Inline HTML (Advanced).html +0 -14
  54. data/test/MarkdownTest_1.0/Inline HTML (Advanced).text +0 -14
  55. data/test/MarkdownTest_1.0/Inline HTML (Simple).html +0 -72
  56. data/test/MarkdownTest_1.0/Inline HTML (Simple).text +0 -69
  57. data/test/MarkdownTest_1.0/Inline HTML comments.html +0 -13
  58. data/test/MarkdownTest_1.0/Inline HTML comments.text +0 -13
  59. data/test/MarkdownTest_1.0/Links, inline style.html +0 -9
  60. data/test/MarkdownTest_1.0/Links, inline style.text +0 -9
  61. data/test/MarkdownTest_1.0/Links, reference style.html +0 -18
  62. data/test/MarkdownTest_1.0/Links, reference style.text +0 -31
  63. data/test/MarkdownTest_1.0/Literal quotes in titles.html +0 -3
  64. data/test/MarkdownTest_1.0/Literal quotes in titles.text +0 -7
  65. data/test/MarkdownTest_1.0/Markdown Documentation - Basics.html +0 -314
  66. data/test/MarkdownTest_1.0/Markdown Documentation - Basics.out +0 -316
  67. data/test/MarkdownTest_1.0/Markdown Documentation - Basics.text +0 -306
  68. data/test/MarkdownTest_1.0/Markdown Documentation - Syntax.html +0 -942
  69. data/test/MarkdownTest_1.0/Markdown Documentation - Syntax.out +0 -947
  70. data/test/MarkdownTest_1.0/Markdown Documentation - Syntax.text +0 -888
  71. data/test/MarkdownTest_1.0/Nested blockquotes.html +0 -9
  72. data/test/MarkdownTest_1.0/Nested blockquotes.text +0 -5
  73. data/test/MarkdownTest_1.0/Ordered and unordered lists.html +0 -137
  74. data/test/MarkdownTest_1.0/Ordered and unordered lists.text +0 -122
  75. data/test/MarkdownTest_1.0/Strong and em together.html +0 -7
  76. data/test/MarkdownTest_1.0/Strong and em together.text +0 -7
  77. data/test/MarkdownTest_1.0/Tabs.html +0 -25
  78. data/test/MarkdownTest_1.0/Tabs.text +0 -21
  79. data/test/MarkdownTest_1.0/Tidyness.html +0 -8
  80. data/test/MarkdownTest_1.0/Tidyness.text +0 -5
  81. data/test/MarkdownTest_1.0/run-markdown.rb +0 -56
  82. data/test/MarkdownTest_1.0/test-fireball-markdown.rb +0 -177
  83. data/test/MarkdownTest_1.0/testdiff.rb +0 -42
  84. data/test/harder/test-markdown-harder.rb +0 -11
  85. data/test/harder/test-markdown-harder.yml +0 -111
  86. data/test/redcloth/redcloth-markdown-tests.rb +0 -29
  87. data/test/redcloth/redcloth-markdown-tests.yml +0 -218
  88. data/test/test-tartan-markdown.rb +0 -11
@@ -1,9 +0,0 @@
1
- <blockquote>
2
- <p>foo</p>
3
-
4
- <blockquote>
5
- <p>bar</p>
6
- </blockquote>
7
-
8
- <p>foo</p>
9
- </blockquote>
@@ -1,5 +0,0 @@
1
- > foo
2
- >
3
- > > bar
4
- >
5
- > foo
@@ -1,137 +0,0 @@
1
- <h2>Unordered</h2>
2
-
3
- <p>Asterisks tight:</p>
4
-
5
- <ul>
6
- <li>asterisk 1</li>
7
- <li>asterisk 2</li>
8
- <li>asterisk 3</li>
9
- </ul>
10
-
11
- <p>Asterisks loose:</p>
12
-
13
- <ul>
14
- <li><p>asterisk 1</p></li>
15
- <li><p>asterisk 2</p></li>
16
- <li><p>asterisk 3</p></li>
17
- </ul>
18
-
19
- <hr />
20
-
21
- <p>Pluses tight:</p>
22
-
23
- <ul>
24
- <li>Plus 1</li>
25
- <li>Plus 2</li>
26
- <li>Plus 3</li>
27
- </ul>
28
-
29
- <p>Pluses loose:</p>
30
-
31
- <ul>
32
- <li><p>Plus 1</p></li>
33
- <li><p>Plus 2</p></li>
34
- <li><p>Plus 3</p></li>
35
- </ul>
36
-
37
- <hr />
38
-
39
- <p>Minuses tight:</p>
40
-
41
- <ul>
42
- <li>Minus 1</li>
43
- <li>Minus 2</li>
44
- <li>Minus 3</li>
45
- </ul>
46
-
47
- <p>Minuses loose:</p>
48
-
49
- <ul>
50
- <li><p>Minus 1</p></li>
51
- <li><p>Minus 2</p></li>
52
- <li><p>Minus 3</p></li>
53
- </ul>
54
-
55
- <h2>Ordered</h2>
56
-
57
- <p>Tight:</p>
58
-
59
- <ol>
60
- <li>First</li>
61
- <li>Second</li>
62
- <li>Third</li>
63
- </ol>
64
-
65
- <p>and:</p>
66
-
67
- <ol>
68
- <li>One</li>
69
- <li>Two</li>
70
- <li>Three</li>
71
- </ol>
72
-
73
- <p>Loose using tabs:</p>
74
-
75
- <ol>
76
- <li><p>First</p></li>
77
- <li><p>Second</p></li>
78
- <li><p>Third</p></li>
79
- </ol>
80
-
81
- <p>and using spaces:</p>
82
-
83
- <ol>
84
- <li><p>One</p></li>
85
- <li><p>Two</p></li>
86
- <li><p>Three</p></li>
87
- </ol>
88
-
89
- <p>Multiple paragraphs:</p>
90
-
91
- <ol>
92
- <li><p>Item 1, graf one.</p>
93
-
94
- <p>Item 2. graf two. The quick brown fox jumped over the lazy dog's
95
- back.</p></li>
96
- <li><p>Item 2.</p></li>
97
- <li><p>Item 3.</p></li>
98
- </ol>
99
-
100
- <h2>Nested</h2>
101
-
102
- <ul>
103
- <li>Tab
104
- <ul>
105
- <li>Tab
106
- <ul>
107
- <li>Tab</li>
108
- </ul></li>
109
- </ul></li>
110
- </ul>
111
-
112
- <p>Here's another:</p>
113
-
114
- <ol>
115
- <li>First</li>
116
- <li>Second:
117
- <ul>
118
- <li>Fee</li>
119
- <li>Fie</li>
120
- <li>Foe</li>
121
- </ul></li>
122
- <li>Third</li>
123
- </ol>
124
-
125
- <p>Same thing but with paragraphs:</p>
126
-
127
- <ol>
128
- <li><p>First</p></li>
129
- <li><p>Second:</p>
130
-
131
- <ul>
132
- <li>Fee</li>
133
- <li>Fie</li>
134
- <li>Foe</li>
135
- </ul></li>
136
- <li><p>Third</p></li>
137
- </ol>
@@ -1,122 +0,0 @@
1
- ## Unordered
2
-
3
- Asterisks tight:
4
-
5
- * asterisk 1
6
- * asterisk 2
7
- * asterisk 3
8
-
9
-
10
- Asterisks loose:
11
-
12
- * asterisk 1
13
-
14
- * asterisk 2
15
-
16
- * asterisk 3
17
-
18
- * * *
19
-
20
- Pluses tight:
21
-
22
- + Plus 1
23
- + Plus 2
24
- + Plus 3
25
-
26
-
27
- Pluses loose:
28
-
29
- + Plus 1
30
-
31
- + Plus 2
32
-
33
- + Plus 3
34
-
35
- * * *
36
-
37
-
38
- Minuses tight:
39
-
40
- - Minus 1
41
- - Minus 2
42
- - Minus 3
43
-
44
-
45
- Minuses loose:
46
-
47
- - Minus 1
48
-
49
- - Minus 2
50
-
51
- - Minus 3
52
-
53
-
54
- ## Ordered
55
-
56
- Tight:
57
-
58
- 1. First
59
- 2. Second
60
- 3. Third
61
-
62
- and:
63
-
64
- 1. One
65
- 2. Two
66
- 3. Three
67
-
68
-
69
- Loose using tabs:
70
-
71
- 1. First
72
-
73
- 2. Second
74
-
75
- 3. Third
76
-
77
- and using spaces:
78
-
79
- 1. One
80
-
81
- 2. Two
82
-
83
- 3. Three
84
-
85
- Multiple paragraphs:
86
-
87
- 1. Item 1, graf one.
88
-
89
- Item 2. graf two. The quick brown fox jumped over the lazy dog's
90
- back.
91
-
92
- 2. Item 2.
93
-
94
- 3. Item 3.
95
-
96
-
97
-
98
- ## Nested
99
-
100
- * Tab
101
- * Tab
102
- * Tab
103
-
104
- Here's another:
105
-
106
- 1. First
107
- 2. Second:
108
- * Fee
109
- * Fie
110
- * Foe
111
- 3. Third
112
-
113
- Same thing but with paragraphs:
114
-
115
- 1. First
116
-
117
- 2. Second:
118
- * Fee
119
- * Fie
120
- * Foe
121
-
122
- 3. Third
@@ -1,7 +0,0 @@
1
- <p><strong><em>This is strong and em.</em></strong></p>
2
-
3
- <p>So is <strong><em>this</em></strong> word.</p>
4
-
5
- <p><strong><em>This is strong and em.</em></strong></p>
6
-
7
- <p>So is <strong><em>this</em></strong> word.</p>
@@ -1,7 +0,0 @@
1
- ***This is strong and em.***
2
-
3
- So is ***this*** word.
4
-
5
- ___This is strong and em.___
6
-
7
- So is ___this___ word.
@@ -1,25 +0,0 @@
1
- <ul>
2
- <li><p>this is a list item
3
- indented with tabs</p></li>
4
- <li><p>this is a list item
5
- indented with spaces</p></li>
6
- </ul>
7
-
8
- <p>Code:</p>
9
-
10
- <pre><code>this code block is indented by one tab
11
- </code></pre>
12
-
13
- <p>And:</p>
14
-
15
- <pre><code> this code block is indented by two tabs
16
- </code></pre>
17
-
18
- <p>And:</p>
19
-
20
- <pre><code>+ this is an example list item
21
- indented with tabs
22
-
23
- + this is an example list item
24
- indented with spaces
25
- </code></pre>
@@ -1,21 +0,0 @@
1
- + this is a list item
2
- indented with tabs
3
-
4
- + this is a list item
5
- indented with spaces
6
-
7
- Code:
8
-
9
- this code block is indented by one tab
10
-
11
- And:
12
-
13
- this code block is indented by two tabs
14
-
15
- And:
16
-
17
- + this is an example list item
18
- indented with tabs
19
-
20
- + this is an example list item
21
- indented with spaces
@@ -1,8 +0,0 @@
1
- <blockquote>
2
- <p>A list within a blockquote:</p>
3
- <ul>
4
- <li>asterisk 1</li>
5
- <li>asterisk 2</li>
6
- <li>asterisk 3</li>
7
- </ul>
8
- </blockquote>
@@ -1,5 +0,0 @@
1
- > A list within a blockquote:
2
- >
3
- > * asterisk 1
4
- > * asterisk 2
5
- > * asterisk 3
@@ -1,56 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #$Id: run-markdown.rb 174 2006-08-21 14:51:12Z bitherder $
3
- $:.unshift File.join(File.dirname(__FILE__), "../..", "lib")
4
-
5
- require 'tartan'
6
- require 'tartan_markdown'
7
- # require 'profile'
8
-
9
- class WikiparserRunner
10
- def self.run(base, *other_args)
11
- wikiFileName=base + ".text"
12
- outFileName=base + ".out"
13
-
14
- options = {}
15
- args = []
16
- other_args.each do |arg|
17
- if arg =~ /([^=]+)=(.*)/
18
-
19
- key = $1
20
- value = $2
21
-
22
- if key =~ /^:(.*)$/
23
- key = $1.to_sym
24
- end
25
-
26
- value = case value
27
- when /^:(.*)/
28
- $1.to_sym
29
- when /^[tT]rue$/
30
- true
31
- when /^[fF]alse$/
32
- false
33
- else
34
- value
35
- end
36
-
37
- options[key] = value
38
- else
39
- args << arg
40
- end
41
- end
42
-
43
- text = File.open(wikiFileName).read
44
- require 'profile' if options['profile']
45
- wp = TartanMarkdown.new(text, options)
46
- html = wp.to_html
47
- outFile = File.open(outFileName, "w+")
48
- outFile.puts html
49
- outFile.rewind
50
- outFile
51
- end
52
- end
53
-
54
- if __FILE__ == $0
55
- WikiparserRunner.run(*ARGV).close
56
- end
@@ -1,177 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #$Id: test-fireball-markdown.rb 148 2006-07-22 14:04:20Z larry $
3
- $:.unshift File.join(File.dirname(__FILE__), "../..", "lib")
4
-
5
- require 'test/unit'
6
- require 'tartan'
7
- require 'markdown'
8
- require 'profile'
9
-
10
- class TestMarkdown < Test::Unit::TestCase
11
- def setup
12
- @basePara = "Now is the time for all good men..."
13
- @nl = "\n"
14
- end
15
-
16
- def testAmps
17
- text = File.open('Amps and angle encoding.text').read
18
- truehtml = File.open('Amps and angle encoding.html').read
19
- wp = Wikiparser.new(text)
20
- html = wp.to_html
21
- assert_equal truehtml, html
22
- end
23
-
24
- def testAutolinks
25
- text = File.open('Auto links.text').read
26
- truehtml = File.open('Auto links.html').read
27
- wp = Wikiparser.new(text)
28
- html = wp.to_html
29
- assert_equal truehtml, html
30
- end
31
-
32
- def testBackslashsimpleescapes
33
- text = File.open('Backslash simpleescapes.text').read
34
- truehtml = File.open('Backslash simpleescapes.html').read
35
- wp = Wikiparser.new(text)
36
- html = wp.to_html
37
- assert_equal truehtml, html
38
- end
39
-
40
- def testBackslashcodeescapes
41
- text = File.open('Backslash codeescapes.text').read
42
- truehtml = File.open('Backslash codeescapes.html').read
43
- wp = Wikiparser.new(text)
44
- html = wp.to_html
45
- assert_equal truehtml, html
46
- end
47
-
48
- def testBlockquoteswithcodeblocks
49
- text = File.open('Blockquotes with code blocks.text').read
50
- truehtml = File.open('Blockquotes with code blocks.html').read
51
- wp = Wikiparser.new(text)
52
- html = wp.to_html
53
- assert_equal truehtml, html
54
- end
55
-
56
- def testHardwrappedparagraphswithlistlikelines
57
- text = File.open('Hard-wrapped paragraphs with list-like lines.text').read
58
- truehtml = File.open('Hard-wrapped paragraphs with list-like lines.html').read
59
- wp = Wikiparser.new(text)
60
- html = wp.to_html
61
- assert_equal truehtml, html
62
- end
63
-
64
- def testHorizontalrules
65
- text = File.open('Horizontal rules.text').read
66
- truehtml = File.open('Horizontal rules.html').read
67
- wp = Wikiparser.new(text)
68
- html = wp.to_html
69
- assert_equal truehtml, html
70
- end
71
-
72
- def testInlineHTMLcomments
73
- text = File.open('Inline HTML comments.text').read
74
- truehtml = File.open('Inline HTML comments.html').read
75
- wp = Wikiparser.new(text)
76
- html = wp.to_html
77
- assert_equal truehtml, html
78
- end
79
-
80
- def testInlineHTMLAdvanced
81
- text = File.open('Inline HTML (Advanced).text').read
82
- truehtml = File.open('Inline HTML (Advanced).html').read
83
- wp = Wikiparser.new(text)
84
- html = wp.to_html
85
- assert_equal truehtml, html
86
- end
87
-
88
- def testInlineHTMLSimple
89
- text = File.open('Inline HTML (Simple).text').read
90
- truehtml = File.open('Inline HTML (Simple).html').read
91
- wp = Wikiparser.new(text)
92
- html = wp.to_html
93
- assert_equal truehtml, html
94
- end
95
-
96
- def testLinksinlinestyle
97
- text = File.open('Links, inline style.text').read
98
- truehtml = File.open('Links, inline style.html').read
99
- wp = Wikiparser.new(text)
100
- html = wp.to_html
101
- assert_equal truehtml, html
102
- end
103
-
104
- def testLinksreferencestyle
105
- text = File.open('Links, reference style.text').read
106
- truehtml = File.open('Links, reference style.html').read
107
- wp = Wikiparser.new(text)
108
- html = wp.to_html
109
- assert_equal truehtml, html
110
- end
111
-
112
- def testLiteralquotesintitles
113
- text = File.open('Literal quotes in titles.text').read
114
- truehtml = File.open('Literal quotes in titles.html').read
115
- wp = Wikiparser.new(text)
116
- html = wp.to_html
117
- assert_equal truehtml, html
118
- end
119
-
120
- def testMarkdownDocumentationBasics
121
- text = File.open('Markdown Documentation - Basics.text').read
122
- truehtml = File.open('Markdown Documentation - Basics.html').read
123
- wp = Wikiparser.new(text)
124
- html = wp.to_html
125
- assert_equal truehtml, html
126
- end
127
-
128
- def testMarkdownDocumentationSyntax
129
- text = File.open('Markdown Documentation - Syntax.text').read
130
- truehtml = File.open('Markdown Documentation - Syntax.html').read
131
- wp = Wikiparser.new(text)
132
- html = wp.to_html
133
- assert_equal truehtml, html
134
- end
135
-
136
- def testNestedblockquotes
137
- text = File.open('Nested blockquotes.text').read
138
- truehtml = File.open('Nested blockquotes.html').read
139
- wp = Wikiparser.new(text)
140
- html = wp.to_html
141
- assert_equal truehtml, html
142
- end
143
-
144
- def testOrderedandunorderedlists
145
- text = File.open('Ordered and unordered lists.text').read
146
- truehtml = File.open('Ordered and unordered lists.html').read
147
- wp = Wikiparser.new(text)
148
- html = wp.to_html
149
- assert_equal truehtml, html
150
- end
151
-
152
- def testStrongandemtogether
153
- text = File.open('Strong and em together.text').read
154
- truehtml = File.open('Strong and em together.html').read
155
- wp = Wikiparser.new(text)
156
- html = wp.to_html
157
- assert_equal truehtml, html
158
- end
159
-
160
- def testTabs
161
- text = File.open('Tabs.text').read
162
- truehtml = File.open('Tabs.html').read
163
- wp = Wikiparser.new(text)
164
- html = wp.to_html
165
- assert_equal truehtml, html
166
- end
167
-
168
- def testTidyness
169
- text = File.open('Tidyness.text').read
170
- truehtml = File.open('Tidyness.html').read
171
- wp = Wikiparser.new(text)
172
- html = wp.to_html
173
- assert_equal truehtml, html
174
- end
175
-
176
-
177
- end
@@ -1,42 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'tempfile'
4
- require './run-markdown'
5
-
6
- def translate_file(fileIn, initialText)
7
-
8
- if fileIn.class == String
9
- file = open(fileIn)
10
- else
11
- file = fileIn
12
- end
13
-
14
- tmpFile = Tempfile.new('wikiparser')
15
-
16
- tmpFile.puts(initialText)
17
-
18
- file.each {|line|
19
- line.gsub!(/ /, '.')
20
- line.gsub!(/\t/, '\t')
21
-
22
- tmpFile.write line
23
- }
24
-
25
- tmpFile.flush
26
- tmpFile
27
- end
28
-
29
- termWidth = `stty -a`.gsub(/[^0-9;]/, '').sub(/^(?:.*?;){2}([0-9]+).*$/m, '\1')
30
-
31
- base = ARGV[0]
32
-
33
- outFile = WikiparserRunner.run(base)
34
-
35
- htmlTmp = translate_file(base + ".html", "Refernce HTML\n\n")
36
- outTmp = translate_file(outFile, "Generated HTML\n\n")
37
-
38
- pager = ENV['PAGER']? ENV['PAGER'] : "less"
39
-
40
- system("sdiff -w #{termWidth} #{htmlTmp.path} #{outTmp.path} | #{pager}")
41
-
42
-
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env ruby
2
- #$Id: test-markdown.rb 75 2006-02-07 00:09:26Z larry $
3
-
4
- $:.unshift File.join(File.dirname(__FILE__), "../..", "lib")
5
-
6
- require 'tartan_markdown'
7
- require 'wiki-test'
8
-
9
- cases = WikiTestCases.new(TartanMarkdown, "test-markdown-harder.yml")
10
-
11
-