ooxml_parser 0.30.0 → 0.31.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: f8264219a82e05f855d6e850703479fdfbb25b866ee5eb5705ac5171903fd7dd
4
- data.tar.gz: e5ef8d6182d11e432c97bc8d63a1632f270c443acf17803b6abafc502ae0681a
3
+ metadata.gz: 682b6146d274c90e967ce9d494c4c6df0fafe597d9dc01fc27c3b8fa854630c2
4
+ data.tar.gz: a5f7c131398910ef896a0c0b21578083e02dbe84aa6d024bf4abd4e2fab2c1bb
5
5
  SHA512:
6
- metadata.gz: d666854752d50ce5a26dd6c36fa78b801e34de2938eb10e6247ca11832979eea3b23a8fc8a838e272b64df9e13f0947a747dbe322ac008ec797cd0a836c22519
7
- data.tar.gz: 81facb1e39faa54991524a2c3b3b613588c990d6cf02be6ac063b17c6971f0f08af0bc09a95cdae99a7a4eb50d1bb1a7278bc76377c0e496786b6f86335335f2
6
+ metadata.gz: df07e615fd1ecc0c4436072b978f6f6ba8959a83785d88fe2a1922417c94daef2227ae4914f34683e3f9542ca35e68de2652c5cf78b2a52cf828d6f46b850aa2
7
+ data.tar.gz: 0fce9c7ca3617ef27c67acc338f8e2eaa7a2220d98de3d4367d4b4bcf89f445a1982e58fe2e3f4ec6aa1bca48e8ed533f7bed9ad0a7d64244620f47dd241b4c3
@@ -21,7 +21,7 @@ module OoxmlParser
21
21
  # Parse ContentTypes object
22
22
  # @return [ContentTypes] result of parsing
23
23
  def parse
24
- doc = Nokogiri::XML.parse(File.open("#{root_object.unpacked_folder}/[Content_Types].xml"))
24
+ doc = parse_xml("#{root_object.unpacked_folder}/[Content_Types].xml")
25
25
  node = doc.xpath('*').first
26
26
 
27
27
  node.xpath('*').each do |node_child|
@@ -3,6 +3,11 @@
3
3
  module OoxmlParser
4
4
  # Class for working with coordinates
5
5
  class Coordinates
6
+ # @return [Regexp] regexp for row name
7
+ ROW_REGEXP = /[a-z]/i.freeze
8
+ # @return [Regexp] regexp for column name
9
+ COLUMN_REGEXP = /\d/.freeze
10
+
6
11
  attr_accessor :row, :column, :list
7
12
 
8
13
  def initialize(row = nil, column = nil, list = nil)
@@ -30,10 +35,10 @@ module OoxmlParser
30
35
  range = arguments_string.split(':')
31
36
 
32
37
  difference = []
33
- symbols_from = range.first.scan(/[a-zA-z]/).join
34
- symbols_to = range.last.scan(/[a-zA-z]/).join
35
- digits_from = range.first.scan(/[0-9]/).join
36
- digits_to = range.last.scan(/[0-9]/).join
38
+ symbols_from = range.first.scan(ROW_REGEXP).join
39
+ symbols_to = range.last.scan(ROW_REGEXP).join
40
+ digits_from = range.first.scan(COLUMN_REGEXP).join
41
+ digits_to = range.last.scan(COLUMN_REGEXP).join
37
42
 
38
43
  difference[0] = [symbols_from, symbols_to] unless symbols_from == symbols_to
39
44
  difference[1] = [digits_from, digits_to] unless digits_from == digits_to
@@ -47,6 +47,8 @@ module OoxmlParser
47
47
  attr_accessor :shade
48
48
  # @return [RunStyle] run style
49
49
  attr_accessor :run_style
50
+ # @return [ValuedChild] ligatures type
51
+ attr_reader :ligatures
50
52
 
51
53
  def initialize(params = {})
52
54
  @font_name = params.fetch(:font_name, '')
@@ -124,6 +126,8 @@ module OoxmlParser
124
126
  @shade = Shade.new(parent: self).parse(node_child)
125
127
  when 'rStyle'
126
128
  @run_style = RunStyle.new(parent: self).parse(node_child)
129
+ when 'ligatures'
130
+ @ligatures = ValuedChild.new(:symbol, parent: self).parse(node_child)
127
131
  end
128
132
  end
129
133
  @font_color = DocxColorScheme.new(parent: self).parse(node)
@@ -41,7 +41,7 @@ module OoxmlParser
41
41
  numbering_xml = "#{root_object.unpacked_folder}word/numbering.xml"
42
42
  return nil unless File.exist?(numbering_xml)
43
43
 
44
- node = parse_xml(File.open(numbering_xml))
44
+ node = parse_xml(numbering_xml)
45
45
  node.xpath('w:numbering/*').each do |numbering_child_node|
46
46
  case numbering_child_node.name
47
47
  when 'abstractNum'
@@ -18,7 +18,7 @@ module OoxmlParser
18
18
  def parse(file = "#{root_object.unpacked_folder}/#{root_object.root_subfolder}/commentAuthors.xml")
19
19
  return nil unless File.exist?(file)
20
20
 
21
- document = parse_xml(File.open(file))
21
+ document = parse_xml(file)
22
22
  node = document.xpath('*').first
23
23
 
24
24
  node.xpath('*').each do |node_child|
@@ -18,7 +18,7 @@ module OoxmlParser
18
18
  def parse(file = "#{root_object.unpacked_folder}/#{root_object.root_subfolder}/comments/comment1.xml")
19
19
  return nil unless File.exist?(file)
20
20
 
21
- document = parse_xml(File.open(file))
21
+ document = parse_xml(file)
22
22
  node = document.xpath('*').first
23
23
 
24
24
  node.xpath('*').each do |node_child|
@@ -4,6 +4,6 @@ module OoxmlParser
4
4
  # This module holds the RuboCop version information.
5
5
  module Version
6
6
  # [String] Version of Gem
7
- STRING = '0.30.0'
7
+ STRING = '0.31.0'
8
8
  end
9
9
  end
@@ -55,7 +55,7 @@ module OoxmlParser
55
55
  # @param [String] file path
56
56
  # @return [PivotTableDefinition] result of parsing
57
57
  def parse(file)
58
- doc = Nokogiri::XML.parse(File.open("#{root_object.unpacked_folder}/#{file}"))
58
+ doc = parse_xml("#{root_object.unpacked_folder}/#{file}")
59
59
  node = doc.xpath('//xmlns:pivotTableDefinition').first
60
60
  node.attributes.each do |key, value|
61
61
  case key
@@ -121,7 +121,7 @@ module OoxmlParser
121
121
  parse_shared_strings
122
122
  @root_subfolder = 'xl/'
123
123
  root_object.add_to_xmls_stack('xl/workbook.xml')
124
- @doc = Nokogiri::XML.parse(File.open(root_object.current_xml))
124
+ @doc = parse_xml(root_object.current_xml)
125
125
  @theme = PresentationTheme.new(parent: self).parse("xl/#{link_to_theme_xml}") if link_to_theme_xml
126
126
  @style_sheet = StyleSheet.new(parent: self).parse
127
127
  @doc.xpath('xmlns:workbook/xmlns:sheets/xmlns:sheet').each do |sheet|
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.30.0
4
+ version: 0.31.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ONLYOFFICE
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2022-09-09 00:00:00.000000000 Z
13
+ date: 2022-09-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: nokogiri