html_slicer 0.2.2 → 0.2.3
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.
- checksums.yaml +4 -4
- data/README.rdoc +3 -3
- data/lib/html_slicer/interface.rb +1 -1
- data/lib/html_slicer/options.rb +2 -2
- data/lib/html_slicer/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4bd12f7607d176bb0c3a48577cf99a2755a344e6
|
4
|
+
data.tar.gz: 308758249da8267dc049c93439fee2f89a91c900
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a7613314b70cbf492638fad286b1cf511889c745549bbf9fc9cc9dc6fd8cb8d00a047f362a3b7efafeaa1bb20b947e4587ac596cf32097791ba5a2506f1fc8e6
|
7
|
+
data.tar.gz: 34f2a4ff3b79f3de1916f7520e8e06b627485c8af8799072fe080c6caa53e29e3812909917c35fdeba480e538c87773bbed05e7b3d1b543166755915eaf33968
|
data/README.rdoc
CHANGED
@@ -112,7 +112,7 @@ All configuration keys:
|
|
112
112
|
* <tt>:unit</tt> is a +Regexp/String/Hash+ description of text units counted to split the text by slices.
|
113
113
|
When value is a +Hash+, it assumes the unit is a HTML tag (look at <tt>:only/:except</tt> options for details).
|
114
114
|
Undefined value or +nil+ assumes it by default regular expression <tt>/&#?\w+;|\S/</tt>. As you can see it counts any regular character or HTML special character as a one unit.
|
115
|
-
* <tt>:maximum</tt> is a +
|
115
|
+
* <tt>:maximum</tt> is a +Integer+ number of units to be in a one slice.
|
116
116
|
|
117
117
|
If +:unit+ defined as Regexp or String, default value is 300.
|
118
118
|
|
@@ -122,7 +122,7 @@ If +:unit+ is default, default value is 2000.
|
|
122
122
|
|
123
123
|
* <tt>:complete</tt> is a +Regexp+ description of a character used to complete the slice.
|
124
124
|
For example, if you want to end the slice with a complete word, using <tt>:complete => /s+|z/</tt> the counter would continue the slice until the first whitespace character.
|
125
|
-
* <tt>:limit</tt> - a +
|
125
|
+
* <tt>:limit</tt> - a +Integer+ limit number of slices.
|
126
126
|
In many cases we just need the first slice to perform it as a partial.
|
127
127
|
* <tt>:text_break</tt> - a responsible <tt>.to_s</tt> value of text breaks between slices.
|
128
128
|
It can be an ellipsis or any other symbol.
|
@@ -136,7 +136,7 @@ It can be an ellipsis or any other symbol.
|
|
136
136
|
|
137
137
|
=== Resizing options
|
138
138
|
|
139
|
-
* <tt>:width</tt> is a
|
139
|
+
* <tt>:width</tt> is a Integer number of pixels as a target value to squeeze the HTML tag. It does the resize automatically proportional with the 'height=' (if the tag has one). The percentage values are ignored.
|
140
140
|
* <tt>:only</tt> is a +Hash+ or +Array+ of hashes, describes which exactly nodes of HTML content to resize.
|
141
141
|
* <tt>:except</tt> is a +Hash+ or +Array+ of hashes, describes which exactly nodes of HTML content NOT to resize.
|
142
142
|
|
@@ -102,7 +102,7 @@ module HtmlSlicer
|
|
102
102
|
if slice.to_i.in?(1..slice_number)
|
103
103
|
@current_slice = slice.to_i
|
104
104
|
else
|
105
|
-
raise(ArgumentError, "Slice number must be
|
105
|
+
raise(ArgumentError, "Slice number must be Integer in (1..#{slice_number}). #{slice.inspect} passed.")
|
106
106
|
end
|
107
107
|
end
|
108
108
|
self
|
data/lib/html_slicer/options.rb
CHANGED
@@ -36,7 +36,7 @@ module HtmlSlicer
|
|
36
36
|
else raise "Invalid :unit definition '#{options[:unit].inspect}'"
|
37
37
|
end
|
38
38
|
@maximum = case options[:maximum]
|
39
|
-
when
|
39
|
+
when Integer then
|
40
40
|
if options[:maximum] > 0
|
41
41
|
options[:maximum]
|
42
42
|
else
|
@@ -55,7 +55,7 @@ module HtmlSlicer
|
|
55
55
|
else raise "Invalid :complete option definition '#{options[:complete].inspect}'"
|
56
56
|
end
|
57
57
|
@limit = case options[:limit]
|
58
|
-
when
|
58
|
+
when Integer, nil then options[:limit]
|
59
59
|
else raise "Invalid :limit option definition '#{options[:limit].inspect}'"
|
60
60
|
end
|
61
61
|
@text_break = options[:text_break]
|
data/lib/html_slicer/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: html_slicer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Valery Kvon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -112,10 +112,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
version: '0'
|
113
113
|
requirements: []
|
114
114
|
rubyforge_project: html_slicer
|
115
|
-
rubygems_version: 2.6.
|
115
|
+
rubygems_version: 2.6.8
|
116
116
|
signing_key:
|
117
117
|
specification_version: 4
|
118
118
|
summary: Paginate (split) long HTML text to pages and partials. Resize embeddings
|
119
119
|
on fly. Flexible configuration.
|
120
120
|
test_files: []
|
121
|
-
has_rdoc:
|