pseudohikiparser 0.0.0.10.develop → 0.0.0.11.develop
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.
- checksums.yaml +7 -0
- data/README.md +31 -2
- data/lib/pseudohiki/blockparser.rb +51 -16
- data/lib/pseudohiki/htmlformat.rb +24 -0
- data/lib/pseudohiki/markdownformat.rb +8 -1
- data/lib/pseudohiki/version.rb +1 -1
- data/test/test_blockparser.rb +29 -0
- data/test/test_htmlformat.rb +63 -0
- data/test/test_markdownformat.rb +60 -0
- metadata +27 -35
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5b41d1dc1538c8a205df9d0e3674ce36cfe7a269
|
4
|
+
data.tar.gz: 4d41b79b26ea37bac306dcb392f9e413dfab0be5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ad7e6d96413aebd099166d449b57c83ca4a816130daef33ed962c3d87f02d1fad5afeb1b7aed576034bb600121fe61590ebe0b4ec15d3f4daedcea7bc048f962
|
7
|
+
data.tar.gz: 0320942f7181a5c045ea2a28d41a932ee0508d6dc5f438958e3e539a05861efd9f5c908d37f05ae8062551df174dfca8e4c5a69c9803b31d70e08dbc55877cd4
|
data/README.md
CHANGED
@@ -25,7 +25,6 @@ BSD 2-Clause License
|
|
25
25
|
gem install pseudohikiparser --pre
|
26
26
|
```
|
27
27
|
|
28
|
-
|
29
28
|
## Usage
|
30
29
|
|
31
30
|
### Samples
|
@@ -34,7 +33,6 @@ gem install pseudohikiparser --pre
|
|
34
33
|
|
35
34
|
You will find those samples in [develop branch](https://github.com/nico-hn/PseudoHikiParser/tree/develop/samples).
|
36
35
|
|
37
|
-
|
38
36
|
### pseudohiki2html.rb
|
39
37
|
|
40
38
|
After the installation of PseudoHikiParser, you could use a command: **pseudohiki2html.rb**.
|
@@ -75,6 +73,7 @@ The first paragraph
|
|
75
73
|
</body>
|
76
74
|
</html>
|
77
75
|
```
|
76
|
+
|
78
77
|
And if you specify a file name with `--output` option:
|
79
78
|
|
80
79
|
```
|
@@ -83,6 +82,7 @@ pseudohiki2html.rb --output first_example.html <<TEXT
|
|
83
82
|
The first paragraph
|
84
83
|
TEXT
|
85
84
|
```
|
85
|
+
|
86
86
|
the result will be saved in first_example.html.
|
87
87
|
|
88
88
|
For more options, please try `pseudohiki2html.rb --help`
|
@@ -166,6 +166,7 @@ If you add [name_of_id], just after the marks that denote heading or list type i
|
|
166
166
|
|
167
167
|
*[list_id]list
|
168
168
|
```
|
169
|
+
|
169
170
|
will be rendered as
|
170
171
|
|
171
172
|
```html
|
@@ -280,6 +281,8 @@ The first paragraph
|
|
280
281
|
|
281
282
|
### Experimental
|
282
283
|
|
284
|
+
#### Escaping tags for inline decorations
|
285
|
+
|
283
286
|
Tags for inline decorations are escaped when they are enclosed in plugin tags:
|
284
287
|
|
285
288
|
```
|
@@ -288,11 +291,37 @@ And {{ {}} and {{} }} should be rendered as two left curly braces and two right
|
|
288
291
|
```
|
289
292
|
|
290
293
|
will be rendered as
|
294
|
+
|
291
295
|
```
|
292
296
|
For example, '' or == can be escaped.
|
293
297
|
And {{ and }} sould be rendered as two left curly braces and two right curly braces respectively.
|
294
298
|
```
|
295
299
|
|
300
|
+
#### Decorator for blocks
|
301
|
+
|
302
|
+
By lines that begin with '//@', you can assign certain attributes to its succeeding block.
|
303
|
+
|
304
|
+
For example,
|
305
|
+
|
306
|
+
```
|
307
|
+
//@class[class_name]
|
308
|
+
!!A section with a class name
|
309
|
+
|
310
|
+
paragraph
|
311
|
+
```
|
312
|
+
|
313
|
+
will be renderes as
|
314
|
+
|
315
|
+
```
|
316
|
+
<div class="class_name">
|
317
|
+
<h2>A section with a class name
|
318
|
+
</h2>
|
319
|
+
<p>
|
320
|
+
paragraph
|
321
|
+
</p>
|
322
|
+
<!-- end of class_name -->
|
323
|
+
</div>
|
324
|
+
```
|
296
325
|
|
297
326
|
### Not Implemented Yet
|
298
327
|
|
@@ -38,15 +38,15 @@ module PseudoHiki
|
|
38
38
|
end
|
39
39
|
|
40
40
|
class BlockStack < TreeStack
|
41
|
-
def
|
42
|
-
self.current_node.parse_leafs
|
43
|
-
|
41
|
+
def pop_with_breaker(breaker=nil)
|
42
|
+
self.current_node.parse_leafs(breaker)
|
43
|
+
pop
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
class BlockLeaf < BlockStack::Leaf
|
48
48
|
@@head_re = {}
|
49
|
-
attr_accessor :nominal_level, :node_id
|
49
|
+
attr_accessor :nominal_level, :node_id, :decorator
|
50
50
|
|
51
51
|
def self.head_re=(head_regex)
|
52
52
|
@@head_re[self] = head_regex
|
@@ -91,7 +91,7 @@ module PseudoHiki
|
|
91
91
|
super(stack)
|
92
92
|
end
|
93
93
|
|
94
|
-
def parse_leafs
|
94
|
+
def parse_leafs(breaker)
|
95
95
|
parsed = InlineParser.parse(self.join)
|
96
96
|
self.clear
|
97
97
|
self.concat(parsed)
|
@@ -146,6 +146,11 @@ module PseudoHiki
|
|
146
146
|
first.nominal_level
|
147
147
|
end
|
148
148
|
|
149
|
+
def decorator
|
150
|
+
return nil unless first
|
151
|
+
first.decorator
|
152
|
+
end
|
153
|
+
|
149
154
|
def push_self(stack)
|
150
155
|
@stack = stack
|
151
156
|
super(stack)
|
@@ -155,7 +160,7 @@ module PseudoHiki
|
|
155
160
|
not (kind_of?(breaker.block) and nominal_level == breaker.nominal_level)
|
156
161
|
end
|
157
162
|
|
158
|
-
def parse_leafs; end
|
163
|
+
def parse_leafs(breaker); end
|
159
164
|
|
160
165
|
def in_link_tag?(preceding_str)
|
161
166
|
preceding_str[-2, 2] == "[[" or preceding_str[-1, 1] == "|"
|
@@ -167,7 +172,7 @@ module PseudoHiki
|
|
167
172
|
|
168
173
|
def add_leaf(line, blockparser)
|
169
174
|
leaf = create_leaf(line, blockparser)
|
170
|
-
blockparser.stack.
|
175
|
+
blockparser.stack.pop_with_breaker(leaf) while blockparser.breakable?(leaf)
|
171
176
|
blockparser.stack.push leaf
|
172
177
|
end
|
173
178
|
|
@@ -179,8 +184,8 @@ module PseudoHiki
|
|
179
184
|
end
|
180
185
|
|
181
186
|
class NonNestedBlockNode < BlockNode
|
182
|
-
def parse_leafs
|
183
|
-
self.each {|leaf| leaf.parse_leafs }
|
187
|
+
def parse_leafs(breaker)
|
188
|
+
self.each {|leaf| leaf.parse_leafs(breaker) }
|
184
189
|
end
|
185
190
|
end
|
186
191
|
|
@@ -200,11 +205,11 @@ module PseudoHiki
|
|
200
205
|
|
201
206
|
module BlockElement
|
202
207
|
{
|
203
|
-
BlockLeaf => %w(DescLeaf VerbatimLeaf TableLeaf CommentOutLeaf BlockNodeEnd HrLeaf),
|
208
|
+
BlockLeaf => %w(DescLeaf VerbatimLeaf TableLeaf CommentOutLeaf BlockNodeEnd HrLeaf DecoratorLeaf),
|
204
209
|
NonNestedBlockLeaf => %w(QuoteLeaf ParagraphLeaf),
|
205
210
|
NestedBlockLeaf => %w(HeadingLeaf),
|
206
211
|
ListTypeLeaf => %w(ListLeaf EnumLeaf),
|
207
|
-
BlockNode => %w(DescNode VerbatimNode TableNode CommentOutNode HrNode),
|
212
|
+
BlockNode => %w(DescNode VerbatimNode TableNode CommentOutNode HrNode DecoratorNode),
|
208
213
|
NonNestedBlockNode => %w(QuoteNode ParagraphNode),
|
209
214
|
NestedBlockNode => %w(HeadingNode),
|
210
215
|
ListTypeBlockNode => %w(ListNode EnumNode),
|
@@ -223,15 +228,43 @@ module PseudoHiki
|
|
223
228
|
attr_accessor :in_block_tag
|
224
229
|
|
225
230
|
def add_leaf(line, blockparser)
|
226
|
-
return @stack.
|
231
|
+
return @stack.pop_with_breaker if LINE_PAT::VERBATIM_END =~ line
|
227
232
|
return super(line, blockparser) unless @in_block_tag
|
228
233
|
line = " ".concat(line) if BlockElement::BlockNodeEnd.head_re =~ line and not @in_block_tag
|
229
234
|
@stack.push BlockElement::VerbatimLeaf.create(line, @in_block_tag)
|
230
235
|
end
|
231
236
|
end
|
232
237
|
|
238
|
+
class BlockElement::DecoratorNode
|
239
|
+
DECORATOR_PAT = /\A(?:([^\[\]:]+))?(?:\[([^\[\]]+)\])?(?::\s*(\S.*))?/o
|
240
|
+
|
241
|
+
class DecoratorItem < Struct.new(:string, :type, :id, :value)
|
242
|
+
def initialize(*args)
|
243
|
+
super
|
244
|
+
self.value = InlineParser.parse(self.value) if self.value
|
245
|
+
end
|
246
|
+
end
|
247
|
+
|
248
|
+
def parse_leafs(breaker)
|
249
|
+
decorator = {}
|
250
|
+
breaker.decorator = decorator
|
251
|
+
@stack.remove_current_node.each do |leaf|
|
252
|
+
m = DECORATOR_PAT.match(leaf.join)
|
253
|
+
return nil unless m
|
254
|
+
item = DecoratorItem.new(*(m.to_a))
|
255
|
+
decorator[item.type||:id] = item
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
def breakable?(breaker)
|
260
|
+
return super if breaker.kind_of?(BlockElement::DecoratorLeaf)
|
261
|
+
parse_leafs(breaker)
|
262
|
+
@stack.current_node.breakable?(breaker)
|
263
|
+
end
|
264
|
+
end
|
265
|
+
|
233
266
|
class BlockElement::QuoteNode
|
234
|
-
def parse_leafs
|
267
|
+
def parse_leafs(breaker)
|
235
268
|
self[0] = BlockParser.parse(self[0])
|
236
269
|
end
|
237
270
|
end
|
@@ -289,7 +322,8 @@ module PseudoHiki
|
|
289
322
|
[ParagraphLeaf, ParagraphNode],
|
290
323
|
[HrLeaf, HrNode],
|
291
324
|
[ListLeaf, ListNode],
|
292
|
-
[EnumLeaf, EnumNode]
|
325
|
+
[EnumLeaf, EnumNode],
|
326
|
+
[DecoratorLeaf, DecoratorNode]
|
293
327
|
].each do |leaf, node|
|
294
328
|
ParentNode[leaf] = node
|
295
329
|
end
|
@@ -316,6 +350,7 @@ module PseudoHiki
|
|
316
350
|
end
|
317
351
|
HrLeaf.head_re = Regexp.new(/\A(----)\s*$/o)
|
318
352
|
BlockNodeEnd.head_re = Regexp.new(/^(\r?\n?)$/o)
|
353
|
+
DecoratorLeaf.head_re = Regexp.new(/^(\/\/@)/o)
|
319
354
|
Regexp.new('\\A('+head_pats.join('|')+')')
|
320
355
|
end
|
321
356
|
HEAD_RE = assign_head_re
|
@@ -333,7 +368,7 @@ module PseudoHiki
|
|
333
368
|
end
|
334
369
|
|
335
370
|
def select_leaf_type(line)
|
336
|
-
[BlockNodeEnd, HrLeaf].each {|leaf| return leaf if leaf.head_re =~ line }
|
371
|
+
[BlockNodeEnd, HrLeaf, DecoratorLeaf].each {|leaf| return leaf if leaf.head_re =~ line }
|
337
372
|
matched = HEAD_RE.match(line)
|
338
373
|
return HeadToLeaf[matched[0]]||HeadToLeaf[line[0, 1]] || HeadToLeaf['\s'] if matched
|
339
374
|
ParagraphLeaf
|
@@ -342,7 +377,7 @@ module PseudoHiki
|
|
342
377
|
def read_lines(lines)
|
343
378
|
each_line = lines.respond_to?(:each_line) ? :each_line : :each
|
344
379
|
lines.send(each_line) {|line| @stack.current_node.add_leaf(line, self) }
|
345
|
-
@stack.
|
380
|
+
@stack.pop_with_breaker
|
346
381
|
end
|
347
382
|
end
|
348
383
|
end
|
@@ -57,6 +57,7 @@ module PseudoHiki
|
|
57
57
|
|
58
58
|
def visit(tree)
|
59
59
|
htmlelement = create_self_element(tree)
|
60
|
+
decorate(htmlelement, tree)
|
60
61
|
push_visited_results(htmlelement, tree)
|
61
62
|
htmlelement
|
62
63
|
end
|
@@ -74,6 +75,21 @@ module PseudoHiki
|
|
74
75
|
chunks.push tree
|
75
76
|
end
|
76
77
|
|
78
|
+
def decorate(htmlelement, tree)
|
79
|
+
each_decorator(htmlelement, tree) do |element, decorator|
|
80
|
+
element[CLASS] = HtmlElement.escape(decorator[CLASS].id) if decorator[CLASS]
|
81
|
+
if id_item = decorator[ID]||decorator[:id]
|
82
|
+
element[ID] = HtmlElement.escape(id_item.id).upcase
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def each_decorator(element, tree)
|
88
|
+
return unless element.kind_of? HtmlElement
|
89
|
+
return unless tree.kind_of? BlockParser::BlockNode and tree.decorator
|
90
|
+
tree.decorator.tap {|decorator| yield element, decorator }
|
91
|
+
end
|
92
|
+
|
77
93
|
class ListLeafNodeFormatter < self
|
78
94
|
def create_self_element(tree)
|
79
95
|
super(tree).tap do |element|
|
@@ -170,6 +186,14 @@ module PseudoHiki
|
|
170
186
|
|
171
187
|
#for BlockParser
|
172
188
|
|
189
|
+
class << Formatter[TableNode]
|
190
|
+
def decorate(htmlelement, tree)
|
191
|
+
each_decorator(htmlelement, tree) do |element, decorator|
|
192
|
+
htmlelement["summary"] = HtmlElement.escape(decorator["summary"].value.join) if decorator["summary"]
|
193
|
+
end
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
173
197
|
class << Formatter[VerbatimNode]
|
174
198
|
def visit(tree)
|
175
199
|
create_self_element.tap do |element|
|
@@ -243,13 +243,14 @@ module PseudoHiki
|
|
243
243
|
class VerbatimNodeFormatter < self
|
244
244
|
def visit(tree)
|
245
245
|
element = super(tree)
|
246
|
+
@language_name = language_name(tree)
|
246
247
|
return gfm_verbatim(element) if @options.gfm_style
|
247
248
|
md_verbatim(element)
|
248
249
|
end
|
249
250
|
|
250
251
|
def gfm_verbatim(element)
|
251
252
|
element.tap do |lines|
|
252
|
-
lines.unshift "```#{$/}"
|
253
|
+
lines.unshift "```#{@language_name + $/}"
|
253
254
|
lines.push "```#{$/ * 2}"
|
254
255
|
end
|
255
256
|
end
|
@@ -257,6 +258,12 @@ module PseudoHiki
|
|
257
258
|
def md_verbatim(element)
|
258
259
|
element.join.gsub(/^/o, " ").sub(/ \Z/o, "").concat $/
|
259
260
|
end
|
261
|
+
|
262
|
+
def language_name(tree)
|
263
|
+
tree.decorator.tap do |decorator|
|
264
|
+
return decorator ? decorator["code"].id : ""
|
265
|
+
end
|
266
|
+
end
|
260
267
|
end
|
261
268
|
|
262
269
|
class QuoteNodeFormatter < self
|
data/lib/pseudohiki/version.rb
CHANGED
data/test/test_blockparser.rb
CHANGED
@@ -311,6 +311,35 @@ TEXT
|
|
311
311
|
assert_equal([[[["heading"]]]],parsed)
|
312
312
|
end
|
313
313
|
|
314
|
+
|
315
|
+
def test_decorator
|
316
|
+
text = <<TEXT
|
317
|
+
//@class[section_name]
|
318
|
+
!!title of section
|
319
|
+
|
320
|
+
//@summary: Summary of the table
|
321
|
+
||!header 1||! header 2
|
322
|
+
||cell 1||cell 2
|
323
|
+
|
324
|
+
a paragraph.
|
325
|
+
|
326
|
+
//@class[class_name]
|
327
|
+
//@[id_name]
|
328
|
+
another paragraph.
|
329
|
+
TEXT
|
330
|
+
|
331
|
+
tree = PseudoHiki::BlockParser.parse(text.lines.to_a.map {|line| line.chomp })
|
332
|
+
assert_equal(PseudoHiki::BlockParser::BlockNode, tree.class)
|
333
|
+
assert_equal("section_name", tree[0].decorator["class"].id)
|
334
|
+
assert_equal(PseudoHiki::BlockParser::BlockElement::HeadingNode, tree[0].class)
|
335
|
+
assert_equal('[[["title of section"]], [[[["header 1"]], [[" header 2"]]], [[["cell 1"]], [["cell 2"]]]], [[["a paragraph."]]], [[["another paragraph."]]]]', tree[0].to_s)
|
336
|
+
assert_equal('[["Summary of the table"]]', tree[0][1].decorator["summary"].value.to_s)
|
337
|
+
assert_equal(PseudoHiki::BlockParser::BlockElement::TableNode, tree[0][1].class)
|
338
|
+
assert_equal(nil, tree[0][2].decorator)
|
339
|
+
assert_equal('id_name', tree[0][3].decorator[:id].id)
|
340
|
+
assert_equal('class_name', tree[0][3].decorator["class"].id)
|
341
|
+
end
|
342
|
+
|
314
343
|
def test_comment_out_followed_by_a_verbatim_block
|
315
344
|
text = <<TEXT
|
316
345
|
the first paragraph
|
data/test/test_htmlformat.rb
CHANGED
@@ -668,6 +668,69 @@ HTML
|
|
668
668
|
assert_equal(xhtml, XhtmlFormat.format(tree).to_s)
|
669
669
|
end
|
670
670
|
|
671
|
+
def test_decorator
|
672
|
+
text = <<TEXT
|
673
|
+
//@class[section_type]
|
674
|
+
!!title of section
|
675
|
+
|
676
|
+
a paragraph.
|
677
|
+
|
678
|
+
//@class[class_name]
|
679
|
+
//@id[id_name]
|
680
|
+
another paragraph.
|
681
|
+
TEXT
|
682
|
+
|
683
|
+
xhtml = <<HTML
|
684
|
+
<div class="section_type">
|
685
|
+
<h2>title of section</h2>
|
686
|
+
<p>
|
687
|
+
a paragraph.</p>
|
688
|
+
<p class="class_name" id="ID_NAME">
|
689
|
+
another paragraph.</p>
|
690
|
+
<!-- end of section_type -->
|
691
|
+
</div>
|
692
|
+
HTML
|
693
|
+
tree = BlockParser.parse(text.lines.to_a.map {|line| line.chomp })
|
694
|
+
assert_equal(xhtml, XhtmlFormat.format(tree).to_s)
|
695
|
+
end
|
696
|
+
|
697
|
+
def test_decorator_for_table
|
698
|
+
text = <<TEXT
|
699
|
+
//@summary: Summary of the table
|
700
|
+
||!header 1||! header 2
|
701
|
+
||cell 1||cell 2
|
702
|
+
TEXT
|
703
|
+
|
704
|
+
xhtml = <<HTML
|
705
|
+
<table summary="Summary of the table">
|
706
|
+
<tr><th>header 1</th><th> header 2</th></tr>
|
707
|
+
<tr><td>cell 1</td><td>cell 2</td></tr>
|
708
|
+
</table>
|
709
|
+
HTML
|
710
|
+
tree = BlockParser.parse(text.lines.to_a.map {|line| line.chomp })
|
711
|
+
assert_equal(xhtml, XhtmlFormat.format(tree).to_s)
|
712
|
+
end
|
713
|
+
|
714
|
+
def test_decorator_for_verbatim
|
715
|
+
text = <<TEXT
|
716
|
+
//@code[ruby]
|
717
|
+
def bonjour!
|
718
|
+
puts "Bonjour!"
|
719
|
+
end
|
720
|
+
TEXT
|
721
|
+
|
722
|
+
xhtml = <<HTML
|
723
|
+
<pre>
|
724
|
+
def bonjour!
|
725
|
+
puts "Bonjour!"
|
726
|
+
end
|
727
|
+
</pre>
|
728
|
+
HTML
|
729
|
+
|
730
|
+
tree = BlockParser.parse(text.lines.to_a)
|
731
|
+
assert_equal(xhtml, XhtmlFormat.format(tree).to_s)
|
732
|
+
end
|
733
|
+
|
671
734
|
def test_comment_out_followed_by_a_verbatim_block
|
672
735
|
text = <<TEXT
|
673
736
|
the first paragraph
|
data/test/test_markdownformat.rb
CHANGED
@@ -501,5 +501,65 @@ TEXT
|
|
501
501
|
tree = BlockParser.parse(text.lines.to_a)
|
502
502
|
assert_equal(md_text, @formatter.format(tree).to_s)
|
503
503
|
end
|
504
|
+
|
505
|
+
def test_decorator_for_verbatim
|
506
|
+
text = <<TEXT
|
507
|
+
//@code[ruby]
|
508
|
+
def bonjour!
|
509
|
+
puts "Bonjour!"
|
510
|
+
end
|
511
|
+
TEXT
|
512
|
+
|
513
|
+
gfm_text =<<TEXT
|
514
|
+
```ruby
|
515
|
+
def bonjour!
|
516
|
+
puts "Bonjour!"
|
517
|
+
end
|
518
|
+
```
|
519
|
+
|
520
|
+
TEXT
|
521
|
+
|
522
|
+
md_text = <<TEXT
|
523
|
+
def bonjour!
|
524
|
+
puts "Bonjour!"
|
525
|
+
end
|
526
|
+
|
527
|
+
TEXT
|
528
|
+
|
529
|
+
tree = BlockParser.parse(text.lines.to_a)
|
530
|
+
assert_equal(gfm_text, @gfm_formatter.format(tree).to_s)
|
531
|
+
assert_equal(md_text, @formatter.format(tree).to_s)
|
532
|
+
end
|
533
|
+
|
534
|
+
def test_decorator_for_verbatim_block
|
535
|
+
text = <<TEXT
|
536
|
+
//@code[ruby]
|
537
|
+
<<<
|
538
|
+
def bonjour!
|
539
|
+
puts "Bonjour!"
|
540
|
+
end
|
541
|
+
>>>
|
542
|
+
TEXT
|
543
|
+
|
544
|
+
gfm_text =<<TEXT
|
545
|
+
```ruby
|
546
|
+
def bonjour!
|
547
|
+
puts "Bonjour!"
|
548
|
+
end
|
549
|
+
```
|
550
|
+
|
551
|
+
TEXT
|
552
|
+
|
553
|
+
md_text = <<TEXT
|
554
|
+
def bonjour!
|
555
|
+
puts "Bonjour!"
|
556
|
+
end
|
557
|
+
|
558
|
+
TEXT
|
559
|
+
|
560
|
+
tree = BlockParser.parse(text.lines.to_a)
|
561
|
+
assert_equal(gfm_text, @gfm_formatter.format(tree).to_s)
|
562
|
+
assert_equal(md_text, @formatter.format(tree).to_s)
|
563
|
+
end
|
504
564
|
end
|
505
565
|
|
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pseudohikiparser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.0.
|
5
|
-
prerelease: 9
|
4
|
+
version: 0.0.0.11.develop
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- HASHIMOTO, Naoki
|
@@ -14,49 +13,43 @@ dependencies:
|
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.3'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '1.3'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ">="
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ">="
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: minitest
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ">="
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ">="
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
description: PseudoHikiParser is a parser of texts written in a Hiki like notation,
|
@@ -68,54 +61,53 @@ executables:
|
|
68
61
|
extensions: []
|
69
62
|
extra_rdoc_files: []
|
70
63
|
files:
|
71
|
-
- README.md
|
72
64
|
- LICENSE
|
73
|
-
-
|
74
|
-
-
|
75
|
-
- lib/
|
65
|
+
- README.md
|
66
|
+
- bin/pseudohiki2html.rb
|
67
|
+
- lib/htmlelement.rb
|
68
|
+
- lib/htmlelement/htmltemplate.rb
|
76
69
|
- lib/pseudohiki/blockparser.rb
|
77
70
|
- lib/pseudohiki/htmlformat.rb
|
78
|
-
- lib/pseudohiki/
|
71
|
+
- lib/pseudohiki/htmlplugin.rb
|
72
|
+
- lib/pseudohiki/inlineparser.rb
|
79
73
|
- lib/pseudohiki/markdownformat.rb
|
74
|
+
- lib/pseudohiki/plaintextformat.rb
|
75
|
+
- lib/pseudohiki/treestack.rb
|
80
76
|
- lib/pseudohiki/version.rb
|
81
|
-
- lib/
|
82
|
-
- lib/htmlelement.rb
|
83
|
-
- lib/htmlelement/htmltemplate.rb
|
84
|
-
- test/test_htmltemplate.rb
|
77
|
+
- lib/pseudohikiparser.rb
|
85
78
|
- test/test_blockparser.rb
|
86
|
-
- test/test_plaintextformat.rb
|
87
79
|
- test/test_htmlelement.rb
|
88
|
-
- test/test_treestack.rb
|
89
|
-
- test/test_inlineparser.rb
|
90
|
-
- test/test_markdownformat.rb
|
91
80
|
- test/test_htmlformat.rb
|
92
81
|
- test/test_htmlplugin.rb
|
93
|
-
-
|
82
|
+
- test/test_htmltemplate.rb
|
83
|
+
- test/test_inlineparser.rb
|
84
|
+
- test/test_markdownformat.rb
|
85
|
+
- test/test_plaintextformat.rb
|
86
|
+
- test/test_treestack.rb
|
94
87
|
homepage: https://github.com/nico-hn/PseudoHikiParser/wiki
|
95
88
|
licenses:
|
96
89
|
- BSD 2-Clause license
|
90
|
+
metadata: {}
|
97
91
|
post_install_message:
|
98
92
|
rdoc_options: []
|
99
93
|
require_paths:
|
100
94
|
- lib
|
101
95
|
required_ruby_version: !ruby/object:Gem::Requirement
|
102
|
-
none: false
|
103
96
|
requirements:
|
104
|
-
- -
|
97
|
+
- - ">="
|
105
98
|
- !ruby/object:Gem::Version
|
106
99
|
version: 1.8.7
|
107
100
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
-
none: false
|
109
101
|
requirements:
|
110
|
-
- -
|
102
|
+
- - ">"
|
111
103
|
- !ruby/object:Gem::Version
|
112
104
|
version: 1.3.1
|
113
105
|
requirements: []
|
114
106
|
rubyforge_project:
|
115
|
-
rubygems_version:
|
107
|
+
rubygems_version: 2.2.2
|
116
108
|
signing_key:
|
117
|
-
specification_version:
|
118
|
-
summary:
|
109
|
+
specification_version: 4
|
110
|
+
summary: 'PseudoHikiParser: a parser of texts in a Hiki like notation.'
|
119
111
|
test_files:
|
120
112
|
- test/test_htmltemplate.rb
|
121
113
|
- test/test_blockparser.rb
|