ooxml_parser 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 071bdcbc2fb31371918e97a11e168bcdd849a3a606d880a6f8f29f03d3fc54c9
4
- data.tar.gz: 48631f0dcb24d64688065bbb226d8e0c3dd13f18473a680aa33fcf284751b195
3
+ metadata.gz: ba540828c5a8309f41774a4a3e8f2ab583191c861ae51f32a0a6fbfb92cf6d91
4
+ data.tar.gz: b747ef0164eb751ab889cb184025a1606794f0670aab618d2486a889c5d2f76a
5
5
  SHA512:
6
- metadata.gz: 175a3bb85a4c2b85cf577c498c50c021c180c9054440451a55b81d93752eb6211908e2309738dc8486ab0adfdd0cdcd3f5afbf75910226141f179ae878c62e6a
7
- data.tar.gz: 031f7cf2aa5d53223df37d425fa0050a5ff875d3646ea5e82c56064262927ac728d5ed6563c557a9fc74d8da6f3a1b34ce230ed41b536914450ee7efe2a58831
6
+ metadata.gz: cc16c99a930f7a68016d099c293bc58672b345eb583d599c4b5ae885dfad705b42103b0f3f79d6604ccfb03b2eb8747f9b1663ea08ed04401002a7f4cdcd4eb7
7
+ data.tar.gz: 4824d4244130d1e120ea6cfffb0c34471aff1d9725a60e8fe27a2c5fc04826b5b325cbcfdaaab2f12e1016fdbf88b807adaaff5301ac1d91397358c2e17f6170
@@ -1,14 +1,11 @@
1
1
  module OoxmlParser
2
2
  # Class for parsing `w:w:sdtContent` tags
3
3
  class SDTContent < OOXMLDocumentObject
4
- # @return [Array, ParagraphRun] runs of sdt
5
- attr_reader :runs
6
- # @return [Array, ParagraphRun] paragraphs of sdt
7
- attr_reader :paragraphs
4
+ # @return [Array <ParagraphRun, Table, ParagraphRun>] list of all elements in SDT
5
+ attr_reader :elements
8
6
 
9
7
  def initialize(parent: nil)
10
- @runs = []
11
- @paragraphs = []
8
+ @elements = []
12
9
  @parent = parent
13
10
  end
14
11
 
@@ -19,12 +16,29 @@ module OoxmlParser
19
16
  node.xpath('*').each do |node_child|
20
17
  case node_child.name
21
18
  when 'p'
22
- @paragraphs << DocxParagraph.new(parent: self).parse(node_child)
19
+ @elements << DocxParagraph.new(parent: self).parse(node_child)
23
20
  when 'r'
24
- @runs << ParagraphRun.new(parent: self).parse(node_child)
21
+ @elements << ParagraphRun.new(parent: self).parse(node_child)
22
+ when 'tbl'
23
+ @elements << Table.new(parent: self).parse(node_child)
25
24
  end
26
25
  end
27
26
  self
28
27
  end
28
+
29
+ # @return [Array<DocxParagraphs>] list of paragraphs
30
+ def paragraphs
31
+ @elements.select { |obj| obj.is_a?(OoxmlParser::DocxParagraph) }
32
+ end
33
+
34
+ # @return [Array<ParagraphRun>] list of runs
35
+ def runs
36
+ @elements.select { |obj| obj.is_a?(OoxmlParser::ParagraphRun) }
37
+ end
38
+
39
+ # @return [Array<Table>] list of tables
40
+ def tables
41
+ @elements.select { |obj| obj.is_a?(OoxmlParser::Table) }
42
+ end
29
43
  end
30
44
  end
@@ -1,6 +1,6 @@
1
1
  module OoxmlParser
2
2
  # This module holds the RuboCop version information.
3
3
  module Version
4
- STRING = '0.3.0'.freeze
4
+ STRING = '0.4.0'.freeze
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ooxml_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Lobashov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-02-19 00:00:00.000000000 Z
12
+ date: 2018-02-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri