By this PR, users will be able to read fods files by creating a class that extends the LibreOffice or OpenOffice class as follows.
module Roo
class LibreOfficeFlatXml < LibreOffice
def supported_extension
'.fods'
end
def open_oo_file(options)
roo_content_xml_path = ::File.join(@tmpdir, 'roo_content.xml')
FileUtils.cp @filename, roo_content_xml_path
end
# Unlike content.xml in ods files, fods files contain line breaks,
# so text nodes need to be excluded.
def cell_elements(table_element)
table_element.children
.reject { |child| child.is_a? Nokogiri::XML::Text }
end
end
end
Originally I wanted to support reading ODF Flat XML, but limited the changes to the bare minimum to avoid big PR.
As you can see, these changes are simple refactorings, so these changes obviously don't break any tests.
Coverage increased (+0.01%) to 94.348% when pulling 00773dc55bba72de66dac74f549bb1a22bfa5c45 on sonota88:refactor_for_fods into d416f1520c50bbab160ca2ed9a49498fcc3edf50 on roo-rb:master.
Summary
By this PR, users will be able to read fods files by creating a class that extends the LibreOffice or OpenOffice class as follows.
Originally I wanted to support reading ODF Flat XML, but limited the changes to the bare minimum to avoid big PR. As you can see, these changes are simple refactorings, so these changes obviously don't break any tests.
Other Information
Nothing in particular.