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
data/lib/tartan.rb CHANGED
@@ -1,80 +1,9 @@
1
- #$Id: tartan.rb 159 2006-07-24 08:13:02Z larry $
1
+ #$Id: tartan.rb 194 2007-04-24 07:53:09Z bitherder $
2
2
 
3
3
  require 'rubygems'
4
4
  require 'yaml'
5
- require 'core_ext/hash'
6
- require 'core_ext/match_data'
7
- require 'wiki_rule'
8
- require 'symbolize'
9
- require 'core_ext/module'
10
- require 'core_ext/array'
11
-
12
- class Shelf
13
- Front = "\001"
14
- Back = "\002"
15
-
16
- def initialize
17
- @counter = 0
18
- @hash = {}
19
- end
20
-
21
- def replacement(i)
22
- replacement = String.new(Front + i.to_s + Back)
23
- end
24
-
25
- def shelve(string)
26
- @counter = @counter.next
27
- @hash[@counter] = string
28
- replacement(@counter)
29
- end
30
-
31
- def putback(text)
32
- new_text = text.gsub(/#{Front}([[:digit:]]+)#{Back}/) do
33
- putback(@hash[$1.to_i])
34
- end
35
- end
36
- end
37
-
38
- class ParsedText < String
39
- def initialize(claimed, value)
40
- super(value)
41
- @claimed = claimed
42
- end
43
-
44
- def claimed?
45
- @claimed
46
- end
47
- end
48
-
49
- class ParsedTextList < Array
50
- def initialize(*args)
51
- self
52
-
53
- if 1 == args.length
54
- add_text(false, args[0])
55
- end
56
- end
57
-
58
- def add_text(claimed, text)
59
- push(ParsedText.new(claimed, text))
60
- end
61
-
62
- def add(text_element)
63
- push(text_element)
64
- end
65
-
66
- def add_back(text_element)
67
- parsed_text = args.first
68
- unshift(parsed_text)
69
- end
70
-
71
- def add_back_text(claimed, text)
72
- unshift(ParsedText.new(claimed, text))
73
- end
74
-
75
- alias :to_s :join
76
- end
77
-
5
+ require 'core_ext'
6
+ require 'tartan/wiki_rule'
78
7
 
79
8
  class Object
80
9
  def wiki_hash
@@ -100,260 +29,320 @@ class Array
100
29
  end
101
30
  end
102
31
 
103
- class WikiDefs < Hash
104
- class << self
105
- def find_file_in_path(file_name)
106
- $:.each do |path|
107
- file = path+'/'+file_name
108
- return file if File.file?(file)
32
+
33
+ module Tartan
34
+ class Shelf
35
+ Front = "\001"
36
+ Back = "\002"
37
+
38
+ def initialize
39
+ @counter = 0
40
+ @hash = {}
41
+ end
42
+
43
+ def replacement(i)
44
+ replacement = String.new(Front + i.to_s + Back)
45
+ end
46
+
47
+ def shelve(string)
48
+ @counter = @counter.next
49
+ @hash[@counter] = string
50
+ replacement(@counter)
51
+ end
52
+
53
+ def putback(text)
54
+ new_text = text.gsub(/#{Front}([[:digit:]]+)#{Back}/) do
55
+ putback(@hash[$1.to_i])
56
+ end
109
57
  end
110
-
111
- raise ArgumentError, "Can't find file #{file_name} in Ruby library path"
112
- end
113
58
  end
114
-
115
- # Initialize initial defs
116
- def initialize(external_defs={})
117
- add(external_defs)
59
+
60
+ class ParsedText < String
61
+ def initialize(claimed, value)
62
+ super(value)
63
+ @claimed = claimed
64
+ end
65
+
66
+ def claimed?
67
+ @claimed
68
+ end
118
69
  end
119
70
 
120
- def find_sub_hash_index(hash_array, title)
121
- index = hash_array.index { |sub_hash|
122
- sub_hash.title == title
123
- }
71
+ class ParsedTextList < Array
72
+ def initialize(*args)
73
+ if 1 == args.length
74
+ add_text(false, args[0])
75
+ end
76
+ end
77
+
78
+ def add_text(claimed, text)
79
+ push(ParsedText.new(claimed, text))
80
+ end
81
+
82
+ def add(text_element)
83
+ push(text_element)
84
+ end
85
+
86
+ def add_back(text_element)
87
+ parsed_text = args.first
88
+ unshift(parsed_text)
89
+ end
90
+
91
+ def add_back_text(claimed, text)
92
+ unshift(ParsedText.new(claimed, text))
93
+ end
94
+
95
+ alias :to_s :join
124
96
  end
97
+
98
+ class WikiDefs < Hash
99
+ class << self
100
+ def find_file_in_path(file_name)
101
+ $:.each do |path|
102
+ file = path+'/'+file_name
103
+ return file if File.file?(file)
104
+ end
105
+
106
+ raise ArgumentError, "Can't find file #{file_name} in Ruby library path"
107
+ end
108
+ end
125
109
 
126
- def add_yaml_file(def_file)
127
- file_with_path = WikiDefs.find_file_in_path(def_file)
110
+ # Initialize initial defs
111
+ def initialize(external_defs={})
112
+ add(external_defs)
113
+ end
128
114
 
129
- defs = YAML.load_file(file_with_path).symbolize
115
+ def find_sub_hash_index(hash_array, title)
116
+ index = hash_array.index { |sub_hash| sub_hash.title == title }
117
+ end
118
+
119
+ def add_yaml_file(def_file)
120
+ file_with_path = WikiDefs.find_file_in_path(def_file)
121
+
122
+ defs = YAML.load_file(file_with_path).symbolize
130
123
 
131
- add(defs)
132
- end
124
+ add(defs)
125
+ end
133
126
 
134
- def add(defs)
135
- defs.wiki_hash {|h| add_hash(h)}
136
- self
137
- end
127
+ def add(defs)
128
+ defs.wiki_hash {|h| add_hash(h)}
129
+ self
130
+ end
138
131
 
139
- def add_hash(external_defs)
140
- external_defs.each {|context_name, external_rule_list|
141
- self[context_name] ||= []
142
- # self[context_name] ||= Dictionary.new
143
- rule_dictionary = self[context_name]
132
+ def add_hash(external_defs)
133
+ external_defs.each {|context_name, external_rule_list|
134
+ self[context_name] ||= []
135
+ # self[context_name] ||= Dictionary.new
136
+ rule_dictionary = self[context_name]
144
137
 
145
- external_rule_list.each { |proto_rule|
146
- rule = case proto_rule
147
- when WikiRule: proto_rule
148
- when Symbol, String: WikiRule.new({ proto_rule => true })
149
- when Hash: WikiRule.new(proto_rule);
150
- else raise ArgumentError, "each matching rule must be a Hash"
151
- end
138
+ external_rule_list.each { |proto_rule|
139
+ rule = case proto_rule
140
+ when WikiRule: proto_rule
141
+ when Symbol, String: WikiRule.new({ proto_rule => true })
142
+ when Hash: WikiRule.new(proto_rule);
143
+ else raise ArgumentError, "each matching rule must be a Hash"
144
+ end
152
145
 
153
- if rule.template
154
- index = find_sub_hash_index(self[context_name], rule.template)
146
+ if rule.template
147
+ index = find_sub_hash_index(self[context_name], rule.template)
155
148
 
156
- rule = WikiRule.new(self[context_name][index].merge(rule))
157
- end
149
+ rule = WikiRule.new(self[context_name][index].merge(rule))
150
+ end
158
151
 
159
- if rule.before
160
- # rule_dictionary
161
- addByPosition(context_name, rule, :before)
162
- rule.placed(:before)
163
- elsif rule.after
164
- addByPosition(context_name, rule, :after, 1)
165
- rule.placed(:after)
166
- elsif rule.beginning
167
- self[context_name].unshift(rule)
168
- rule.placed(:beginning)
169
- else
170
- self[context_name].push(rule)
171
- end
152
+ if rule.before
153
+ # rule_dictionary
154
+ addByPosition(context_name, rule, :before)
155
+ rule.placed(:before)
156
+ elsif rule.after
157
+ addByPosition(context_name, rule, :after, 1)
158
+ rule.placed(:after)
159
+ elsif rule.beginning
160
+ self[context_name].unshift(rule)
161
+ rule.placed(:beginning)
162
+ else
163
+ self[context_name].push(rule)
164
+ end
165
+ }
172
166
  }
173
- }
174
- end
167
+ end
175
168
 
176
- private
169
+ private
177
170
 
178
- def addByPosition(context_name, rule, position, index_offset=0)
179
- index = find_sub_hash_index(self[context_name], rule[position])
180
-
181
- unless index
182
- raise "\"#{rule.title}\" can not be added #{position.to_s}" +
183
- " \"#{rule[position]}\", because it does not exist"
171
+ def addByPosition(context_name, rule, position, index_offset=0)
172
+ index = find_sub_hash_index(self[context_name], rule[position])
173
+ unless index
174
+ raise "\"#{rule.title}\" can not be added #{position.to_s}" +
175
+ " \"#{rule[position]}\", because it does not exist"
176
+ end
177
+ self[context_name].insert(index+index_offset, rule)
184
178
  end
185
- self[context_name].insert(index+index_offset, rule)
186
179
  end
187
- end
188
180
 
189
- class Tartan < String
190
- class << self
191
- def yaml(file_name)
192
- @defs ||= WikiDefs.new
193
- @defs.add_yaml_file(file_name)
194
- end
181
+ class Parser < String
182
+ class << self
183
+ def yaml(file_name)
184
+ @defs ||= WikiDefs.new
185
+ @defs.add_yaml_file(file_name)
186
+ end
195
187
 
196
- def defs
197
- @defs
198
- end
188
+ def defs
189
+ @defs
190
+ end
199
191
 
200
- def add_defs (def_set)
201
- @defs ||= WikiDefs.new
202
- @defs.add(def_set)
203
- end
192
+ def add_defs (def_set)
193
+ @defs ||= WikiDefs.new
194
+ @defs.add(def_set)
195
+ end
204
196
 
205
- alias :set_defs :add_defs
206
- end
197
+ alias :set_defs :add_defs
198
+ end
207
199
 
208
- # parser helper methods
200
+ # parser helper methods
209
201
 
210
- def initialize_helper
211
- @sequences = {}
212
- end
202
+ def initialize_helper
203
+ @sequences = {}
204
+ end
213
205
 
214
- def count(str)
215
- str.length
216
- end
206
+ def count(str)
207
+ str.length
208
+ end
217
209
 
218
- def sequence(sequence_id)
219
- @sequences[sequence_id] ||= 0
220
- @sequences[sequence_id] += 1
221
- end
210
+ def sequence(sequence_id)
211
+ @sequences[sequence_id] ||= 0
212
+ @sequences[sequence_id] += 1
213
+ end
222
214
 
223
- def sequence_reset(sequence_id)
224
- @sequences[sequence_id] = 0
225
- end
215
+ def sequence_reset(sequence_id)
216
+ @sequences[sequence_id] = 0
217
+ end
226
218
 
227
- def untabify(text)
228
- text.gsub(/(\n?)(?:([^\t\n]{4})|([^\t\n]*)\t)/n) {$1+[$+].pack("A4")}
229
- end
219
+ def untabify(text)
220
+ text.gsub(/(\n?)(?:([^\t\n]{4})|([^\t\n]*)\t)/n) {$1+[$+].pack("A4")}
221
+ end
230
222
 
231
- def len(text)
232
- text.length
233
- end
223
+ def len(text)
224
+ text.length
225
+ end
234
226
 
235
- def finalize(type, text)
236
- text
237
- end
227
+ def finalize(type, text)
228
+ text
229
+ end
238
230
 
239
- # core Tartan methods
231
+ # core Tartan methods
240
232
 
241
- def initialize(wstring, options=nil)
242
- wstring.gsub!(/\r/, '')
233
+ def initialize(wstring, options=nil)
234
+ wstring.gsub!(/\r/, '')
243
235
 
244
- @default_rule = WikiRule.new
236
+ @default_rule = WikiRule.new
245
237
 
246
- @shelf = Shelf.new
238
+ @shelf = Shelf.new
247
239
 
248
- @wiki_string = wstring
240
+ @wiki_string = wstring
249
241
 
250
- if !options
251
- if defined? WikiOptions
252
- @options = WikiOptions.dup
253
- else
254
- @options = {}
255
- end
256
- else
257
- @options = options
258
- end
242
+ if !options
243
+ if defined? WikiOptions
244
+ @options = WikiOptions.dup
245
+ else
246
+ @options = {}
247
+ end
248
+ else
249
+ @options = options
250
+ end
259
251
 
260
- initialize_helper
261
- end
252
+ initialize_helper
253
+ end
262
254
 
263
- def substitute(string, match)
264
- # do function value substutution
265
- local_string = string.gsub(/#\{([a-zA-Z_]+)(?:\((.*?)\))?\}/m) {|to_eval|
266
- function_match = $~
255
+ def substitute(string, match)
256
+ # do function value substutution
257
+ local_string = string.gsub(/#\{([a-zA-Z_]+)(?:\((.*?)\))?\}/m) {|to_eval|
258
+ function_match = $~
267
259
 
268
- # break the parameters up
269
- # '-1' used to retain all parameters even if they are empty
270
- params = function_match[2].split(/,/,-1)
260
+ # break the parameters up
261
+ # '-1' used to retain all parameters even if they are empty
262
+ params = function_match[2].split(/,/,-1)
271
263
 
272
- params.collect! { |param|
273
- "nul param" ": " + string if ! param
274
- substitute(param, match)
275
- }
264
+ params.collect! { |param|
265
+ "nul param" ": " + string if ! param
266
+ substitute(param, match)
267
+ }
276
268
 
277
- send(function_match[1].to_sym, *params)
278
- }
269
+ send(function_match[1].to_sym, *params)
270
+ }
279
271
 
280
- local_string = match.replace(local_string) if match
272
+ local_string = match.replace(local_string) if match
281
273
 
282
- # do variable substitution
283
- return local_string.gsub(/\{\{\{(.+?)\}\}\}/) {|var| get_var($1)}
284
- end
274
+ # do variable substitution
275
+ return local_string.gsub(/\{\{\{(.+?)\}\}\}/) {|var| get_var($1)}
276
+ end
285
277
 
286
- def shelve(string)
287
- @shelf.shelve(string)
288
- end
278
+ def shelve(string)
279
+ @shelf.shelve(string)
280
+ end
289
281
 
290
- def to_type(type=:html)
291
- out = @shelf.putback(parse_by_context(type, :block, @wiki_string))
292
- finalize(type, out)
293
- end
282
+ def to_type(type=:html, context=:block)
283
+ out = @shelf.putback(parse_by_context(type, context, @wiki_string))
284
+ finalize(type, out)
285
+ end
294
286
 
295
- alias :to_html :to_type
287
+ alias :to_html :to_type
296
288
 
297
- def to_db
298
- to_type(:db)
299
- end
300
-
301
- def set_vars(var_cluster, match)
302
- return unless var_cluster
289
+ def set_vars(var_cluster, match)
290
+ return unless var_cluster
303
291
 
304
- if Array == var_cluster.class
305
- var_cluster.each do |a_hash|
306
- set_vars(a_hash, match)
307
- end
308
- return
309
- end
292
+ if Array == var_cluster.class
293
+ var_cluster.each do |a_hash|
294
+ set_vars(a_hash, match)
295
+ end
296
+ return
297
+ end
310
298
 
311
- local_hash = var_cluster.dup
299
+ local_hash = var_cluster.dup
312
300
 
313
- var_cluster.each do |var_name,var_val|
314
- var_val = substitute(var_val, match)
315
- var_name = substitute(var_name, match)
301
+ var_cluster.each do |var_name,var_val|
302
+ var_val = substitute(var_val, match)
303
+ var_name = substitute(var_name, match)
316
304
 
317
- local_hash[var_name] = var_val
318
- # allow case-insensitive names via :set for markdown
319
- local_hash[var_name.downcase] = var_val
320
- end
321
- @options.merge!(local_hash)
322
- end
305
+ local_hash[var_name] = var_val
306
+ # allow case-insensitive names via :set for markdown
307
+ local_hash[var_name.downcase] = var_val
308
+ end
309
+ @options.merge!(local_hash)
310
+ end
323
311
 
324
- def get_var(var)
325
- # not all variable names are downcased
326
- value = @options[var]
327
- value ||= @options[var.downcase]
328
- return value
329
- end
312
+ def get_var(var)
313
+ # not all variable names are downcased
314
+ value = @options[var]
315
+ value ||= @options[var.downcase]
316
+ return value
317
+ end
330
318
 
331
- def parse_by_context(parse_type, parse_context, parse_string)
332
- parsing = ParsedTextList.new(parse_string)
319
+ def parse_by_context(parse_type, parse_context, parse_string)
320
+ parsing = ParsedTextList.new(parse_string)
333
321
 
334
- self.class.defs[parse_context].each do |rule|
322
+ self.class.defs[parse_context].each do |rule|
335
323
 
336
- if rule.default_rule
337
- @default_rule = @default_rule.deep_merge(rule)
338
- next if rule.ignore
339
- else
340
- next if rule.ignore
341
- rule = @default_rule.deep_merge(rule)
342
- end
324
+ if rule.default_rule
325
+ @default_rule = @default_rule.deep_merge(rule)
326
+ next if rule.ignore
327
+ else
328
+ next if rule.ignore
329
+ rule = @default_rule.deep_merge(rule)
330
+ end
343
331
 
344
- if !rule.match && rule.vars_to_set
345
- set_vars(rule.vars_to_set, nil)
346
- end
332
+ if !rule.match && rule.vars_to_set
333
+ set_vars(rule.vars_to_set, nil)
334
+ end
347
335
 
348
- if rule.match
349
- parsing = rule.parse_element(parse_type, parsing, self)
350
- end
336
+ if rule.match
337
+ parsing = rule.parse_element(parse_type, parsing, self)
338
+ end
351
339
 
352
- if rule.rescan
353
- parsing = ParsedTextList.new(parsing.to_s)
354
- end
355
- end
340
+ if rule.rescan
341
+ parsing = ParsedTextList.new(parsing.to_s)
342
+ end
343
+ end
356
344
 
357
- parsing.to_s
345
+ parsing.to_s
346
+ end
358
347
  end
359
- end
348
+ end # Tartan
data/test/test-combo.rb CHANGED
@@ -1,23 +1,30 @@
1
1
  #!/usr/bin/env ruby
2
- #$Id: test-combo.rb 159 2006-07-24 08:13:02Z larry $
2
+ #$Id: test-combo.rb 190 2007-02-22 15:12:19Z bitherder $
3
3
 
4
4
  $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
5
5
 
6
- require 'tartan_markdown'
7
- require 'tartan_wikilink_def'
8
- require 'tartan_table_def'
6
+ require 'tartan/markdown'
7
+ require 'tartan/wikilink/rules'
8
+ require 'tartan/table/rules'
9
+ require 'tartan/test/wiki-test'
9
10
  require 'wikilink-test-helper'
10
- require 'wiki-test'
11
11
 
12
- class TartanTestAll < Tartan
13
- include TartanMarkdownDef
14
- include TartanWikilinkDef
15
- include TartanTableDef
16
- include WikilinkTestHelper
12
+ module Tartan
13
+ module Combo
14
+ class Parser < Tartan::Parser
15
+ include Tartan::Markdown::Rules
16
+ include Tartan::Wikilink::Rules
17
+ include Tartan::Table::Rules
18
+ include WikilinkTestHelper
19
+ end
20
+ end
17
21
  end
18
22
 
19
- cases = WikiTestCases.new(TartanTestAll,
20
- [ "test-wikilink.yml",
21
- "test-markdown.yml",
22
- "test-tables.yml"])
23
+ cases = WikiTestCases.new( Tartan::Combo::Parser,
24
+ [ "test-wikilink.yml",
25
+ "test-markdown.yml",
26
+ "test-tables.yml",
27
+ "test-combo.yml"
28
+ ]
29
+ )
23
30
 
@@ -0,0 +1,17 @@
1
+ #$Id: test-tables.yml 124 2006-05-07 16:28:09Z larry $
2
+
3
+ title: TableInCodeBlock
4
+ in: " [|bob||jim|]"
5
+ html: |-
6
+ <pre><code>[|bob||jim|]
7
+ </code></pre>
8
+ ---
9
+ title: TableInBackquotes
10
+ in: '`[|bob||jim|]`'
11
+ html: |-
12
+ <p><code>[|bob||jim|]</code></p>
13
+ ---
14
+ title:
15
+ in: "[| [[Blog]] (new!) |]"
16
+ html: |-
17
+ <table class=""><tr><td><a class="existing" href="/prefix/Blog">Blog</a> (new!)</td></tr></table>
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env ruby
2
+ #$Id: test-markdown-and-wikilink.rb 194 2007-04-24 07:53:09Z bitherder $
3
+
4
+ $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
5
+
6
+ require 'tartan'
7
+ require 'tartan/wikilink/rules'
8
+ require 'tartan/test/wiki-test'
9
+ require 'tartan/test/base_rules'
10
+ require 'wikilink-test-helper'
11
+
12
+ module Tartan
13
+ module Wikilink
14
+ class Parser < Tartan::Parser
15
+ include Tartan::Markdown::Rules
16
+ include Tartan::Wikilink::Rules
17
+ include WikilinkTestHelper
18
+ end
19
+ end
20
+ end
21
+
22
+ cases = WikiTestCases.new(Tartan::Wikilink::Parser, "test-markdown-and-wikilink.yml")