Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring to make fods (ODF Flat XML) file support easier #537

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sonota88
Copy link

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.

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.

Other Information

Nothing in particular.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 94.348% when pulling 00773dc on sonota88:refactor_for_fods into d416f15 on roo-rb:master.

@simonoff
Copy link
Member

@sonota88 I think will be better to create also a Libreoffice class too.

@paddor
Copy link

paddor commented Feb 21, 2024

What's the status here? I'd highly appreciate FODS support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants