1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* enc/trans/escape.trans: transcoder name renamed to use underscore.

* transcode.c: follow the renaming.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2008-09-12 17:30:07 +00:00
parent 248acf0025
commit 41d3a01486
4 changed files with 30 additions and 24 deletions

View file

@ -1,3 +1,9 @@
Sat Sep 13 02:29:19 2008 Tanaka Akira <akr@fsij.org>
* enc/trans/escape.trans: transcoder name renamed to use underscore.
* transcode.c: follow the renaming.
Sat Sep 13 02:12:17 2008 Tanaka Akira <akr@fsij.org>
* transcode.c (rb_econv_init_by_convpath_i): new function.

View file

@ -5,19 +5,19 @@
str.unpack("H*")[0]
end
transcode_tblgen("", "amp-escaped", [
transcode_tblgen("", "amp_escape", [
["{00-25,27-FF}", :nomap],
["26", hexstr("&amp;")]
])
transcode_tblgen("", "xml-text-escaped", [
transcode_tblgen("", "xml_text_escape", [
["{00-25,27-3B,3D,3F-FF}", :nomap],
["26", hexstr("&amp;")],
["3C", hexstr("&lt;")],
["3E", hexstr("&gt;")]
])
transcode_tblgen("", "xml-attr-content-escaped", [
transcode_tblgen("", "xml_attr_content_escape", [
["{00-21,23-25,27-3B,3D,3F-FF}", :nomap],
["22", hexstr("&quot;")],
["26", hexstr("&amp;")],
@ -74,7 +74,7 @@ escape_xml_attr_quote_finish(void *statep, unsigned char *o)
static const rb_transcoder
rb_escape_xml_attr_quote = {
"", "xml-attr-quoted", escape_xml_attr_quote,
"", "xml_attr_quote", escape_xml_attr_quote,
TRANSCODE_TABLE_INFO,
1, /* input_unit_length */
1, /* max_input */

View file

@ -37,7 +37,7 @@ class TestEncodingConverter < Test::Unit::TestCase
assert_nil(Encoding::Converter.asciicompat_encoding("EUC-JP"))
assert_nil(Encoding::Converter.asciicompat_encoding("UTF-8"))
assert_nil(Encoding::Converter.asciicompat_encoding(Encoding::UTF_8))
assert_nil(Encoding::Converter.asciicompat_encoding("xml-attr-escaped"))
assert_nil(Encoding::Converter.asciicompat_encoding("xml_attr_escape"))
assert_nil(Encoding::Converter.asciicompat_encoding("encoding-not-exist"))
end
@ -755,45 +755,45 @@ class TestEncodingConverter < Test::Unit::TestCase
end
def test_xml_escape_text
ec = Encoding::Converter.new("", "amp-escaped")
ec = Encoding::Converter.new("", "amp_escape")
assert_equal('&amp;<>"', ec.convert("&<>\""))
assert_equal('', ec.finish)
ec = Encoding::Converter.new("", "xml-text-escaped")
ec = Encoding::Converter.new("", "xml_text_escape")
assert_equal('&amp;&lt;&gt;"', ec.convert("&<>\""))
assert_equal('', ec.finish)
end
def test_xml_escape_attr_content
ec = Encoding::Converter.new("", "xml-attr-content-escaped")
ec = Encoding::Converter.new("", "xml_attr_content_escape")
assert_equal('', ec.finish)
ec = Encoding::Converter.new("", "xml-attr-content-escaped")
ec = Encoding::Converter.new("", "xml_attr_content_escape")
assert_equal('', ec.convert(""))
assert_equal('', ec.finish)
ec = Encoding::Converter.new("", "xml-attr-content-escaped")
ec = Encoding::Converter.new("", "xml_attr_content_escape")
assert_equal('&quot;', ec.convert('"'))
assert_equal('', ec.finish)
ec = Encoding::Converter.new("", "xml-attr-content-escaped")
ec = Encoding::Converter.new("", "xml_attr_content_escape")
assert_equal('&amp;&lt;&gt;&quot;', ec.convert("&<>\""))
assert_equal('', ec.finish)
end
def test_xml_escape_attr_quote
ec = Encoding::Converter.new("", "xml-attr-quoted")
ec = Encoding::Converter.new("", "xml_attr_quote")
assert_equal('""', ec.finish)
ec = Encoding::Converter.new("", "xml-attr-quoted")
ec = Encoding::Converter.new("", "xml_attr_quote")
assert_equal('', ec.convert(""))
assert_equal('""', ec.finish)
ec = Encoding::Converter.new("", "xml-attr-quoted")
ec = Encoding::Converter.new("", "xml_attr_quote")
assert_equal('""', ec.convert('"'))
assert_equal('"', ec.finish)
ec = Encoding::Converter.new("", "xml-attr-quoted")
ec = Encoding::Converter.new("", "xml_attr_quote")
assert_equal('"&<>"', ec.convert("&<>\""))
assert_equal('"', ec.finish)
end

View file

@ -970,11 +970,11 @@ decorator_names(int ecflags, const char **decorators_ret)
num_decorators = 0;
if (ecflags & ECONV_XML_TEXT_DECORATOR)
decorators_ret[num_decorators++] = "xml-text-escaped";
decorators_ret[num_decorators++] = "xml_text_escape";
if (ecflags & ECONV_XML_ATTR_CONTENT_DECORATOR)
decorators_ret[num_decorators++] = "xml-attr-content-escaped";
decorators_ret[num_decorators++] = "xml_attr_content_escape";
if (ecflags & ECONV_XML_ATTR_QUOTE_DECORATOR)
decorators_ret[num_decorators++] = "xml-attr-quoted";
decorators_ret[num_decorators++] = "xml_attr_quote";
if (ecflags & ECONV_CRLF_NEWLINE_DECORATOR)
decorators_ret[num_decorators++] = "crlf_newline";
@ -1905,27 +1905,27 @@ econv_description(const char *sname, const char *dname, int ecflags, VALUE mesg)
rb_str_cat2(mesg, " with ");
if (ecflags & ECONV_UNIVERSAL_NEWLINE_DECORATOR) {
rb_str_cat2(mesg, pre); pre = ",";
rb_str_cat2(mesg, "universal-newline");
rb_str_cat2(mesg, "universal_newline");
}
if (ecflags & ECONV_CRLF_NEWLINE_DECORATOR) {
rb_str_cat2(mesg, pre); pre = ",";
rb_str_cat2(mesg, "CRLF-newline");
rb_str_cat2(mesg, "crlf_newline");
}
if (ecflags & ECONV_CR_NEWLINE_DECORATOR) {
rb_str_cat2(mesg, pre); pre = ",";
rb_str_cat2(mesg, "CR-newline");
rb_str_cat2(mesg, "cr_newline");
}
if (ecflags & ECONV_XML_TEXT_DECORATOR) {
rb_str_cat2(mesg, pre); pre = ",";
rb_str_cat2(mesg, "XML-text");
rb_str_cat2(mesg, "xml_text");
}
if (ecflags & ECONV_XML_ATTR_CONTENT_DECORATOR) {
rb_str_cat2(mesg, pre); pre = ",";
rb_str_cat2(mesg, "XML-attr-content");
rb_str_cat2(mesg, "xml_attr_content");
}
if (ecflags & ECONV_XML_ATTR_QUOTE_DECORATOR) {
rb_str_cat2(mesg, pre); pre = ",";
rb_str_cat2(mesg, "XML-attr-quote");
rb_str_cat2(mesg, "xml_attr_quote");
}
has_description = 1;
}