pseudohikiparser 0.0.0.7.develop → 0.0.0.8.develop
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/pseudohiki/markdownformat.rb +11 -2
- data/lib/pseudohiki/version.rb +1 -1
- data/test/test_markdownformat.rb +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa62b3cd074b8968534000434a99e4e4fb4c3e45
|
4
|
+
data.tar.gz: b3abcdf01e6251091283d33afd0ba5510046a1ec
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 831925761d0de0186705d7f12b1cf24a87cc2688e7dd9c9ebab31723e235d825818c06021d440596f3cfeb4404fc271dfdab942c0cafc353498cb20e0bb24ef3
|
7
|
+
data.tar.gz: c059dd1b7498bef0d24b739f2b164b2b11aa4f9912be8c620f24296ed96b308ca9190a1f25dde75345ace899371c02f5a9ef1b528dc106d054c83191de9d0042
|
data/README.md
CHANGED
@@ -199,11 +199,11 @@ cell 4-1 cell 4-2 cell 4-3 cell 4-4 cell 4-5
|
|
199
199
|
#### A visitor for HTML5
|
200
200
|
The visitor, [Xhtml5Format](https://github.com/nico-hn/PseudoHikiParser/blob/develop/lib/pseudohiki/htmlformat.rb#L222) is currently available only in the [develop branch](https://github.com/nico-hn/PseudoHikiParser/tree/develop).
|
201
201
|
|
202
|
-
#### A
|
202
|
+
#### A visitor for (Git Flavored) Markdown
|
203
203
|
|
204
204
|
The visitor, [MarkDownFormat](https://github.com/nico-hn/PseudoHikiParser/blob/develop/lib/pseudohiki/markdownformat.rb) too, is currently available only in the [develop branch](https://github.com/nico-hn/PseudoHikiParser/blob/develop/).
|
205
205
|
|
206
|
-
It's just in experimental stage.
|
206
|
+
It's just in experimental stage.
|
207
207
|
|
208
208
|
The following are a sample script and its output:
|
209
209
|
|
@@ -114,7 +114,14 @@ module PseudoHiki
|
|
114
114
|
|
115
115
|
class InlineLeafFormatter < self
|
116
116
|
def visit(leaf)
|
117
|
-
leaf.map
|
117
|
+
leaf.map do |str|
|
118
|
+
escaped_str = str.gsub(/([_*])/o, "\\\\\\1")
|
119
|
+
if @options.gfm_style
|
120
|
+
escaped_str.gsub(/([&<>])/o, "\\\\\\1")
|
121
|
+
else
|
122
|
+
HtmlElement.escape(escaped_str)
|
123
|
+
end
|
124
|
+
end
|
118
125
|
end
|
119
126
|
end
|
120
127
|
|
@@ -200,7 +207,9 @@ module PseudoHiki
|
|
200
207
|
# class EnumLeafFormatter < self; end
|
201
208
|
class DescNodeFormatter < self
|
202
209
|
def visit(tree)
|
203
|
-
desc_list =
|
210
|
+
desc_list = HtmlElement.create("dl").tap do |element|
|
211
|
+
element.push HtmlFormat.format(tree)
|
212
|
+
end
|
204
213
|
remove_trailing_newlines_in_html_element(desc_list)
|
205
214
|
end
|
206
215
|
end
|
data/lib/pseudohiki/version.rb
CHANGED
data/test/test_markdownformat.rb
CHANGED
@@ -68,10 +68,12 @@ IMAGE
|
|
68
68
|
TEXT
|
69
69
|
|
70
70
|
html = <<HTML
|
71
|
+
<dl>
|
71
72
|
<dt>word 1</dt>
|
72
73
|
<dd>description of word 1</dd>
|
73
74
|
<dt>word 2</dt>
|
74
75
|
<dd>description of word 2</dd>
|
76
|
+
</dl>
|
75
77
|
|
76
78
|
HTML
|
77
79
|
|
@@ -375,11 +377,13 @@ TEXT
|
|
375
377
|
end
|
376
378
|
|
377
379
|
def test_escape
|
378
|
-
text = "test string with *asterisk and
|
379
|
-
md_text = "test string with \\*asterisk and
|
380
|
+
text = "test string with *asterisk, _underscore and a html tag <h1>"
|
381
|
+
md_text = "test string with \\*asterisk, \\_underscore and a html tag <h1>#{$/}"
|
382
|
+
gfm_text = "test string with \\*asterisk, \\_underscore and a html tag \\<h1\\>#{$/}"
|
380
383
|
|
381
384
|
tree = BlockParser.parse(text.lines.to_a)
|
382
385
|
assert_equal(md_text, @formatter.format(tree).to_s)
|
386
|
+
assert_equal(gfm_text, @gfm_formatter.format(tree).to_s)
|
383
387
|
end
|
384
388
|
|
385
389
|
def test_not_escaped
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pseudohikiparser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.0.
|
4
|
+
version: 0.0.0.8.develop
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- HASHIMOTO, Naoki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|