textutils 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +14 -3
- data/Rakefile +3 -3
- data/lib/textutils/reader/code_reader.rb +2 -4
- data/lib/textutils/reader/hash_reader.rb +6 -8
- data/lib/textutils/reader/line_reader.rb +3 -7
- data/lib/textutils/reader/values_reader.rb +1 -3
- data/lib/textutils/version.rb +1 -1
- metadata +45 -76
data/README.markdown
CHANGED
@@ -1,4 +1,11 @@
|
|
1
|
-
# `textutils` - Text Filters
|
1
|
+
# `textutils` - Text Filters, Helpers, Readers and More in Ruby
|
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)
|
5
|
+
* gem :: [rubygems.org/gems/textutils](https://rubygems.org/gems/textutils)
|
6
|
+
* rdoc :: [rubydoc.info/gems/textutils](http://rubydoc.info/gems/textutils)
|
7
|
+
* forum :: [groups.google.com/group/webslideshow](https://groups.google.com/group/webslideshow)
|
8
|
+
|
2
9
|
|
3
10
|
## Filters
|
4
11
|
|
@@ -81,8 +88,12 @@ The [`slideshow`](http://slideshow.rubyforge.org) gem (also known as Slide Show
|
|
81
88
|
that lets you create slide shows
|
82
89
|
and author slides in plain text using a wiki-style markup language that's easy-to-write and easy-to-read.
|
83
90
|
|
84
|
-
The [`markdown`](
|
85
|
-
of choice.
|
91
|
+
The [`markdown`](https://github.com/geraldb/markdown) gem that lets you use your markdown library
|
92
|
+
of choice.
|
93
|
+
|
94
|
+
The [`worlddb`](https://github.com/geraldb/world.db.ruby) gem that offers a command line tool for the open world database (`world.db`).
|
95
|
+
|
96
|
+
The [`sportdb`](https://github.com/geraldb/sport.db.ruby) gem that offers a command line tool for the open sport/football database (`sport.db`/`football.db`).
|
86
97
|
|
87
98
|
## Alternatives
|
88
99
|
|
data/Rakefile
CHANGED
@@ -5,11 +5,11 @@ Hoe.spec 'textutils' do
|
|
5
5
|
|
6
6
|
self.version = TextUtils::VERSION
|
7
7
|
|
8
|
-
self.summary = 'textutils - Text Filters and
|
8
|
+
self.summary = 'textutils - Text Filters, Helpers, Readers and More'
|
9
9
|
self.description = summary
|
10
10
|
|
11
11
|
self.urls = ['http://geraldb.github.com/textutils']
|
12
|
-
|
12
|
+
|
13
13
|
self.author = 'Gerald Bauer'
|
14
14
|
self.email = 'webslideshow@googlegroups.com'
|
15
15
|
|
@@ -18,7 +18,7 @@ Hoe.spec 'textutils' do
|
|
18
18
|
self.history_file = 'History.markdown'
|
19
19
|
|
20
20
|
self.extra_deps = [
|
21
|
-
['logutils', '>= 0.
|
21
|
+
['logutils', '>= 0.5.0']
|
22
22
|
]
|
23
23
|
|
24
24
|
self.licenses = ['Public Domain']
|
@@ -2,15 +2,13 @@
|
|
2
2
|
|
3
3
|
class CodeReader
|
4
4
|
|
5
|
-
|
6
|
-
@logger ||= LogUtils[ self ]
|
7
|
-
end
|
5
|
+
include LogUtils::Logging
|
8
6
|
|
9
7
|
def initialize( path )
|
10
8
|
@path = path
|
11
9
|
|
12
10
|
## nb: assume/enfore utf-8 encoding (with or without BOM - byte order mark)
|
13
|
-
## - see
|
11
|
+
## - see textutils/utils.rb
|
14
12
|
|
15
13
|
@code = File.read_utf8( @path )
|
16
14
|
end
|
@@ -3,15 +3,13 @@
|
|
3
3
|
|
4
4
|
class HashReader
|
5
5
|
|
6
|
-
|
7
|
-
@logger ||= LogUtils[ self ]
|
8
|
-
end
|
6
|
+
include LogUtils::Logging
|
9
7
|
|
10
8
|
def initialize( path )
|
11
9
|
@path = path
|
12
10
|
|
13
11
|
## nb: assume/enfore utf-8 encoding (with or without BOM - byte order mark)
|
14
|
-
## - see
|
12
|
+
## - see textutils/utils.rb
|
15
13
|
|
16
14
|
text = File.read_utf8( @path )
|
17
15
|
|
@@ -31,7 +29,7 @@ class HashReader
|
|
31
29
|
## nb: yaml does NOT support tabs see why here -> yaml.org/faq.html
|
32
30
|
|
33
31
|
text = text.gsub( "\t" ) do |_|
|
34
|
-
logger.warn "hash reader - found tab (\t) replacing w/ two spaces; yaml forbids tabs; see yaml.org/faq.html"
|
32
|
+
logger.warn "hash reader - found tab (\t) replacing w/ two spaces; yaml forbids tabs; see yaml.org/faq.html (path=#{path})"
|
35
33
|
' ' # replace w/ two spaces
|
36
34
|
end
|
37
35
|
|
@@ -41,7 +39,7 @@ class HashReader
|
|
41
39
|
## no: no
|
42
40
|
|
43
41
|
text = text.gsub( /^([ ]*)(ON|On|on|NO|No|no|N|n|Y|y)[ ]*:/ ) do |value|
|
44
|
-
logger.warn "hash reader - found implicit bool (#{$1}#{$2}) for key; adding quotes to turn into string; see yaml.org/refcard.html"
|
42
|
+
logger.warn "hash reader - found implicit bool (#{$1}#{$2}) for key; adding quotes to turn into string; see yaml.org/refcard.html (path=#{path})"
|
45
43
|
# nb: preserve leading spaces for structure - might be significant
|
46
44
|
"#{$1}'#{$2}':" # add quotes to turn it into a string (not bool e.g. true|false)
|
47
45
|
end
|
@@ -51,7 +49,7 @@ class HashReader
|
|
51
49
|
## key: nb,nn,no,se => nb,nn,'no',se -- avoid!!
|
52
50
|
|
53
51
|
text = text.gsub( /:[ ]+(ON|On|on|NO|No|no|N|n|Y|y)[ ]*($| #.*$)/ ) do |value|
|
54
|
-
logger.warn "hash reader - found implicit bool (#{$1}) for value; adding quotes to turn into string; see yaml.org/refcard.html"
|
52
|
+
logger.warn "hash reader - found implicit bool (#{$1}) for value; adding quotes to turn into string; see yaml.org/refcard.html (path=#{path})"
|
55
53
|
": '#{$1}'" # add quotes to turn it into a string (not bool e.g. true|false)
|
56
54
|
end
|
57
55
|
|
@@ -98,6 +96,6 @@ class HashReader
|
|
98
96
|
|
99
97
|
yield( key, value )
|
100
98
|
end
|
101
|
-
end # method each
|
99
|
+
end # method each
|
102
100
|
|
103
101
|
end # class HashReader
|
@@ -6,9 +6,7 @@
|
|
6
6
|
|
7
7
|
class StringLineReader
|
8
8
|
|
9
|
-
|
10
|
-
@logger ||= LogUtils[ self ]
|
11
|
-
end
|
9
|
+
include LogUtils::Logging
|
12
10
|
|
13
11
|
def initialize( data )
|
14
12
|
@data = data
|
@@ -42,15 +40,13 @@ end
|
|
42
40
|
|
43
41
|
class LineReader
|
44
42
|
|
45
|
-
|
46
|
-
@logger ||= LogUtils[ self ]
|
47
|
-
end
|
43
|
+
include LogUtils::Logging
|
48
44
|
|
49
45
|
def initialize( path )
|
50
46
|
@path = path
|
51
47
|
|
52
48
|
## nb: assume/enfore utf-8 encoding (with or without BOM - byte order mark)
|
53
|
-
## - see
|
49
|
+
## - see textutils/utils.rb
|
54
50
|
@data = File.read_utf8( @path )
|
55
51
|
end
|
56
52
|
|
data/lib/textutils/version.rb
CHANGED
metadata
CHANGED
@@ -1,77 +1,56 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: textutils
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 4
|
9
|
-
- 0
|
10
|
-
version: 0.4.0
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Gerald Bauer
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-02-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: logutils
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &84665060 !ruby/object:Gem::Requirement
|
24
17
|
none: false
|
25
|
-
requirements:
|
26
|
-
- -
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
- 3
|
32
|
-
- 0
|
33
|
-
version: 0.3.0
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.5.0
|
34
22
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: rdoc
|
38
23
|
prerelease: false
|
39
|
-
|
24
|
+
version_requirements: *84665060
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rdoc
|
27
|
+
requirement: &84664620 !ruby/object:Gem::Requirement
|
40
28
|
none: false
|
41
|
-
requirements:
|
29
|
+
requirements:
|
42
30
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 3
|
47
|
-
- 10
|
48
|
-
version: "3.10"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.10'
|
49
33
|
type: :development
|
50
|
-
version_requirements: *id002
|
51
|
-
- !ruby/object:Gem::Dependency
|
52
|
-
name: hoe
|
53
34
|
prerelease: false
|
54
|
-
|
35
|
+
version_requirements: *84664620
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: hoe
|
38
|
+
requirement: &84664250 !ruby/object:Gem::Requirement
|
55
39
|
none: false
|
56
|
-
requirements:
|
40
|
+
requirements:
|
57
41
|
- - ~>
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
segments:
|
61
|
-
- 3
|
62
|
-
- 3
|
63
|
-
version: "3.3"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '3.3'
|
64
44
|
type: :development
|
65
|
-
|
66
|
-
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *84664250
|
47
|
+
description: textutils - Text Filters, Helpers, Readers and More
|
67
48
|
email: webslideshow@googlegroups.com
|
68
49
|
executables: []
|
69
|
-
|
70
50
|
extensions: []
|
71
|
-
|
72
|
-
extra_rdoc_files:
|
51
|
+
extra_rdoc_files:
|
73
52
|
- Manifest.txt
|
74
|
-
files:
|
53
|
+
files:
|
75
54
|
- History.markdown
|
76
55
|
- Manifest.txt
|
77
56
|
- README.markdown
|
@@ -88,40 +67,30 @@ files:
|
|
88
67
|
- lib/textutils/utils.rb
|
89
68
|
- lib/textutils/version.rb
|
90
69
|
homepage: http://geraldb.github.com/textutils
|
91
|
-
licenses:
|
70
|
+
licenses:
|
92
71
|
- Public Domain
|
93
72
|
post_install_message:
|
94
|
-
rdoc_options:
|
73
|
+
rdoc_options:
|
95
74
|
- --main
|
96
75
|
- README.markdown
|
97
|
-
require_paths:
|
76
|
+
require_paths:
|
98
77
|
- lib
|
99
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
100
79
|
none: false
|
101
|
-
requirements:
|
102
|
-
- -
|
103
|
-
- !ruby/object:Gem::Version
|
104
|
-
hash: 55
|
105
|
-
segments:
|
106
|
-
- 1
|
107
|
-
- 9
|
108
|
-
- 2
|
80
|
+
requirements:
|
81
|
+
- - ! '>='
|
82
|
+
- !ruby/object:Gem::Version
|
109
83
|
version: 1.9.2
|
110
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
111
85
|
none: false
|
112
|
-
requirements:
|
113
|
-
- -
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
|
116
|
-
segments:
|
117
|
-
- 0
|
118
|
-
version: "0"
|
86
|
+
requirements:
|
87
|
+
- - ! '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
119
90
|
requirements: []
|
120
|
-
|
121
91
|
rubyforge_project: textutils
|
122
|
-
rubygems_version: 1.8.
|
92
|
+
rubygems_version: 1.8.17
|
123
93
|
signing_key:
|
124
94
|
specification_version: 3
|
125
|
-
summary: textutils - Text Filters and
|
95
|
+
summary: textutils - Text Filters, Helpers, Readers and More
|
126
96
|
test_files: []
|
127
|
-
|