clifton_lib 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/lib/clifton_lib/version.rb +1 -1
- data/lib/clifton_lib/xml/xml_document.rb +4 -4
- data/lib/clifton_lib/xml/xml_text_writer.rb +15 -1
- metadata +6 -6
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -34,6 +34,7 @@ This implementation:
|
|
34
34
|
|
35
35
|
## Revisions
|
36
36
|
|
37
|
+
Published 0.0.8 - Fixed indentation issues with XmlFragments
|
37
38
|
Published 0.0.7 - Added XmlFragment
|
38
39
|
0.0.6 -
|
39
40
|
Published 0.0.5 - Added support to disallow a closing tag for HTML5 compatibility. For example, <img> is valid, <img></img> is seen as a stray ending tag.
|
data/lib/clifton_lib/version.rb
CHANGED
@@ -94,7 +94,7 @@ module CliftonXml
|
|
94
94
|
writer.new_line()
|
95
95
|
elsif node.is_a?(XmlFragment)
|
96
96
|
# if it's a fragment, just write the fragment, which is expected to be a string.
|
97
|
-
writer.
|
97
|
+
writer.write_fragment(node.text)
|
98
98
|
else
|
99
99
|
# begin element tag and attributes
|
100
100
|
writer.write('<' + node.name)
|
@@ -106,7 +106,7 @@ module CliftonXml
|
|
106
106
|
writer.write('</' + node.name + '>')
|
107
107
|
crlf_if_more_nodes(writer, nodes, idx)
|
108
108
|
else
|
109
|
-
|
109
|
+
# Children are allowed only if there is no inner text.
|
110
110
|
if node.has_child_nodes()
|
111
111
|
# close element tag, indent, and recurse.
|
112
112
|
writer.write('>')
|
@@ -152,7 +152,7 @@ module CliftonXml
|
|
152
152
|
if attr.value.nil?
|
153
153
|
attrs << attr.name
|
154
154
|
else
|
155
|
-
|
155
|
+
attrs << attr.name + '="' + attr.value + '"'
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
@@ -161,7 +161,7 @@ module CliftonXml
|
|
161
161
|
|
162
162
|
# requires a leading space as well to separate from the element name.
|
163
163
|
writer.write(' ' + attr_str)
|
164
|
-
|
164
|
+
end
|
165
165
|
|
166
166
|
nil
|
167
167
|
end
|
@@ -16,9 +16,23 @@ module CliftonXml
|
|
16
16
|
@allow_self_closing_tags = true # HTML5 compatibility, set to false.
|
17
17
|
end
|
18
18
|
|
19
|
-
# void write(string str)
|
20
19
|
def write(str)
|
21
20
|
@output << str
|
21
|
+
end
|
22
|
+
|
23
|
+
# void write(string str)
|
24
|
+
def write_fragment(str)
|
25
|
+
if @formatting == :indented
|
26
|
+
# Take the fragment, split up the CRLF's, and write out in an indented manner.
|
27
|
+
# Let the formatting of the fragment handle its indentation at our current indent level.
|
28
|
+
lines = str.split("\r\n")
|
29
|
+
lines.each_with_index do |line, idx|
|
30
|
+
@output << line
|
31
|
+
new_line() if idx < lines.count - 1 # No need for a new line on the last line.
|
32
|
+
end
|
33
|
+
else
|
34
|
+
@output << str
|
35
|
+
end
|
22
36
|
|
23
37
|
nil
|
24
38
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: clifton_lib
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
16
|
-
requirement: &
|
16
|
+
requirement: &3528780 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '1.3'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *3528780
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &3528288 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *3528288
|
36
36
|
description: A collection of useful helper classes, initially a set of classes to
|
37
37
|
support creation and serialization of XML.
|
38
38
|
email:
|