-
Notifications
You must be signed in to change notification settings - Fork 71
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
Update node.rb required transitive.rb, so it can be found. #229
base: master
Are you sure you want to change the base?
Conversation
I recently tried to use REXML::Formatters::Transitive, and its not included in REXML.
Thank you for this PR. https://docs.ruby-lang.org/ja/latest/class/REXML=3a=3aFormatters=3a=3aTransitive.html (Sorry, this is a Japanese document only.)
This documentation explicitly requires 'rexml/formatters/transitive'. Do you think we should be able to use
See: #228 |
I see. @Beagle123 Specifically, they are as follows.
|
Ah, I didn't notice that we have a lazy require in |
OK, I see. @Beagle123 Specifically, they are as follows.
|
Removing require Transitive as advised.
Update document.rb
Eliminating require transitive as advised
Update element.rb
Hi: I think I've made the changes requested. However, I don't think my original issue is resolved. My issue was that using Pretty.rb resulted in my text lines having a bunch of whitespace inserted so that the XML file looks indented, but all my text has drastically changed. I was not able to require REXML::Formatters::Transitive as it was not found. I downloaded Transitive.rb, but the output was totally disjointed. I had to hack Pretty.rb to make it not alter my text, and that works. But this is not a good situation for users. I assure you that nobody will be happy with the output from Transitive, and the only choice is to have their text nodes altered by Pretty.rb. I've uploaded my new version of Transitive.rb. I concede that it is a change from the current version, but it does the desireable behavior that Transitive is supposed to do: Pretty output with preserved text lines. Thanks, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I've made the changes requested.
Thanks.
Please make some more corrections.
@@ -1505,7 +1505,7 @@ def write(output=$stdout, indent=-1, transitive=false, ie_hack=false) | |||
Kernel.warn("#{self.class.name}.write is deprecated. See REXML::Formatters", uplevel: 1) | |||
formatter = if indent > -1 | |||
if transitive | |||
require_relative "formatters/transitive" | |||
require_relative "formatters/transitive" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This position is lazy require
.
Please move this line at the beginning position of this file so that it is non-lazy require
.
See:
Lines 1 to 8 in b70388c
# frozen_string_literal: false | |
require_relative "parent" | |
require_relative "namespace" | |
require_relative "attribute" | |
require_relative "cdata" | |
require_relative "xpath" | |
require_relative "parseexception" | |
@@ -388,7 +388,7 @@ def write(*arguments) | |||
end | |||
formatter = if indent > -1 | |||
if transitive | |||
require_relative "formatters/transitive" | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this empty line.
I would like to discuss that issue in #230. |
I recently tried to use REXML::Formatters::Transitive, and its not included in REXML.