ruby-dita 0.5.0 → 0.5.1
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 +11 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85a0bafe6702983d19108d867f6f85c87edabff4
|
4
|
+
data.tar.gz: 0d14063277adf842df00c523a27db62a65c6e7f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00c0fafcedfc7048fc353a17dce9edd1c600bac9670b1a546991c6652b2280b60961d4bfde174e0302a5d57584a0c2334aa62c04e2708ab71e2361e32174061e
|
7
|
+
data.tar.gz: f2e94d095fe58691dcf0a18c6c255a115e022bced186542b69c7c5d2391fdc109f1f0d7e44b09a58244c50644d4c31d321f82757dce026cb08e1c35f81e0c68a
|
data/lib/ruby-dita/table.rb
CHANGED
@@ -5,10 +5,11 @@ module Dita
|
|
5
5
|
|
6
6
|
|
7
7
|
# @param ary [Array] array of row entries or entry values
|
8
|
+
# @param attrs [Hash] optional attributes for row
|
8
9
|
# @return [Element] correctly formatted row
|
9
|
-
def row(ary)
|
10
|
+
def row(ary, attrs={})
|
10
11
|
return ary if ary.all? do |a| a.respond_to?(:name) and a.name == 'row' end
|
11
|
-
Element.new('row') <<
|
12
|
+
Element.new('row', attrs) <<
|
12
13
|
ary.collect do |e|
|
13
14
|
if e.is_a?(Element) and e.name == 'entry'
|
14
15
|
e
|
@@ -20,9 +21,10 @@ module Dita
|
|
20
21
|
|
21
22
|
# @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
|
22
23
|
# @param rows [Array] array of rows with which to populate table; can either be XML <row> elements or Strings representing values
|
24
|
+
# @param attrs [Hash] attributes of table
|
23
25
|
# @return [Element] valid Dita <table>
|
24
|
-
def table(column_info, rows=
|
25
|
-
t = Element.new('table')
|
26
|
+
def table(column_info, rows, attrs={})
|
27
|
+
t = Element.new('table', attrs)
|
26
28
|
headings = []
|
27
29
|
tgroup = Element.new('tgroup')
|
28
30
|
num_cols = column_info.size.to_s
|
@@ -53,11 +55,15 @@ module Dita
|
|
53
55
|
t << tgroup
|
54
56
|
end
|
55
57
|
|
58
|
+
# @param attrs [Hash] attributes of a given column
|
59
|
+
# @return [Element] colspec element
|
56
60
|
def colspec(attrs)
|
57
61
|
Element.new('colspec', attrs)
|
58
62
|
end
|
59
63
|
|
60
|
-
# @param content [String, Element] content of
|
64
|
+
# @param content [String, Element] content of entry
|
65
|
+
# @param attrs [Hash] attributes of entry
|
66
|
+
# @return [Element] entry element
|
61
67
|
def entry(content, attrs={})
|
62
68
|
Element.new('entry', attrs, [content])
|
63
69
|
end
|