textutils 0.6.8 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
data/Manifest.txt CHANGED
@@ -9,10 +9,13 @@ lib/textutils/filter/comment_filter.rb
9
9
  lib/textutils/filter/erb_django_filter.rb
10
10
  lib/textutils/filter/erb_filter.rb
11
11
  lib/textutils/helper/address_helper.rb
12
+ lib/textutils/helper/date_helper.rb
13
+ lib/textutils/helper/hypertext_helper.rb
12
14
  lib/textutils/helper/tag_helper.rb
13
15
  lib/textutils/helper/title_helper.rb
14
16
  lib/textutils/helper/unicode_helper.rb
15
17
  lib/textutils/helper/value_helper.rb
18
+ lib/textutils/helper/xml_helper.rb
16
19
  lib/textutils/reader/code_reader.rb
17
20
  lib/textutils/reader/fixture_reader.rb
18
21
  lib/textutils/reader/hash_reader.rb
@@ -21,4 +24,6 @@ lib/textutils/reader/values_reader.rb
21
24
  lib/textutils/utils.rb
22
25
  lib/textutils/version.rb
23
26
  test/helper.rb
24
- test/test_helper.rb
27
+ test/test_hypertext_helper.rb
28
+ test/test_title_helper.rb
29
+ test/test_unicode_helper.rb
data/README.markdown CHANGED
@@ -1,7 +1,7 @@
1
1
  # `textutils` - Text Filters, Helpers, Readers and More in Ruby
2
2
 
