h5-min 0.1.1 → 0.1.2
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.
- data/VERSION +1 -1
- data/fixtures/quot-entity.html +5 -0
- data/fixtures/quot-entity.html.min +1 -0
- data/lib/h5-min.rb +5 -3
- data/spec/h5-min_spec.rb +1 -0
- metadata +5 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
@@ -0,0 +1 @@
|
|
1
|
+
<!doctype html><meta charset=utf-8><title>Untitled</title><p>"q'<pre>&"'</pre>
|
data/lib/h5-min.rb
CHANGED
@@ -90,12 +90,14 @@ module HTML5
|
|
90
90
|
value =~ /[[:space:]"'><=`]/ or value.empty?
|
91
91
|
end
|
92
92
|
|
93
|
-
def format_entities html
|
94
|
-
entities.encode(entities.decode(html), :basic)
|
93
|
+
def format_entities html, except={}
|
94
|
+
html = entities.encode(entities.decode(html), :basic)
|
95
|
+
except.each{|name, replace| html.gsub!(/&#{name};/, replace)}
|
96
|
+
html
|
95
97
|
end
|
96
98
|
|
97
99
|
def format_text_node
|
98
|
-
text = format_entities text_node
|
100
|
+
text = format_entities text_node, {quot: ?", apos: ?'}
|
99
101
|
return text if in_pre_element?
|
100
102
|
text.gsub!(/[\n\t]/,'')
|
101
103
|
# Don't strip inter-element white space for flow elements
|
data/spec/h5-min_spec.rb
CHANGED
@@ -22,6 +22,7 @@ end
|
|
22
22
|
attribute_value_quot: "encodes quotation marks in attribute values",
|
23
23
|
entities_expand: "decodes safe HTML entities",
|
24
24
|
sort_attributes: "sorts attribute names alphabetically",
|
25
|
+
quot_entity: "expands " entity in text nodes",
|
25
26
|
}
|
26
27
|
|
27
28
|
describe HTML5, '.minify' do
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 2
|
9
|
+
version: 0.1.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Run Paint Run Run
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-07-
|
17
|
+
date: 2010-07-12 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -100,6 +100,8 @@ files:
|
|
100
100
|
- fixtures/pre-entities.html.min
|
101
101
|
- fixtures/pre.html
|
102
102
|
- fixtures/pre.html.min
|
103
|
+
- fixtures/quot-entity.html
|
104
|
+
- fixtures/quot-entity.html.min
|
103
105
|
- fixtures/skeleton.html
|
104
106
|
- fixtures/skeleton.html.min
|
105
107
|
- fixtures/sort-attributes.html
|