facwparser 0.0.4 → 0.0.5

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.
@@ -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, "\n") + "\n"
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])}\">\n" +
209
- render_html_by_name_and_value('code', @value, "\n") + "\n" +
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 @source
336
+ CGI.escapeHTML @text
338
337
  end
339
338
  end
340
339
 
@@ -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])
@@ -1,3 +1,3 @@
1
1
  module Facwparser
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -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">\n<code>\n*a*\n</code>\n</pre>\n},
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">\n*a*\n</pre>\n},
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: facwparser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: