texta 0.1.0 → 0.1.1

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.
Files changed (4) hide show
  1. data/Rakefile +1 -1
  2. data/lib/texta.rb +23 -6
  3. data/texta.gemspec +1 -1
  4. metadata +1 -1
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('texta', '0.1.0') do |p|
5
+ Echoe.new('texta', '0.1.1') do |p|
6
6
  p.description = "texta: heuristic text formatting"
7
7
  p.url = "http://github.com/pboy/texta"
8
8
  p.author = "pboy"
data/lib/texta.rb CHANGED
@@ -12,8 +12,16 @@ module Texta
12
12
  text =~ /<(ul|p|br|li|b|i)\b(.*?)>/
13
13
  end
14
14
 
15
- def texta(mode = :text)
16
- Texta.send mode, self
15
+ module StringAdapter
16
+ def texta(mode = :text)
17
+ Texta.send mode, self
18
+ end
19
+ end
20
+
21
+ module NilAdapter
22
+ def texta(mode = :text)
23
+ nil
24
+ end
17
25
  end
18
26
 
19
27
  def self.html(str)
@@ -63,12 +71,17 @@ module Texta
63
71
  end
64
72
 
65
73
  class String
66
- include Texta
74
+ include Texta::StringAdapter
75
+ end
76
+
77
+ class NilClass
78
+ include Texta::NilAdapter
67
79
  end
68
80
 
69
81
  module Texta::Etest
70
82
  def assert_equal_xml(x1, x2)
71
- return if x1.gsub(/\s/, "") == x2.gsub(/\s/, "")
83
+ return if x1 == x2
84
+ return if x1.to_s.gsub(/\s/, "") == x2.to_s.gsub(/\s/, "")
72
85
  assert_equal(x1 ,x2)
73
86
  end
74
87
 
@@ -89,10 +102,10 @@ module Texta::Etest
89
102
  def test_entities
90
103
  input = "ÄÖÜäöü"
91
104
  html = "html"
92
- # input = "ÄÖÜäöü" #{ }"ÄÖÜäöü"
105
+ text = "ÄÖÜäöü"
93
106
  html = "<p>&Auml;&Ouml;&Uuml;&auml;&ouml;&uuml;</p>"
94
107
 
95
- assert_testa input, nil, html #{}"ÄÖÜäöü", html
108
+ assert_testa input, text, html
96
109
  end
97
110
 
98
111
  def _test_list
@@ -173,4 +186,8 @@ HTML
173
186
 
174
187
  assert_testa input, text, html
175
188
  end
189
+
190
+ def test_nil
191
+ assert_testa nil, nil, nil
192
+ end
176
193
  end
data/texta.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{texta}
5
- s.version = "0.1.0"
5
+ s.version = "0.1.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["pboy"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: texta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - pboy