ruby-dita 0.4.1 → 0.4.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.
- checksums.yaml +4 -4
- data/lib/ruby-dita/table.rb +17 -15
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1af38adc31c347ffc596b067eeb226e3dc86b15
|
4
|
+
data.tar.gz: e30b30ca84310171ae891ebf739a71daee533644
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7956a887ecb92c3c26b6deca57cc007f05c103c16ee09c7dd6f8347c6679767e557cf85402796f3b25eda35b941c2e7e088f86d93fdf5f82996dd346c265f60b
|
7
|
+
data.tar.gz: 1e381bb7c3d09c2204faa65c823ae7ee69502d6f2bf397cb202095143f0f2e1e158a18eb0875f93e09678f2066ff9df4f3139493785b4744d41c411ba370bc2e
|
data/lib/ruby-dita/table.rb
CHANGED
@@ -2,6 +2,22 @@ require 'duxml'
|
|
2
2
|
|
3
3
|
module Dita
|
4
4
|
include Duxml
|
5
|
+
|
6
|
+
|
7
|
+
# @param ary [Array] array of row entries or entry values
|
8
|
+
# @return [Element] correctly formatted row
|
9
|
+
def row(ary)
|
10
|
+
return ary if ary.all? do |a| a.respond_to?(:name) and a.name == 'row' end
|
11
|
+
Element.new('row') <<
|
12
|
+
ary.collect do |entry|
|
13
|
+
if entry.is_a?(Element) and entry.name == 'entry'
|
14
|
+
entry
|
15
|
+
else
|
16
|
+
Element.new('entry') << entry
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
5
21
|
# @param column_info [Array, Hash] if Array of Strings, column headings; if Array of Elements, colspecs; if Hash, keys are strings for column headings; values are <colspec> elements
|
6
22
|
# @param rows [Array] array of rows with which to populate table; can either be XML <row> elements or Strings representing values
|
7
23
|
# @return [Element] valid Dita <table>
|
@@ -22,7 +38,7 @@ module Dita
|
|
22
38
|
if headings.any?
|
23
39
|
tgroup << Element.new('thead', [Element.new('row')])
|
24
40
|
headings.each do |h|
|
25
|
-
tgroup.thead.
|
41
|
+
tgroup.thead.nodes.first << Element.new('entry', [h])
|
26
42
|
end
|
27
43
|
end
|
28
44
|
|
@@ -31,18 +47,4 @@ module Dita
|
|
31
47
|
tgroup.tbody << rows.collect do |r| row r end
|
32
48
|
t << tgroup
|
33
49
|
end
|
34
|
-
|
35
|
-
# @param ary [Array] array of row entries or entry values
|
36
|
-
# @return [Element] correctly formatted row
|
37
|
-
def row(ary)
|
38
|
-
return ary if ary.all? do |a| a.respond_to?(:name) and a.name == 'row' end
|
39
|
-
Element.new('row') <<
|
40
|
-
ary.collect do |entry|
|
41
|
-
if entry.is_a?(Element) and entry.name == 'entry'
|
42
|
-
entry
|
43
|
-
else
|
44
|
-
Element.new('entry') << entry
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
48
50
|
end # end of module Table
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-dita
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Kong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: duxml
|