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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ruby-dita/table.rb +11 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83ece111fe0ac7b5650bb2a3ca496ee8ac8a27a6
4
- data.tar.gz: 4b1b28b1bc0dc917a426bb80ef951a3c390e627b
3
+ metadata.gz: 85a0bafe6702983d19108d867f6f85c87edabff4
4
+ data.tar.gz: 0d14063277adf842df00c523a27db62a65c6e7f5
5
5
  SHA512:
6
- metadata.gz: ce8b7933ddbfd7e051d65ed2de3a94086252c87347770172566cf60def113d6334cd89e78bfe26c4229ca3e59b3e563333d84fa2eb864a246d2c19cd80033b6b
7
- data.tar.gz: 4580b04dba50973ee5c13d01f7987427ec59f21dee9cfda345ea9c2b3cca4179013cce874b683c4f64cc2b1df230b4501436e38814f61a28802e05acab11d6fe
6
+ metadata.gz: 00c0fafcedfc7048fc353a17dce9edd1c600bac9670b1a546991c6652b2280b60961d4bfde174e0302a5d57584a0c2334aa62c04e2708ab71e2361e32174061e
7
+ data.tar.gz: f2e94d095fe58691dcf0a18c6c255a115e022bced186542b69c7c5d2391fdc109f1f0d7e44b09a58244c50644d4c31d321f82757dce026cb08e1c35f81e0c68a
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-dita
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Kong