5
5
require 'htmlentities'
6
6
require 'ydocx/markup_method'
7
7
require 'roman-numerals'
8
- require 'RMagick'
8
+ # require 'RMagick'
9
9
10
10
module YDocx
11
11
Style = Struct . new ( :b , :u , :i , :strike , :caps , :smallCaps , :font , :sz , :color , :valign , :ilvl , :numid )
@@ -294,8 +294,8 @@ def to_markup
294
294
class Parser
295
295
attr_accessor :images , :result , :space
296
296
def initialize ( doc , rel , rel_files , output_dir )
297
- @doc = Nokogiri ::XML . parse ( doc )
298
- @rel = Nokogiri ::XML . parse ( rel )
297
+ @doc = Nokogiri ::XML . parse ( doc . read )
298
+ @rel = Nokogiri ::XML . parse ( rel . read )
299
299
@rel_files = rel_files
300
300
@style_nodes = { }
301
301
@styles = { }
@@ -430,7 +430,7 @@ def compute_style(id)
430
430
431
431
def parse
432
432
if settings_file = @rel_files . select { |file | file [ :type ] =~ /relationships\/ settings$/ } . first
433
- settings_xml = Nokogiri ::XML . parse ( settings_file [ :stream ] )
433
+ settings_xml = Nokogiri ::XML . parse ( settings_file [ :stream ] . read )
434
434
if fpr = settings_xml . at_xpath ( '//w:settings//w:footnotePr' )
435
435
if start = fpr . at_xpath ( 'w:numStart' )
436
436
@cur_footnote = start [ 'w:val' ] . to_i
@@ -450,7 +450,7 @@ def parse
450
450
end
451
451
452
452
if theme_file = @rel_files . select { |file | file [ :type ] =~ /relationships\/ theme$/ } . first
453
- theme_xml = Nokogiri ::XML . parse ( theme_file [ :stream ] )
453
+ theme_xml = Nokogiri ::XML . parse ( theme_file [ :stream ] . read )
454
454
[ 'major' , 'minor' ] . each do |type |
455
455
if font = theme_xml . at_xpath ( ".//a:#{ type } Font//a:latin" )
456
456
@theme_fonts [ type ] = font [ 'typeface' ]
@@ -459,7 +459,7 @@ def parse
459
459
end
460
460
461
461
if style_file = @rel_files . select { |file | file [ :type ] =~ /relationships\/ styles$/ } . first
462
- style_xml = Nokogiri ::XML . parse ( style_file [ :stream ] )
462
+ style_xml = Nokogiri ::XML . parse ( style_file [ :stream ] . read )
463
463
style_xml . xpath ( '//w:styles//w:style' ) . each do |style |
464
464
@style_nodes [ style [ 'w:styleId' ] ] = style
465
465
end
@@ -474,7 +474,7 @@ def parse
474
474
end
475
475
476
476
if num_file = @rel_files . select { |file | file [ :type ] =~ /relationships\/ numbering$/ } . first
477
- num_xml = Nokogiri ::XML . parse ( num_file [ :stream ] )
477
+ num_xml = Nokogiri ::XML . parse ( num_file [ :stream ] . read )
478
478
abstract_nums = { }
479
479
num_xml . xpath ( '//w:numbering//w:abstractNum' ) . each do |abstr |
480
480
abstract_nums [ abstr [ 'w:abstractNumId' ] ] = abstr
0 commit comments