Nuked Oga::XML::Lexer#html
This method was rather pointless since there's already a "html?" method.
This commit is contained in:
1 parent
020cd34083
commit
4031c4f843
4 files changed
+6
-10
No files matched your search
+3
-3
@@ -28,7 +28,7 @@ on `ts` and `te`) so the macro ignores this argument.
|
||||
ID id_advance_line;
|
||||
ID id_html_script_p;
|
||||
ID id_html_style_p;
|
||||
ID id_html;
|
||||
ID id_html_p;
|
||||
|
||||
%%machine c_lexer;
|
||||
|
||||
@@ -81,7 +81,7 @@ VALUE oga_xml_lexer_advance(VALUE self, VALUE data_block)
|
||||
int lines;
|
||||
|
||||
/* Whether or not HTML mode is enabled */
|
||||
int html_p = rb_funcall(self, id_html, 0) == Qtrue;
|
||||
int html_p = rb_funcall(self, id_html_p, 0) == Qtrue;
|
||||
|
||||
/* Make sure that all data passed back to Ruby has the proper encoding. */
|
||||
rb_encoding *encoding = rb_enc_get(data_block);
|
||||
@@ -189,7 +189,7 @@ void Init_liboga_xml_lexer()
|
||||
id_advance_line = rb_intern("advance_line");
|
||||
id_html_script_p = rb_intern("html_script?");
|
||||
id_html_style_p = rb_intern("html_style?");
|
||||
id_html = rb_intern("html");
|
||||
id_html_p = rb_intern("html?");
|
||||
|
||||
rb_define_method(cLexer, "advance_native", oga_xml_lexer_advance, 1);
|
||||
rb_define_method(cLexer, "reset_native", oga_xml_lexer_reset, 0);
|
||||
|
||||
@@ -89,7 +89,7 @@ public class Lexer extends RubyObject
|
||||
@JRubyMethod
|
||||
public IRubyObject advance_native(ThreadContext context, RubyString rb_str)
|
||||
{
|
||||
Boolean html_p = this.callMethod(context, "html").isTrue();
|
||||
Boolean html_p = this.callMethod(context, "html?").isTrue();
|
||||
|
||||
Encoding encoding = rb_str.getEncoding();
|
||||
|
||||
|
||||
@@ -34,14 +34,10 @@ module Oga
|
||||
# However, it is perfectly save to use different instances per thread.
|
||||
# There is no _global_ state used by this lexer.
|
||||
#
|
||||
# @!attribute [r] html
|
||||
# @return [TrueClass|FalseClass]
|
||||
#
|
||||
# @private
|
||||
#
|
||||
class Lexer
|
||||
attr_reader :html
|
||||
|
||||
# These are all constant/frozen to remove the need for String allocations
|
||||
# every time they are referenced in the lexer.
|
||||
HTML_SCRIPT = 'script'.freeze
|
||||
@@ -206,7 +202,7 @@ module Oga
|
||||
# @return [TrueClass|FalseClass]
|
||||
#
|
||||
def html?
|
||||
return !!html
|
||||
return @html == true
|
||||
end
|
||||
|
||||
##
|
||||
|
||||
@@ -310,7 +310,7 @@ string_body
|
||||
# @return [Oga::XML::Document]
|
||||
#
|
||||
def on_document(children = [])
|
||||
document = Document.new(:type => @lexer.html ? :html : :xml)
|
||||
document = Document.new(:type => @lexer.html? ? :html : :xml)
|
||||
|
||||
children.each do |child|
|
||||
if child.is_a?(Doctype)
|
||||
|
||||
Reference in new issue
Block a user