3
- * home :: [github.com/geraldb/textutils](https://github.com/geraldb/textutils)
4
- * bugs :: [github.com/geraldb/textutils/issues](https://github.com/geraldb/textutils/issues)
3
+ * home :: [github.com/rubylibs/textutils](https://github.com/rubylibs/textutils)
4
+ * bugs :: [github.com/rubylibs/textutils/issues](https://github.com/rubylibs/textutils/issues)
5
5
  * gem :: [rubygems.org/gems/textutils](https://rubygems.org/gems/textutils)
6
6
  * rdoc :: [rubydoc.info/gems/textutils](http://rubydoc.info/gems/textutils)
7
7
  * forum :: [groups.google.com/group/webslideshow](https://groups.google.com/group/webslideshow)
@@ -84,11 +84,11 @@ Just install the gem:
84
84
 
85
85
  ## Real World Usage
86
86
 
87
- The [`slideshow`](http://slideshow.rubyforge.org) gem (also known as Slide Show (S9))
87
+ The [`slideshow`](http://slideshow-s9.github.io) gem (also known as Slide Show (S9))
88
88
  that lets you create slide shows
89
89
  and author slides in plain text using a wiki-style markup language that's easy-to-write and easy-to-read.
90
90
 
91
- The [`markdown`](https://github.com/geraldb/markdown) gem that lets you use your markdown library
91
+ The [`markdown`](https://github.com/rubylibs/markdown) gem that lets you use your markdown library
92
92
  of choice.
93
93
 
94
94
  The [`worlddb`](https://github.com/geraldb/world.db.ruby) gem that offers a command line tool for the open world database (`world.db`).
@@ -102,4 +102,4 @@ TBD
102
102
  ## License
103
103
 
104
104
  The `textutils` scripts are dedicated to the public domain.
105
- Use it as you please with no restrictions whatsoever.
105
+ Use it as you please with no restrictions whatsoever.
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ Hoe.spec 'textutils' do
8
8
  self.summary = 'textutils - Text Filters, Helpers, Readers and More'
9
9
  self.description = summary
10
10
 
11
- self.urls = ['http://geraldb.github.com/textutils']
11
+ self.urls = ['https://github.com/rubylibs/textutils']
12
12
 
13
13
  self.author = 'Gerald Bauer'
14
14
  self.email = 'webslideshow@googlegroups.com'
data/lib/textutils.rb CHANGED
@@ -21,6 +21,10 @@ require 'textutils/filter/comment_filter'
21
21
  require 'textutils/filter/erb_django_filter'
22
22
  require 'textutils/filter/erb_filter'
23
23
 
24
+ require 'textutils/helper/date_helper'
25
+ require 'textutils/helper/hypertext_helper'
26
+ require 'textutils/helper/xml_helper'
27
+
24
28
  require 'textutils/helper/unicode_helper'
25
29
  require 'textutils/helper/tag_helper'
26
30
  require 'textutils/helper/title_helper'
@@ -49,7 +49,7 @@ module TextUtils
49
49
  nil # unsupported country/address schema for now; sorry
50
50
  end
51
51
  end
52
-
52
+
53
53
 
54
54
  end # module AddressHelper
55
55
  end # module TextUtils
@@ -0,0 +1,48 @@
1
+ # encoding: utf-8
2
+
3
+ module TextUtils
4
+ module DateHelper
5
+
6
+
7
+ def time_ago_in_words( from_time )
8
+ ## note:
9
+ # for code/source examples
10
+ # check rails helper or padrino(sinatra) helper
11
+ # for now this is just a simplified version e.g. no i18n
12
+
13
+ from_time = from_time.to_time
14
+ to_time = Time.now
15
+
16
+ ### todo: will not handle future dates??
17
+ ## what todo do??
18
+ ## use -1..-50000000000 ?? "future"
19
+
20
+ ## from_time, to_time = to_time, from_time if from_time > to_time
21
+
22
+ distance_in_minutes = ((to_time - from_time)/60.0).round
23
+
24
+ case distance_in_minutes
25
+ when 0..1 then "just now"
26
+ when 2...45 then "%d minutes ago" % distance_in_minutes
27
+ when 45...90 then "an hour ago" ## use one instead of 1 ?? why? why not?
28
+ # 90 mins up to 24 hours
29
+ when 90...1440 then "%d hours ago" % (distance_in_minutes.to_f / 60.0).round
30
+ # 24 hours up to 42 hours
31
+ when 1440...2520 then "a day ago" ## use one day ago - why? why not?
32
+ # 42 hours up to 30 days
33
+ when 2520...43200 then "%d days ago" % (distance_in_minutes.to_f / 1440.0).round
34
+ # 30 days up to 60 days
35
+ # fix: use pluralize for months - fix: change when - use just for a month ago
36
+ when 43200...86400 then "%d months ago" % (distance_in_minutes.to_f / 43200.0).round
37
+ # 60 days up to 365 days
38
+ when 86400...525600 then "%d months ago" % (distance_in_minutes.to_f / 43200.0).round
39
+ ## fix - add number of years ago
40
+ else "over a year ago" #todo: use over a year ago???
41
+ # fix: split into two - use
42
+ # 1) a year ago
43
+ # 2) (x) years ago
44
+ end
45
+ end
46
+
47
+ end # module DateHelper
48
+ end # module TextUtils
@@ -0,0 +1,174 @@
1
+ # encoding: utf-8
2
+
3
+ module TextUtils
4
+ module HypertextHelper
5
+
6
+
7
+ def strip_tags( ht )
8
+ ### to be done
9
+ ## strip markup tags; return plain text; use brute force for now
10
+ # check at least for presence of required a-z+ tag names
11
+
12
+ ### ht.gsub( /<[^>]+>/, '' ) - old simple
13
+
14
+ ## todo: add strip comments e.g. <!-- xxxx --> ???
15
+ ## or use new strip_comments( ht )
16
+
17
+ ht = ht.gsub( /<([a-z]+)\s*\/>/i, '' ) # remove xml-style empty tags eg. <br /> or <br/>
18
+ ht = ht.gsub( /<([a-z]+)(\s+[^>]*)?>/i, '' ) # opening tag <p>
19
+ ht = ht.gsub( /<\/([a-z]+)\s*>/i, '' ) # closing tag e.g. </p>
20
+ ht
21
+ end
22
+
23
+
24
+ def whitelist( ht, tags, opts={} )
25
+
26
+ # note: assumes properly escaped <> in ht/hypertext
27
+
28
+ ###############################################
29
+ # step one - save whitelisted tags use ‹tag›
30
+ tags.each do |tag|
31
+ # note: we strip all attribues
32
+ # note: match all tags case insensitive e.g. allow a,A or br,BR,bR etc.
33
+ # downcase all tags
34
+
35
+ # convert xml-style empty tags to simple html emtpty tags
36
+ # e.g. <br/> or <br /> becomses <br>
37
+ ht = ht.gsub( /<(#{tag})\s*\/>/i ) { |_| "‹#{$1.downcase}›" } # eg. <br /> or <br/> becomes ‹br›
38
+
39
+ # make sure we won't swall <br> for <b> for example, thus use \s+ before [^>]
40
+ ht = ht.gsub( /<(#{tag})(\s+[^>]*)?>/i ) { |_| "‹#{$1.downcase}›" } # opening tag <p>
41
+ ht = ht.gsub( /<\/(#{tag})\s*>/i ) { |_| "‹/#{$1.downcase}›" } # closing tag e.g. </p>
42
+ end
43
+
44
+ ############################
45
+ # step two - clean tags
46
+
47
+ # strip images - special treatment for debugging
48
+ ht = ht.gsub( /<img[^>]*>/i, '♦' ) # for debugging use black diamond e.g. ♦
49
+ ht = ht.gsub( /<\/img>/i, '' ) # should not exists
50
+
51
+ # strip all remaining tags
52
+ # -- note: will NOT strip comments for now e.g. <!-- -->
53
+ ht = strip_tags( ht )
54
+
55
+ pp ht # fix: debugging indo - remove
56
+
57
+ ############################################
58
+ # step three - restore whitelisted tags
59
+
60
+ return ht if opts[:skip_restore] # skip step 3 for debugging
61
+
62
+ tags.each do |tag|
63
+ # ht = ht.gsub( /‹(#{tag})›/, "<\1>" ) # opening tag e.g. <p>
64
+ # ht = ht.gsub( /‹\/(#{tag})›/, "<\/\1>" ) # closing tag e.g. </p>
65
+ ht = ht.gsub( /‹(#{tag})›/ ) { |_| "<#{$1}>" }
66
+ ht = ht.gsub( /‹\/(#{tag})›/ ) { |_| "<\/#{$1}>" } # closing tag e.g. </p>
67
+ end
68
+
69
+ ht
70
+ end # method whitelist
71
+
72
+
73
+
74
+
75
+ ## change to simple_hypertext or
76
+ # hypertext_simple or
77
+ # sanitize ???
78
+
79
+ def sanitize( ht, opts={} ) # ht -> hypertext
80
+ # todo: add options for
81
+ # keep links, images, lists (?too), code, codeblocks
82
+
83
+ ht = whitelist( ht, [:br, :p, :ul, :ol, :li, :pre, :code, :blockquote, :q, :cite], opts )
84
+
85
+ # clean (prettify) literal urls (strip protocoll)
86
+ ht = ht.gsub( /(http|https):\/\//, '' )
87
+ ht
88
+ end
89
+
90
+
91
+ def textify( ht, opts={} ) # ht -> hypertext
92
+ ## turn into plain (or markdown/wiki-style) text - to be done
93
+
94
+ sanitize( ht, opts ) # step 1 - sanitize html
95
+ # to be done
96
+
97
+ # strip bold
98
+ # ht = ht.gsub( /<b[^>]*>/, '**' ) # fix: will also swallow bxxx tags - add b space
99
+ # ht = ht.gsub( /<\/b>/, '**' )
100
+
101
+ # strip em
102
+ # ht = ht.gsub( /<em[^>]*>/, '__' )
103
+ # ht = ht.gsub( /<\/em>/, '__' )
104
+
105
+ # ht = ht.gsub( /&nbsp;/, ' ' )
106
+
107
+ # # try to cleanup whitespaces
108
+ # # -- keep no more than two spaces
109
+ # ht = ht.gsub( /[ \t]{3,}/, ' ' )
110
+ # # -- keep no more than two new lines
111
+ # ht = ht.gsub( /\n{2,}/m, "\n\n" )
112
+ # # -- remove all trailing spaces
113
+ # ht = ht.gsub( /[ \t\n]+$/m, '' )
114
+ # # -- remove all leading spaces
115
+ # ht = ht.gsub( /^[ \t\n]+/m, '' )
116
+ end
117
+
118
+
119
+ ##############################
120
+ # rails-style asset, url tag helpers and friends
121
+ #
122
+ # todo: move into different helper module/modules?? why? why not?
123
+
124
+ def tag( tag, opts={} ) # empty tag (no content e.g. <br>, <img src=''> etc.)
125
+ attribs = []
126
+ opts.each do |key,value|
127
+ attribs << "#{key}='#{value}'"
128
+ end
129
+
130
+ if attribs.size > 0
131
+ "<#{tag} #{attribs.join(' ')}>"
132
+ else
133
+ "<#{tag}>"
134
+ end
135
+ end
136
+
137
+ def content_tag( tag, content, opts={} ) # content tag (e.g. <p>hello</p> - w/ opening and closing tag)
138
+ attribs = []
139
+ opts.each do |key,value|
140
+ attribs << "#{key}='#{value}'"
141
+ end
142
+
143
+ if attribs.size > 0
144
+ "<#{tag} #{attribs.join(' ')}>#{content}</#{tag}>"
145
+ else
146
+ "<#{tag}>#{content}</#{tag}>"
147
+ end
148
+ end
149
+
150
+
151
+ def stylesheet_link_tag( href, opts={} )
152
+ href = "#{href}.css" unless href.end_with?( '.css' ) # auto-add .css if not present
153
+ attribs = { rel: 'stylesheet',
154
+ type: 'text/css',
155
+ href: href }
156
+ attribs = attribs.merge( opts ) ### fix/todo: use reverse merge e.g. overwrite only if not present
157
+ tag( :link, attribs )
158
+ end
159
+
160
+ def image_tag( src, opts={} )
161
+ attribs = { src: src }
162
+ attribs = attribs.merge( opts ) ### fix/todo: use reverse merge e.g. overwrite only if not present
163
+ tag( :img, attribs ) ### "<img src='#{src}' #{attributes}>"
164
+ end
165
+
166
+ def link_to( content, href, opts={} )
167
+ attribs = { href: href }
168
+ attribs = attribs.merge( opts ) ### fix/todo: use reverse merge e.g. overwrite only if not present
169
+ content_tag( :a, content, attribs ) ### "<a href='#{href}' #{attributes}>#{text}</a>"
170
+ end
171
+
172
+
173
+ end # module HypertextHelper
174
+ end # module TextUtils
@@ -3,6 +3,12 @@
3
3
  module TextUtils
4
4
  module TagHelper
5
5
 
6
+ ####
7
+ # - todo: use new additional sub module ???
8
+ # e.g. TextUtils::Reader::TagHelper
9
+ # lets us use "classic" web helpers a la rails
10
+ # find a good name for sub module - Reader? Fixtures? Values? Parser?
11
+
6
12
 
7
13
  def find_tags( value )
8
14
  # logger.debug " found tags: >>#{value}<<"
@@ -4,6 +4,11 @@
4
4
  module TextUtils
5
5
  module TitleHelper
6
6
 
7
+ ####
8
+ # - todo: use new additional sub module ???
9
+ # e.g. TextUtils::Reader::TagHelper
10
+ # lets us use "classic" web helpers a la rails
11
+ # find a good name for sub module - Reader? Fixtures? Values? Parser?
7
12
 
8
13
 
9
14
 
@@ -0,0 +1,27 @@
1
+ # encoding: utf-8
2
+
3
+ module TextUtils
4
+ module XmlHelper
5
+
6
+
7
+ def prettify_xml( xml )
8
+ require 'rexml/document'
9
+
10
+ begin
11
+ d = REXML::Document.new( xml )
12
+
13
+ # d.write( pretty_xml="", 2 )
14
+ # pretty_xml # return prettified xml
15
+
16
+ formatter = REXML::Formatters::Pretty.new( 2 ) # indent=2
17
+ formatter.compact = true # This is the magic line that does what you need!
18
+ pretty_xml = formatter.write( d.root, "" ) # todo/checl: what's 2nd arg used for ??
19
+ pretty_xml
20
+ rescue Exception => ex
21
+ "warn: prettify_xml failed: #{ex}\n\n\n" + xml
22
+ end
23
+ end
24
+
25
+
26
+ end # module XmlHelper
27
+ end # module TextUtils
@@ -1,6 +1,6 @@
1
1
 
2
2
  module TextUtils
3
3
 
4
- VERSION = '0.6.8'
4
+ VERSION = '0.7.0'
5
5
 
6
6
  end # module TextUtils
@@ -0,0 +1,85 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_rss.rb
6
+ # or better
7
+ # rake test
8
+
9
+ require 'helper'
10
+
11
+
12
+ class TestHypertextHelper < MiniTest::Unit::TestCase
13
+
14
+ include TextUtils::HypertextHelper # lets us use textify, etc.
15
+
16
+
17
+ def test_stylesheet_link_tag
18
+ hyout = "<link rel='stylesheet' type='text/css' href='hello.css'>"
19
+
20
+ assert_equal( hyout, stylesheet_link_tag( 'hello' ))
21
+ assert_equal( hyout, stylesheet_link_tag( 'hello.css' ))
22
+ end
23
+
24
+
25
+ def test_sanitize
26
+ hyin =<<EOS
27
+ <p><img style="float:left; margin-right:4px" src="http://photos1.meetupstatic.com/photos/event/7/c/b/2/event_244651922.jpeg" alt="photo" class="photo" />vienna.rb</p>
28
+ <p>
29
+ <p>The cool guys from <a href="http://platogo.com/">Platogo</a> will sponsor (y)our drinks. Which is awesome.</p>
30
+ <p><strong>Talks</strong>*</p>
31
+ <p>Jakob Sommerhuber - sponsor talk</p>
32
+ <p>Martin Schürrer - Erlang/OTP in production for highly-available, scalable systems</p>
33
+ <p>Markus Prinz - How to improve your code</p>
34
+ <p>Gerald Bauer - working with Sinatra</p>
35
+ <p>Kathrin Folkendt - 'Chapter one' (lightning talk on getting started with Rails, and building her first web app)</p>
36
+ <p><em>*preliminary program</em></p>
37
+ </p>
38
+ <p>Vienna - Austria</p>
39
+ <p>Friday, October 11 at 6:00 PM</p>
40
+ <p>Attending: 21</p>
41
+ <p>Details: http://www.meetup.com/vienna-rb/events/130346182/</p>
42
+ EOS
43
+
44
+ hystep1 = <<EOS
45
+ ‹p›♦vienna.rb‹/p›
46
+ ‹p›
47
+ ‹p›The cool guys from Platogo will sponsor (y)our drinks. Which is awesome.‹/p›
48
+ ‹p›Talks*‹/p›
49
+ ‹p›Jakob Sommerhuber - sponsor talk‹/p›
50
+ ‹p›Martin Schürrer - Erlang/OTP in production for highly-available, scalable systems‹/p›
51
+ ‹p›Markus Prinz - How to improve your code‹/p›
52
+ ‹p›Gerald Bauer - working with Sinatra‹/p›
53
+ ‹p›Kathrin Folkendt - 'Chapter one' (lightning talk on getting started with Rails, and building her first web app)‹/p›
54
+ ‹p›*preliminary program‹/p›
55
+ ‹/p›
56
+ ‹p›Vienna - Austria‹/p›
57
+ ‹p›Friday, October 11 at 6:00 PM‹/p›
58
+ ‹p›Attending: 21‹/p›
59
+ ‹p›Details: www.meetup.com/vienna-rb/events/130346182/‹/p›
60
+ EOS
61
+
62
+ hyout = <<EOS
63
+ <p>♦vienna.rb</p>
64
+ <p>
65
+ <p>The cool guys from Platogo will sponsor (y)our drinks. Which is awesome.</p>
66
+ <p>Talks*</p>
67
+ <p>Jakob Sommerhuber - sponsor talk</p>
68
+ <p>Martin Schürrer - Erlang/OTP in production for highly-available, scalable systems</p>
69
+ <p>Markus Prinz - How to improve your code</p>
70
+ <p>Gerald Bauer - working with Sinatra</p>
71
+ <p>Kathrin Folkendt - 'Chapter one' (lightning talk on getting started with Rails, and building her first web app)</p>
72
+ <p>*preliminary program</p>
73
+ </p>
74
+ <p>Vienna - Austria</p>
75
+ <p>Friday, October 11 at 6:00 PM</p>
76
+ <p>Attending: 21</p>
77
+ <p>Details: www.meetup.com/vienna-rb/events/130346182/</p>
78
+ EOS
79
+
80
+ assert_equal( hyout, sanitize( hyin ) )
81
+
82
+ assert_equal( hystep1, sanitize( hyin, skip_restore: true ) )
83
+ end
84
+
85
+ end # class TestHypertextHelper
@@ -0,0 +1,27 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_helper.rb
6
+ # or better
7
+ # rake test
8
+
9
+ require 'helper'
10
+
11
+ class TestTitleHelper < MiniTest::Unit::TestCase
12
+
13
+ def test_title_to_key
14
+
15
+ txt_io = [
16
+ [ 'São Paulo', 'saopaulo' ],
17
+ [ 'São Gonçalo', 'saogoncalo' ],
18
+ [ 'Výčepní', 'vycepni' ]
19
+ ]
20
+
21
+ txt_io.each do |txt|
22
+ assert_equal txt[1], TextUtils.title_to_key( txt[0] )
23
+ end
24
+ end
25
+
26
+
27
+ end # class TestTitleHelper
@@ -0,0 +1,21 @@
1
+ # encoding: utf-8
2
+
3
+ ###
4
+ # to run use
5
+ # ruby -I ./lib -I ./test test/test_helper.rb
6
+ # or better
7
+ # rake test
8
+
9
+ require 'helper'
10
+
11
+ class TestUnicodeHelper < MiniTest::Unit::TestCase
12
+
13
+ def test_convert_unicode_dashes
14
+
15
+ txt_in = "\u2010 \u2011 \u2212 \u2013 \u2014" # NB: unicode chars require double quoted strings
16
+ txt_out = '- - - - -'
17
+
18
+ assert_equal txt_out, TextUtils.convert_unicode_dashes_to_plain_ascii( txt_in )
19
+ end
20
+
21
+ end # class TestUnicodeHelper
metadata CHANGED
@@ -1,57 +1,49 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: textutils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.8
4
+ version: 0.7.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Gerald Bauer
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2013-08-29 00:00:00.000000000 Z
12
+ date: 2013-10-11 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: logutils
15
- requirement: !ruby/object:Gem::Requirement
16
+ requirement: &72211900 !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ~>
18
20
  - !ruby/object:Gem::Version
19
21
  version: '0.5'
20
22
  type: :runtime
21
23
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ~>
25
- - !ruby/object:Gem::Version
26
- version: '0.5'
24
+ version_requirements: *72211900
27
25
  - !ruby/object:Gem::Dependency
28
26
  name: rdoc
29
- requirement: !ruby/object:Gem::Requirement
27
+ requirement: &72228610 !ruby/object:Gem::Requirement
28
+ none: false
30
29
  requirements:
31
30
  - - ~>
32
31
  - !ruby/object:Gem::Version
33
- version: '4.0'
32
+ version: '3.10'
34
33
  type: :development
35
34
  prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ~>
39
- - !ruby/object:Gem::Version
40
- version: '4.0'
35
+ version_requirements: *72228610
41
36
  - !ruby/object:Gem::Dependency
42
37
  name: hoe
43
- requirement: !ruby/object:Gem::Requirement
38
+ requirement: &72228310 !ruby/object:Gem::Requirement
39
+ none: false
44
40
  requirements:
45
41
  - - ~>
46
42
  - !ruby/object:Gem::Version
47
- version: '3.6'
43
+ version: '3.3'
48
44
  type: :development
49
45
  prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ~>
53
- - !ruby/object:Gem::Version
54
- version: '3.6'
46
+ version_requirements: *72228310
55
47
  description: textutils - Text Filters, Helpers, Readers and More
56
48
  email: webslideshow@googlegroups.com
57
49
  executables: []
@@ -70,10 +62,13 @@ files:
70
62
  - lib/textutils/filter/erb_django_filter.rb
71
63
  - lib/textutils/filter/erb_filter.rb
72
64
  - lib/textutils/helper/address_helper.rb
65
+ - lib/textutils/helper/date_helper.rb
66
+ - lib/textutils/helper/hypertext_helper.rb
73
67
  - lib/textutils/helper/tag_helper.rb
74
68
  - lib/textutils/helper/title_helper.rb
75
69
  - lib/textutils/helper/unicode_helper.rb
76
70
  - lib/textutils/helper/value_helper.rb
71
+ - lib/textutils/helper/xml_helper.rb
77
72
  - lib/textutils/reader/code_reader.rb
78
73
  - lib/textutils/reader/fixture_reader.rb
79
74
  - lib/textutils/reader/hash_reader.rb
@@ -82,12 +77,13 @@ files:
82
77
  - lib/textutils/utils.rb
83
78
  - lib/textutils/version.rb
84
79
  - test/helper.rb
85
- - test/test_helper.rb
80
+ - test/test_hypertext_helper.rb
81
+ - test/test_title_helper.rb
82
+ - test/test_unicode_helper.rb
86
83
  - .gemtest
87
- homepage: http://geraldb.github.com/textutils
84
+ homepage: https://github.com/rubylibs/textutils
88
85
  licenses:
89
86
  - Public Domain
90
- metadata: {}
91
87
  post_install_message:
92
88
  rdoc_options:
93
89
  - --main
@@ -95,20 +91,24 @@ rdoc_options:
95
91
  require_paths:
96
92
  - lib
97
93
  required_ruby_version: !ruby/object:Gem::Requirement
94
+ none: false
98
95
  requirements:
99
96
  - - ! '>='
100
97
  - !ruby/object:Gem::Version
101
98
  version: 1.9.2
102
99
  required_rubygems_version: !ruby/object:Gem::Requirement
100
+ none: false
103
101
  requirements:
104
102
  - - ! '>='
105
103
  - !ruby/object:Gem::Version
106
104
  version: '0'
107
105
  requirements: []
108
106
  rubyforge_project: textutils
109
- rubygems_version: 2.0.6
107
+ rubygems_version: 1.8.17
110
108
  signing_key:
111
- specification_version: 4
109
+ specification_version: 3
112
110
  summary: textutils - Text Filters, Helpers, Readers and More
113
111
  test_files:
114
- - test/test_helper.rb
112
+ - test/test_unicode_helper.rb
113
+ - test/test_hypertext_helper.rb
114
+ - test/test_title_helper.rb
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: c59b2415860e0f99e9f0a71f8a9ee90f53d62e50
4
- data.tar.gz: 4bf60477e5056ecfa8c7c20c8fe9d5a93a0d93e1
5
- SHA512:
6
- metadata.gz: 1703cfd9dd7e0cef58d5e29e718ae2606dae35810b86687f56dc160f3903eb4f7bd6327a42ea51f91f0de51d38f5df062ad9002734c06798d16f4d24f963c748
7
- data.tar.gz: 35d720818928c515babb1d3f9ea3a4c34bc793e5de1889b39d8ddad52ddcb3db7bf0b7bc9f19d4413fa457b10e4bc80bbc53097aeed2d755e7815e6b409bfe20
data/test/test_helper.rb DELETED
@@ -1,36 +0,0 @@
1
- # encoding: utf-8
2
-
3
- ###
4
- # to run use
5
- # ruby -I ./lib -I ./test test/test_helper.rb
6
- # or better
7
- # rake test
8
-
9
- require 'helper'
10
-
11
- class TestHelper < MiniTest::Unit::TestCase
12
-
13
- def test_convert_unicode_dashes
14
-
15
- txt_in = "\u2010 \u2011 \u2212 \u2013 \u2014" # NB: unicode chars require double quoted strings
16
- txt_out = '- - - - -'
17
-
18
- assert( txt_out == TextUtils.convert_unicode_dashes_to_plain_ascii( txt_in ) )
19
- end
20
-
21
-
22
- def test_title_to_key
23
-
24
- txt_io = [
25
- [ 'São Paulo', 'saopaulo' ],
26
- [ 'São Gonçalo', 'saogoncalo' ],
27
- [ 'Výčepní', 'vycepni' ]
28
- ]
29
-
30
- txt_io.each do |txt|
31
- assert( txt[1] == TextUtils.title_to_key( txt[0] ) )
32
- end
33
- end
34
-
35
-
36
- end # class TestHelper