@@ -637,88 +637,6 @@ class CGI
637637 | (Hash[String, untyped ] options_hash) -> void
638638 end
639639
640- # <!-- rdoc-file=lib/cgi/escape.rb -->
641- # Escape/unescape for CGI, HTML, URI.
642- #
643- module Escape
644- # <!--
645- # rdoc-file=lib/cgi/escape.rb
646- # - escape(string)
647- # -->
648- # URL-encode a string into application/x-www-form-urlencoded. Space characters
649- # (+" "+) are encoded with plus signs (+"+"+)
650- # url_encoded_string = CGI.escape("'Stop!' said Fred")
651- # # => "%27Stop%21%27+said+Fred"
652- #
653- def escape : (string str) -> String
654-
655- # <!--
656- # rdoc-file=lib/cgi/escape.rb
657- # - escapeHTML(string)
658- # -->
659- # Escape special characters in HTML, namely '&"<>
660- # CGI.escapeHTML('Usage: foo "bar" <baz>')
661- # # => "Usage: foo "bar" <baz>"
662- #
663- def escapeHTML : (string str) -> String
664-
665- # <!--
666- # rdoc-file=lib/cgi/escape.rb
667- # - escapeURIComponent(string)
668- # -->
669- # URL-encode a string following RFC 3986 Space characters (+" "+) are encoded
670- # with (+"%20"+)
671- # url_encoded_string = CGI.escapeURIComponent("'Stop!' said Fred")
672- # # => "%27Stop%21%27%20said%20Fred"
673- #
674- def escapeURIComponent : (string) -> String
675-
676- # <!--
677- # rdoc-file=lib/cgi/escape.rb
678- # - escape_uri_component(string)
679- # -->
680- #
681- alias escape_uri_component escapeURIComponent
682-
683- # <!--
684- # rdoc-file=lib/cgi/escape.rb
685- # - unescape(string, encoding = @@accept_charset)
686- # -->
687- # URL-decode an application/x-www-form-urlencoded string with
688- # encoding(optional).
689- # string = CGI.unescape("%27Stop%21%27+said+Fred")
690- # # => "'Stop!' said Fred"
691- #
692- def unescape : (string str, ?encoding encoding) -> String
693-
694- # <!--
695- # rdoc-file=lib/cgi/escape.rb
696- # - unescapeHTML(string)
697- # -->
698- # Unescape a string that has been HTML-escaped
699- # CGI.unescapeHTML("Usage: foo "bar" <baz>")
700- # # => "Usage: foo \"bar\" <baz>"
701- #
702- def unescapeHTML : (string str) -> String
703-
704- # <!--
705- # rdoc-file=lib/cgi/escape.rb
706- # - unescapeURIComponent(string, encoding = @@accept_charset)
707- # -->
708- # URL-decode a string following RFC 3986 with encoding(optional).
709- # string = CGI.unescapeURIComponent("%27Stop%21%27+said%20Fred")
710- # # => "'Stop!'+said Fred"
711- #
712- def unescapeURIComponent : (string) -> String
713-
714- # <!--
715- # rdoc-file=lib/cgi/escape.rb
716- # - unescape_uri_component(string, encoding = @@accept_charset)
717- # -->
718- #
719- alias unescape_uri_component unescapeURIComponent
720- end
721-
722640 # <!-- rdoc-file=lib/cgi/core.rb -->
723641 # Exception raised when there is an invalid encoding detected
724642 #
@@ -935,45 +853,6 @@ class CGI
935853 end
936854
937855 module Util
938- include CGI::Escape
939-
940- # <!--
941- # rdoc-file=lib/cgi/util.rb
942- # - escapeElement(string, *elements)
943- # -->
944- # Escape only the tags of certain HTML elements in `string`.
945- #
946- # Takes an element or elements or array of elements. Each element is specified
947- # by the name of the element, without angle brackets. This matches both the
948- # start and the end tag of that element. The attribute list of the open tag will
949- # also be escaped (for instance, the double-quotes surrounding attribute
950- # values).
951- #
952- # print CGI.escapeElement('<BR><A HREF="url"></A>', "A", "IMG")
953- # # "<BR><A HREF="url"></A>"
954- #
955- # print CGI.escapeElement('<BR><A HREF="url"></A>', ["A", "IMG"])
956- # # "<BR><A HREF="url"></A>"
957- #
958- def escapeElement : (string string, *String | Array[String] elements) -> String
959-
960- # <!-- rdoc-file=lib/cgi/util.rb -->
961- # Synonym for CGI.escapeElement(str)
962- #
963- alias escape_element escapeElement
964-
965- # <!-- rdoc-file=lib/cgi/util.rb -->
966- # Synonym for CGI.escapeHTML(str)
967- #
968- alias escape_html escapeHTML
969-
970- # <!--
971- # rdoc-file=lib/cgi/util.rb
972- # - h(string)
973- # -->
974- #
975- alias h escapeHTML
976-
977856 # <!--
978857 # rdoc-file=lib/cgi/util.rb
979858 # - pretty(string, shift = " ")
@@ -1008,32 +887,6 @@ class CGI
1008887 #
1009888 def rfc1123_date : (Time time) -> String
1010889
1011- # <!--
1012- # rdoc-file=lib/cgi/util.rb
1013- # - unescapeElement(string, *elements)
1014- # -->
1015- # Undo escaping such as that done by CGI.escapeElement()
1016- #
1017- # print CGI.unescapeElement(
1018- # CGI.escapeHTML('<BR><A HREF="url"></A>'), "A", "IMG")
1019- # # "<BR><A HREF="url"></A>"
1020- #
1021- # print CGI.unescapeElement(
1022- # CGI.escapeHTML('<BR><A HREF="url"></A>'), ["A", "IMG"])
1023- # # "<BR><A HREF="url"></A>"
1024- #
1025- def unescapeElement : (string string, *String | Array[String] elements) -> String
1026-
1027- # <!-- rdoc-file=lib/cgi/util.rb -->
1028- # Synonym for CGI.unescapeElement(str)
1029- #
1030- alias unescape_element unescapeElement
1031-
1032- # <!-- rdoc-file=lib/cgi/util.rb -->
1033- # Synonym for CGI.unescapeHTML(str)
1034- #
1035- alias unescape_html unescapeHTML
1036-
1037890 # Abbreviated day-of-week names specified by RFC 822
1038891 RFC822_DAYS: Array[String]
1039892
0 commit comments