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

Fix/open office gsub replacement #581

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
## Unreleased
- Fix gsub! usage for open office documents on a frozen string [580](https://github.com/roo-rb/roo/pull/580)

### Changed/Added
- Roo::Base#each_with_pagename returns Enumerator Object [576](https://github.com/roo-rb/roo/pull/576)
Expand Down
2 changes: 1 addition & 1 deletion lib/roo/open_office.rb
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,7 @@ def read_cells(sheet = default_sheet)
str_v += child.content #.text
end
end
str_v.gsub!(/'/, "'") # special case not supported by unescapeHTML
str_v = str_v.gsub(/'/, "'") # special case not supported by unescapeHTML
str_v = CGI.unescapeHTML(str_v)
end # == 'p'
end
Expand Down
Binary file added test/files/apostrophe.ods
Binary file not shown.
Binary file added test/files/frozen_string.ods
Binary file not shown.
12 changes: 12 additions & 0 deletions test/test_roo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,18 @@ def test_cell_multiline
end
end

def test_apostrophe_replacement
with_each_spreadsheet(:name=>'apostrophe', :format=>[:openoffice]) do |oo|
patrickkulling marked this conversation as resolved.
Show resolved Hide resolved
assert_equal "'", oo.cell(1,1)
end
end

def test_frozen_string_usage
with_each_spreadsheet(:name=>'frozen_string', :format=>[:openoffice]) do |oo|
assert_equal "", oo.cell(1,1)
end
end

def test_row_whitespace
# auf dieses Dokument habe ich keinen Zugriff TODO:
# TODO: No access to document whitespace?
Expand Down