[前][次][番号順一覧][スレッド一覧]

ruby-changes:30403

From: kou <ko1@a...>
Date: Sat, 10 Aug 2013 11:34:17 +0900 (JST)
Subject: [ruby-changes:30403] kou:r42482 (trunk): * lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser::PUBLIC):

kou	2013-08-10 11:34:06 +0900 (Sat, 10 Aug 2013)

  New Revision: 42482

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42482

  Log:
    * lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser::PUBLIC):
      Fix loose "head" match regular expression.
      [Bug #8701] [ruby-dev:47551]
      Patch by Ippei Obayashi. Thanks!!!
    * test/rexml/parse/test_notation_declaration.rb (#test_system_public):
      Add a test for the above case.

  Modified files:
    trunk/ChangeLog
    trunk/lib/rexml/parsers/baseparser.rb
    trunk/test/rexml/parse/test_notation_declaration.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42481)
+++ ChangeLog	(revision 42482)
@@ -1,3 +1,12 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat Aug 10 11:31:35 2013  Kouhei Sutou  <kou@c...>
+
+	* lib/rexml/parsers/baseparser.rb (REXML::Parsers::BaseParser::PUBLIC):
+	  Fix loose "head" match regular expression.
+	  [Bug #8701] [ruby-dev:47551]
+	  Patch by Ippei Obayashi. Thanks!!!
+	* test/rexml/parse/test_notation_declaration.rb (#test_system_public):
+	  Add a test for the above case.
+
 Sat Aug 10 09:20:21 2013  Zachary Scott  <e@z...>
 
 	* NEWS: [DOC] typo in example reported by @moretea
Index: lib/rexml/parsers/baseparser.rb
===================================================================
--- lib/rexml/parsers/baseparser.rb	(revision 42481)
+++ lib/rexml/parsers/baseparser.rb	(revision 42482)
@@ -77,7 +77,7 @@ module REXML https://github.com/ruby/ruby/blob/trunk/lib/rexml/parsers/baseparser.rb#L77
       ATTLISTDECL_START = /^\s*<!ATTLIST/um
       ATTLISTDECL_PATTERN = /^\s*<!ATTLIST\s+#{NAME}(?:#{ATTDEF})*\s*>/um
       NOTATIONDECL_START = /^\s*<!NOTATION/um
-      PUBLIC = /^\s*<!NOTATION\s+(\w[\-\w]*)\s+(PUBLIC)\s+(["'])(.*?)\3(?:\s+(["'])(.*?)\5)?\s*>/um
+      PUBLIC = /\A\s*<!NOTATION\s+(\w[\-\w]*)\s+(PUBLIC)\s+(["'])(.*?)\3(?:\s+(["'])(.*?)\5)?\s*>/um
       SYSTEM = /^\s*<!NOTATION\s+(\w[\-\w]*)\s+(SYSTEM)\s+(["'])(.*?)\3\s*>/um
 
       TEXT_PATTERN = /\A([^<]*)/um
Index: test/rexml/parse/test_notation_declaration.rb
===================================================================
--- test/rexml/parse/test_notation_declaration.rb	(revision 42481)
+++ test/rexml/parse/test_notation_declaration.rb	(revision 42482)
@@ -73,5 +73,16 @@ class TestParseNotationDeclaration < Tes https://github.com/ruby/ruby/blob/trunk/test/rexml/parse/test_notation_declaration.rb#L73
         end
       end
     end
+
+    class TestMixed < self
+      def test_system_public
+        doctype = parse(<<-INTERNAL_SUBSET)
+<!NOTATION system-name SYSTEM "system-literal">
+<!NOTATION public-name PUBLIC "public-id-literal" 'system-literal'>
+        INTERNAL_SUBSET
+        assert_equal(["system-name", "public-name"],
+                     doctype.notations.collect(&:name))
+      end
+    end
   end
 end

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]