facwparser 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
data/lib/facwparser/element.rb
CHANGED
@@ -195,7 +195,7 @@ module Facwparser
|
|
195
195
|
@value = value
|
196
196
|
end
|
197
197
|
def render_html(options)
|
198
|
-
render_html_by_name_and_value(['pre', {'class' => 'noformat'}] , @value
|
198
|
+
render_html_by_name_and_value(['pre', {'class' => 'noformat'}] , @value) + "\n"
|
199
199
|
end
|
200
200
|
end
|
201
201
|
class CodeMacro < MacroBase
|
@@ -205,9 +205,8 @@ module Facwparser
|
|
205
205
|
@value = value
|
206
206
|
end
|
207
207
|
def render_html(options)
|
208
|
-
"<pre class=\"#{CGI.escapeHTML(@options[1..-1])}\"
|
209
|
-
render_html_by_name_and_value('code', @value
|
210
|
-
"</pre>" + "\n"
|
208
|
+
"<pre class=\"#{CGI.escapeHTML(@options[1..-1])}\">" +
|
209
|
+
render_html_by_name_and_value('code', @value) + "</pre>" + "\n"
|
211
210
|
end
|
212
211
|
end
|
213
212
|
class QuoteMacro < MacroBase
|
@@ -334,7 +333,7 @@ module Facwparser
|
|
334
333
|
|
335
334
|
class Text < InlineElementBase
|
336
335
|
def render_html(options)
|
337
|
-
CGI.escapeHTML @
|
336
|
+
CGI.escapeHTML @text
|
338
337
|
end
|
339
338
|
end
|
340
339
|
|
data/lib/facwparser/parser.rb
CHANGED
@@ -175,7 +175,7 @@ module Facwparser
|
|
175
175
|
children << Element::ColorMacroStart.new(s[0], unescape_text(s[1]))
|
176
176
|
when s.scan(/\{color\}/)
|
177
177
|
children << Element::ColorMacroEnd.new(s[0])
|
178
|
-
when s.scan(/[^\[
|
178
|
+
when s.scan(/[^\[\a^\\*+_?{}!-]+/)
|
179
179
|
children << Element::Text.new(s[0], unescape_text(s[0]))
|
180
180
|
when s.scan(/\\\\/)
|
181
181
|
children << Element::Br.new(s[0])
|
data/lib/facwparser/version.rb
CHANGED
@@ -7,7 +7,7 @@ class TestCode < Test::Unit::TestCase
|
|
7
7
|
|
8
8
|
def test_code_1
|
9
9
|
code = Facwparser::Element::CodeMacro.new("{code:perl}\n*a*\n{code}\n", ':perl', '*a*')
|
10
|
-
assert_equal(%Q{<pre class="perl"
|
10
|
+
assert_equal(%Q{<pre class="perl"><code>*a*</code></pre>\n},
|
11
11
|
code.render_html({}))
|
12
12
|
end
|
13
13
|
|
@@ -7,7 +7,7 @@ class TestNoformat < Test::Unit::TestCase
|
|
7
7
|
|
8
8
|
def test_noformat_1
|
9
9
|
noformat = Facwparser::Element::NoformatMacro.new("{noformat}\n*a*\n{noformat}\n", '*a*')
|
10
|
-
assert_equal(%Q{<pre class="noformat"
|
10
|
+
assert_equal(%Q{<pre class="noformat">*a*</pre>\n},
|
11
11
|
noformat.render_html({}))
|
12
12
|
end
|
13
13
|
|
@@ -118,6 +118,10 @@ class TestParseValue < Test::Unit::TestCase
|
|
118
118
|
Facwparser::Element::JiraMacro.new('{jira:SYSTEMRD\-1}', 'SYSTEMRD-1'),
|
119
119
|
], Facwparser::Parser.parse_value('1\\{{jira:SYSTEMRD\\-1}', {}))
|
120
120
|
|
121
|
+
assert_equal([
|
122
|
+
Facwparser::Element::Text.new('\\-', '-'),
|
123
|
+
], Facwparser::Parser.parse_value('\\-', {}))
|
124
|
+
|
121
125
|
end
|
122
126
|
|
123
127
|
end
|