Top Level Namespace

Defined Under Namespace

Modules: FeedTools, HTML5, REXML, YAML Classes: BasicXhtml5Test, BasicXmlTest, HTMLConformanceChecker, HTMLInputStreamTest, Html5EncodingTestCase, Html5ParserTestCase, Html5SerializeTestcase, Html5TokenizerTestCase, JsonWalker, OpmlTest, SanitizeTest, String, TestFeedTypeSniffer, TestTreeWalkers, TestValidator, TokenizerTestParser, XhtmlTest

Constant Summary collapse

FEED_TOOLS_ENV =
ENV['FEED_TOOLS_ENV'] ||
ENV['RAILS_ENV'] ||
'development'
FEED_TOOLS_NAMESPACES =

:nodoc:

{
  "access" => "http://www.bloglines.com/about/specs/fac-1.0",
  "admin" => "http://webns.net/mvcb/",
  "ag" => "http://purl.org/rss/1.0/modules/aggregation/",
  "annotate" => "http://purl.org/rss/1.0/modules/annotate/",
  "atom10" => "http://www.w3.org/2005/Atom",
  "atom03" => "http://purl.org/atom/ns#",
  "atom-blog" => "http://purl.org/atom-blog/ns#",
  "audio" => "http://media.tangent.org/rss/1.0/",
  "bitTorrent" =>"http://www.reallysimplesyndication.com/bitTorrentRssModule",
  "blogChannel" => "http://backend.userland.com/blogChannelModule",
  "blogger" => "http://www.blogger.com/atom/ns#",
  "cc" => "http://web.resource.org/cc/",
  "creativeCommons" => "http://backend.userland.com/creativeCommonsRssModule",
  "co" => "http://purl.org/rss/1.0/modules/company",
  "content" => "http://purl.org/rss/1.0/modules/content/",
  "cp" => "http://my.theinfo.org/changed/1.0/rss/",
  "dc" => "http://purl.org/dc/elements/1.1/",
  "dcterms" => "http://purl.org/dc/terms/",
  "email" => "http://purl.org/rss/1.0/modules/email/",
  "ev" => "http://purl.org/rss/1.0/modules/event/",
  "icbm" => "http://postneo.com/icbm/",
  "image" => "http://purl.org/rss/1.0/modules/image/",
  "indexing" => "urn:atom-extension:indexing",
  "feedburner" => "http://rssnamespace.org/feedburner/ext/1.0",
  "foaf" => "http://xmlns.com/foaf/0.1/",
  "foo" => "http://hsivonen.iki.fi/FooML",
  "fm" => "http://freshmeat.net/rss/fm/",
  "gd" => "http://schemas.google.com/g/2005",
  "gr" => "http://www.google.com/schemas/reader/atom/",
  "itunes" => "http://www.itunes.com/dtds/podcast-1.0.dtd",
  "l" => "http://purl.org/rss/1.0/modules/link/",
  "media" => "http://search.yahoo.com/mrss",
  "p" => "http://purl.org/net/rss1.1/payload#",
  "pingback" => "http://madskills.com/public/xml/rss/module/pingback/",
  "prism" => "http://prismstandard.org/namespaces/1.2/basic/",
  "rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
  "rdfs" => "http://www.w3.org/2000/01/rdf-schema#",
  "ref" => "http://purl.org/rss/1.0/modules/reference/",
  "reqv" => "http://purl.org/rss/1.0/modules/richequiv/",
  "rss09" => "http://my.netscape.com/rdf/simple/0.9/",
  "rss10" => "http://purl.org/rss/1.0/",
  "rss11" => "http://purl.org/net/rss1.1#",
  "rss20" => "http://backend.userland.com/rss2",
  "search" => "http://purl.org/rss/1.0/modules/search/",
  "slash" => "http://purl.org/rss/1.0/modules/slash/",
  "soap" => "http://schemas.xmlsoap.org/soap/envelope/",
  "ss" => "http://purl.org/rss/1.0/modules/servicestatus/",
  "str" => "http://hacks.benhammersley.com/rss/streaming/",
  "sub" => "http://purl.org/rss/1.0/modules/subscription/",
  "syn" => "http://purl.org/rss/1.0/modules/syndication/",
  "taxo" => "http://purl.org/rss/1.0/modules/taxonomy/",
  "thr" => "http://purl.org/rss/1.0/modules/threading/",
  "ti" => "http://purl.org/rss/1.0/modules/textinput/",
  "trackback" => "http://madskills.com/public/xml/rss/module/trackback/",
  "wfw" => "http://wellformedweb.org/CommentAPI/",
  "wiki" => "http://purl.org/rss/1.0/modules/wiki/",
  "xhtml" => "http://www.w3.org/1999/xhtml",
  "xml" => "http://www.w3.org/XML/1998/namespace"
}
HTML5_BASE =
File.dirname(File.dirname(File.dirname(File.expand_path(__FILE__))))
TESTDATA_DIR =
File.join(File.dirname(File.dirname(File.expand_path(__FILE__))), 'testdata')
XMLELEM =
/<(\w+\s*)((?:[-:\w]+="[^"]*"\s*)+)(\/?)>/
ALLOWED_SCHEMES =
iana_schemes + ['javascript']
RFC2396 =
Regexp.new("^([a-zA-Z][0-9a-zA-Z+\\-\\.]*:)?/{0,2}[0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%,#]*$", Regexp::MULTILINE)
URN =
Regexp.new("^[Uu][Rr][Nn]:[a-zA-Z0-9][a-zA-Z0-9-]{1,31}:([a-zA-Z0-9()+,\.:=@;$_!*'\-]|%[0-9A-Fa-f]{2})+$")
TAG =
Regexp.new("^tag:([a-z0-9\\-\._]+?@)?[a-z0-9\.\-]+?,\d{4}(-\d{2}(-\d{2})?)?:[0-9a-zA-Z;/\?:@&=+$\.\-_!~*'\(\)%,]*(#[0-9a-zA-Z;/\?:@&=+$\.\-_!~*'\(\)%,]*)?$")
ISO_LANG =

borrowed from feedvalidator, original copyright license is

Copyright © 2002-2006, Sam Ruby, Mark Pilgrim, Joseph Walton, and Phil Ringnalda

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

{
   'aa' => 'Afar',
   'ab' => 'Abkhazian',
   'ae' => 'Avestan',
   'af' => 'Afrikaans',
   'ak' => 'Akan',
   'am' => 'Amharic',
   'an' => 'Aragonese',
   'ar' => 'Arabic',
   'as' => 'Assamese',
   'av' => 'Avaric',
   'ay' => 'Aymara',
   'az' => 'Azerbaijani',
   'ba' => 'Bashkir',
   'be' => 'Byelorussian',
   'bg' => 'Bulgarian',
   'bh' => 'Bihari',
   'bi' => 'Bislama',
   'bm' => 'Bambara',
   'bn' => 'Bengali;Bangla',
   'bo' => 'Tibetan',
   'br' => 'Breton',
   'bs' => 'Bosnian',
   'ca' => 'Catalan',
   'ce' => 'Chechen',
   'ch' => 'Chamorro',
   'co' => 'Corsican',
   'cr' => 'Cree',
   'cs' => 'Czech',
   'cu' => 'Church Slavic',
   'cv' => 'Chuvash',
   'cy' => 'Welsh',
   'da' => 'Danish',
   'de' => 'German',
   'dv' => 'Divehi',
   'dz' => 'Dzongkha',
   'ee' => 'Ewe',
   'el' => 'Greek',
   'en' => 'English',
   'eo' => 'Esperanto',
   'es' => 'Spanish',
   'et' => 'Estonian',
   'eu' => 'Basque',
   'fa' => 'Persian (Farsi)',
   'ff' => 'Fulah',
   'fi' => 'Finnish',
   'fj' => 'Fiji',
   'fo' => 'Faroese',
   'fr' => 'French',
   'fy' => 'Frisian, Western',
   'ga' => 'Irish',
   'gd' => 'Scots Gaelic',
   'gl' => 'Galician',
   'gn' => 'Guarani',
   'gu' => 'Gujarati',
   'gv' => 'Manx',
   'ha' => 'Hausa',
   'he' => 'Hebrew',
   'hi' => 'Hindi',
   'ho' => 'Hiri Motu',
   'hr' => 'Croatian',
   'ht' => 'Haitian',
   'hu' => 'Hungarian',
   'hy' => 'Armenian',
   'hz' => 'Herero',
   'ia' => 'Interlingua',
   'id' => 'Indonesian',
   'ie' => 'Interlingue',
   'ig' => 'Igbo',
   'ii' => 'Sichuan Yi',
   'ik' => 'Inupiak',
   'io' => 'Ido',
   'is' => 'Icelandic',
   'it' => 'Italian',
   'iu' => 'Inuktitut',
   'ja' => 'Japanese',
   'jv' => 'Javanese',
   'ka' => 'Georgian',
   'kg' => 'Kongo',
   'ki' => 'Kikuyu; Gikuyu',
   'kj' => 'Kuanyama; Kwanyama',
   'kk' => 'Kazakh',
   'kl' => 'Greenlandic',
   'km' => 'Cambodian',
   'kn' => 'Kannada',
   'ko' => 'Korean',
   'kr' => 'Kanuri',
   'ks' => 'Kashmiri',
   'ku' => 'Kurdish',
   'kv' => 'Komi',
   'kw' => 'Cornish',
   'ky' => 'Kirghiz',
   'la' => 'Latin',
   'lb' => 'Letzeburgesch; Luxembourgish',
   'lg' => 'Ganda',
   'li' => 'Limburgan; Limburger, Limburgish',
   'ln' => 'Lingala',
   'lo' => 'Lao',
   'lt' => 'Lithuanian',
   'lu' => 'Luba-Katanga',
   'lv' => 'Latvian',
   'mg' => 'Malagasy',
   'mh' => 'Marshallese',
   'mi' => 'Maori',
   'mk' => 'Macedonian',
   'ml' => 'Malayalam',
   'mn' => 'Mongolian',
   'mo' => 'Moldavian',
   'mr' => 'Marathi',
   'ms' => 'Malay',
   'mt' => 'Maltese',
   'my' => 'Burmese',
   'na' => 'Nauru',
   'nb' => 'Norwegian Bokmal',
   'nd' => 'Ndebele, North',
   'ne' => 'Nepali',
   'ng' => 'Ndonga',
   'nl' => 'Dutch',
   'nn' => 'Norwegian Nynorsk',
   'no' => 'Norwegian',
   'nr' => 'Ndebele, South',
   'nv' => 'Navaho; Navajo',
   'ny' => 'Chewa; Chichewa; Nyanha',
   'oc' => 'Occitan',
   'oj' => 'Ojibwa',
   'om' => 'Afan (Oromo)',
   'or' => 'Oriya',
   'os' => 'Ossetian; Ossetic',
   'pa' => 'Punjabi',
   'pi' => 'Pali',
   'pl' => 'Polish',
   'ps' => 'Pushto',
   'pt' => 'Portuguese',
   'qu' => 'Quechua',
   'rm' => 'Rhaeto-Romance',
   'rn' => 'Kurundi',
   'ro' => 'Romanian',
   'ru' => 'Russian',
   'rw' => 'Kinyarwanda',
   'sa' => 'Sanskrit',
   'sc' => 'Sardinian',
   'sd' => 'Sindhi',
   'se' => 'Northern Sami',
   'sg' => 'Sangho',
   'sh' => 'Serbo-Croatian',
   'si' => 'Singhalese',
   'sk' => 'Slovak',
   'sl' => 'Slovenian',
   'sm' => 'Samoan',
   'sn' => 'Shona',
   'so' => 'Somali',
   'sq' => 'Albanian',
   'sr' => 'Serbian',
   'ss' => 'Swati',
   'st' => 'Sotho, Southern',
   'su' => 'Sundanese',
   'sv' => 'Swedish',
   'sw' => 'Swahili',
   'ta' => 'Tamil',
   'te' => 'Telugu',
   'tg' => 'Tajik',
   'th' => 'Thai',
   'ti' => 'Tigrinya',
   'tk' => 'Turkmen',
   'tl' => 'Tagalog',
   'tn' => 'Tswana',
   'to' => 'Tonga',
   'tr' => 'Turkish',
   'ts' => 'Tsonga',
   'tt' => 'Tatar',
   'tw' => 'Twi',
   'ty' => 'Tahitian',
   'ug' => 'Uigur',
   'uk' => 'Ukrainian',
   'ur' => 'Urdu',
   'uz' => 'Uzbek',
   've' => 'Venda',
   'vi' => 'Vietnamese',
   'vo' => 'Volapuk',
   'wa' => 'Walloon',
   'wo' => 'Wolof',
   'xh' => 'Xhosa',
   'yi' => 'Yiddish',
   'yo' => 'Yoruba',
   'za' => 'Zhuang',
   'zh' => 'Chinese',
   'zu' => 'Zulu',
   'x'  => 'a user-defined language',
   'xx' => 'a user-defined language',
   
   'abk' => 'Abkhazian',
   'ace' => 'Achinese',
   'ach' => 'Acoli',
   'ada' => 'Adangme',
   'ady' => 'Adygei',
   'ady' => 'Adyghe',
   'aar' => 'Afar',
   'afh' => 'Afrihili',
   'afr' => 'Afrikaans',
   'afa' => 'Afro-Asiatic (Other)',
   'ain' => 'Ainu',
   'aka' => 'Akan',
   'akk' => 'Akkadian',
   'alb' => 'Albanian',
   'sqi' => 'Albanian',
   'gws' => 'Alemanic',
   'ale' => 'Aleut',
   'alg' => 'Algonquian languages',
   'tut' => 'Altaic (Other)',
   'amh' => 'Amharic',
   'anp' => 'Angika',
   'apa' => 'Apache languages',
   'ara' => 'Arabic',
   'arg' => 'Aragonese',
   'arc' => 'Aramaic',
   'arp' => 'Arapaho',
   'arn' => 'Araucanian',
   'arw' => 'Arawak',
   'arm' => 'Armenian',
   'hye' => 'Armenian',
   'rup' => 'Aromanian',
   'art' => 'Artificial (Other)',
   'asm' => 'Assamese',
   'ast' => 'Asturian',
   'ath' => 'Athapascan languages',
   'aus' => 'Australian languages',
   'map' => 'Austronesian (Other)',
   'ava' => 'Avaric',
   'ave' => 'Avestan',
   'awa' => 'Awadhi',
   'aym' => 'Aymara',
   'aze' => 'Azerbaijani',
   'ast' => 'Bable',
   'ban' => 'Balinese',
   'bat' => 'Baltic (Other)',
   'bal' => 'Baluchi',
   'bam' => 'Bambara',
   'bai' => 'Bamileke languages',
   'bad' => 'Banda',
   'bnt' => 'Bantu (Other)',
   'bas' => 'Basa',
   'bak' => 'Bashkir',
   'baq' => 'Basque',
   'eus' => 'Basque',
   'btk' => 'Batak (Indonesia)',
   'bej' => 'Beja',
   'bel' => 'Belarusian',
   'bem' => 'Bemba',
   'ben' => 'Bengali',
   'ber' => 'Berber (Other)',
   'bho' => 'Bhojpuri',
   'bih' => 'Bihari',
   'bik' => 'Bikol',
   'byn' => 'Bilin',
   'bin' => 'Bini',
   'bis' => 'Bislama',
   'byn' => 'Blin',
   'nob' => 'Bokmal, Norwegian',
   'bos' => 'Bosnian',
   'bra' => 'Braj',
   'bre' => 'Breton',
   'bug' => 'Buginese',
   'bul' => 'Bulgarian',
   'bua' => 'Buriat',
   'bur' => 'Burmese',
   'mya' => 'Burmese',
   'cad' => 'Caddo',
   'car' => 'Carib',
   'spa' => 'Castilian',
   'cat' => 'Catalan',
   'cau' => 'Caucasian (Other)',
   'ceb' => 'Cebuano',
   'cel' => 'Celtic (Other)',
   'cai' => 'Central American Indian (Other)',
   'chg' => 'Chagatai',
   'cmc' => 'Chamic languages',
   'cha' => 'Chamorro',
   'che' => 'Chechen',
   'chr' => 'Cherokee',
   'nya' => 'Chewa',
   'chy' => 'Cheyenne',
   'chb' => 'Chibcha',
   'nya' => 'Chichewa',
   'chi' => 'Chinese',
   'zho' => 'Chinese',
   'chn' => 'Chinook jargon',
   'chp' => 'Chipewyan',
   'cho' => 'Choctaw',
   'zha' => 'Chuang',
   'chu' => 'Church Slavic; Church Slavonic; Old Church Slavonic; Old Church Slavic; Old Bulgarian',
   'chk' => 'Chuukese',
   'chv' => 'Chuvash',
   'nwc' => 'Classical Nepal Bhasa; Classical Newari; Old Newari',
   'cop' => 'Coptic',
   'cor' => 'Cornish',
   'cos' => 'Corsican',
   'cre' => 'Cree',
   'mus' => 'Creek',
   'crp' => 'Creoles and pidgins(Other)',
   'cpe' => 'Creoles and pidgins, English-based (Other)',
   'cpf' => 'Creoles and pidgins, French-based (Other)',
   'cpp' => 'Creoles and pidgins, Portuguese-based (Other)',
   'crh' => 'Crimean Tatar; Crimean Turkish',
   'scr' => 'Croatian',
   'hrv' => 'Croatian',
   'cus' => 'Cushitic (Other)',
   'cze' => 'Czech',
   'ces' => 'Czech',
   'dak' => 'Dakota',
   'dan' => 'Danish',
   'dar' => 'Dargwa',
   'day' => 'Dayak',
   'del' => 'Delaware',
   'din' => 'Dinka',
   'div' => 'Divehi',
   'doi' => 'Dogri',
   'dgr' => 'Dogrib',
   'dra' => 'Dravidian (Other)',
   'dua' => 'Duala',
   'dut' => 'Dutch',
   'nld' => 'Dutch',
   'dum' => 'Dutch, Middle (ca. 1050-1350)',
   'dyu' => 'Dyula',
   'dzo' => 'Dzongkha',
   'efi' => 'Efik',
   'egy' => 'Egyptian (Ancient)',
   'eka' => 'Ekajuk',
   'elx' => 'Elamite',
   'eng' => 'English',
   'enm' => 'English, Middle (1100-1500)',
   'ang' => 'English, Old (ca.450-1100)',
   'myv' => 'Erzya',
   'epo' => 'Esperanto',
   'est' => 'Estonian',
   'ewe' => 'Ewe',
   'ewo' => 'Ewondo',
   'fan' => 'Fang',
   'fat' => 'Fanti',
   'fao' => 'Faroese',
   'fij' => 'Fijian',
   'fil' => 'Filipino; Pilipino',
   'fin' => 'Finnish',
   'fiu' => 'Finno-Ugrian (Other)',
   'fon' => 'Fon',
   'fre' => 'French',
   'fra' => 'French',
   'frm' => 'French, Middle (ca.1400-1600)',
   'fro' => 'French, Old (842-ca.1400)',
   'frs' => 'Frisian, Eastern',
   'fry' => 'Frisian, Western',
   'fur' => 'Friulian',
   'ful' => 'Fulah',
   'gaa' => 'Ga',
   'gla' => 'Gaelic',
   'glg' => 'Gallegan',
   'lug' => 'Ganda',
   'gay' => 'Gayo',
   'gba' => 'Gbaya',
   'gez' => 'Geez',
   'geo' => 'Georgian',
   'kat' => 'Georgian',
   'ger' => 'German',
   'deu' => 'German',
   'nds' => 'German, Low',
   'gmh' => 'German, Middle High (ca.1050-1500)',
   'goh' => 'German, Old High (ca.750-1050)',
   'gem' => 'Germanic (Other)',
   'kik' => 'Gikuyu',
   'gil' => 'Gilbertese',
   'gon' => 'Gondi',
   'gor' => 'Gorontalo',
   'got' => 'Gothic',
   'grb' => 'Grebo',
   'grc' => 'Greek, Ancient (to 1453)',
   'gre' => 'Greek, Modern (1453-)',
   'ell' => 'Greek, Modern (1453-)',
   'kal' => 'Greenlandic; Kalaallisut',
   'grn' => 'Guarani',
   'guj' => 'Gujarati',
   'gwi' => 'Gwich\'in',
   'hai' => 'Haida',
   'hat' => 'Haitian',
   'hau' => 'Hausa',
   'haw' => 'Hawaiian',
   'heb' => 'Hebrew',
   'her' => 'Herero',
   'hil' => 'Hiligaynon',
   'him' => 'Himachali',
   'hin' => 'Hindi',
   'hmo' => 'Hiri Motu',
   'hit' => 'Hittite',
   'hmn' => 'Hmong',
   'hun' => 'Hungarian',
   'hup' => 'Hupa',
   'iba' => 'Iban',
   'ice' => 'Icelandic',
   'isl' => 'Icelandic',
   'ido' => 'Ido',
   'ibo' => 'Igbo',
   'ijo' => 'Ijo',
   'ilo' => 'Iloko',
   'smn' => 'Inari Sami',
   'inc' => 'Indic (Other)',
   'ine' => 'Indo-European (Other)',
   'ind' => 'Indonesian',
   'inh' => 'Ingush',
   'ina' => 'Interlingua (International Auxiliary Language Association)',
   'ile' => 'Interlingue',
   'iku' => 'Inuktitut',
   'ipk' => 'Inupiaq',
   'ira' => 'Iranian (Other)',
   'gle' => 'Irish',
   'mga' => 'Irish, Middle (900-1200)',
   'sga' => 'Irish, Old (to 900)',
   'iro' => 'Iroquoian languages',
   'ita' => 'Italian',
   'jpn' => 'Japanese',
   'jav' => 'Javanese',
   'jrb' => 'Judeo-Arabic',
   'jpr' => 'Judeo-Persian',
   'kbd' => 'Kabardian',
   'kab' => 'Kabyle',
   'kac' => 'Kachin',
   'kal' => 'Kalaallisut',
   'xal' => 'Kalmyk',
   'kam' => 'Kamba',
   'kan' => 'Kannada',
   'kau' => 'Kanuri',
   'krc' => 'Karachay-Balkar',
   'kaa' => 'Kara-Kalpak',
   'krl' => 'Karelian',
   'kar' => 'Karen',
   'kas' => 'Kashmiri',
   'csb' => 'Kashubian',
   'kaw' => 'Kawi',
   'kaz' => 'Kazakh',
   'kha' => 'Khasi',
   'khm' => 'Khmer',
   'khi' => 'Khoisan (Other)',
   'kho' => 'Khotanese',
   'kik' => 'Kikuyu',
   'kmb' => 'Kimbundu',
   'kin' => 'Kinyarwanda',
   'kir' => 'Kirghiz',
   'tlh' => 'Klingon; tlhIngan-Hol',
   'kom' => 'Komi',
   'kon' => 'Kongo',
   'kok' => 'Konkani',
   'kor' => 'Korean',
   'kos' => 'Kosraean',
   'kpe' => 'Kpelle',
   'kro' => 'Kru',
   'kua' => 'Kuanyama',
   'kum' => 'Kumyk',
   'kur' => 'Kurdish',
   'kru' => 'Kurukh',
   'kut' => 'Kutenai',
   'kua' => 'Kwanyama',
   'lad' => 'Ladino',
   'lah' => 'Lahnda',
   'lam' => 'Lamba',
   'lao' => 'Lao',
   'lat' => 'Latin',
   'lav' => 'Latvian',
   'ltz' => 'Letzeburgesch',
   'lez' => 'Lezghian',
   'lim' => 'Limburgan',
   'lin' => 'Lingala',
   'lit' => 'Lithuanian',
   'jbo' => 'Lojban',
   'nds' => 'Low German',
   'dsb' => 'Lower Sorbian',
   'loz' => 'Lozi',
   'lub' => 'Luba-Katanga',
   'lua' => 'Luba-Lulua',
   'lui' => 'Luiseno',
   'smj' => 'Lule Sami',
   'lun' => 'Lunda',
   'luo' => 'Luo (Kenya and Tanzania)',
   'lus' => 'Lushai',
   'ltz' => 'Luxembourgish',
   'mac' => 'Macedonian',
   'mkd' => 'Macedonian',
   'mad' => 'Madurese',
   'mag' => 'Magahi',
   'mai' => 'Maithili',
   'mak' => 'Makasar',
   'mlg' => 'Malagasy',
   'may' => 'Malay',
   'msa' => 'Malay',
   'mal' => 'Malayalam',
   'mlt' => 'Maltese',
   'mnc' => 'Manchu',
   'mdr' => 'Mandar',
   'man' => 'Mandingo',
   'mni' => 'Manipuri',
   'mno' => 'Manobo languages',
   'glv' => 'Manx',
   'mao' => 'Maori',
   'mri' => 'Maori',
   'mar' => 'Marathi',
   'chm' => 'Mari',
   'mah' => 'Marshallese',
   'mwr' => 'Marwari',
   'mas' => 'Masai',
   'myn' => 'Mayan languages',
   'men' => 'Mende',
   'mic' => 'Micmac',
   'min' => 'Minangkabau',
   'mwl' => 'Mirandese',
   'mis' => 'Miscellaneous languages',
   'moh' => 'Mohawk',
   'mdf' => 'Moksha',
   'mol' => 'Moldavian',
   'mkh' => 'Mon-Khmer (Other)',
   'lol' => 'Mongo',
   'mon' => 'Mongolian',
   'mos' => 'Mossi',
   'mul' => 'Multiple languages',
   'mun' => 'Munda languages',
   'nah' => 'Nahuatl',
   'nau' => 'Nauru',
   'nav' => 'Navaho; Navajo',
   'nde' => 'Ndebele, North',
   'nbl' => 'Ndebele, South',
   'ndo' => 'Ndonga',
   'nap' => 'Neapolitan',
   'nep' => 'Nepali',
   'new' => 'Newari',
   'nia' => 'Nias',
   'nic' => 'Niger-Kordofanian (Other)',
   'ssa' => 'Nilo-Saharan (Other)',
   'niu' => 'Niuean',
   'nog' => 'Nogai',
   'non' => 'Norse, Old',
   'nai' => 'North American Indian (Other)',
   'frr' => 'Northern Frisian',
   'sme' => 'Northern Sami',
   'nso' => 'Northern Sotho; Pedi; Sepedi',
   'nde' => 'North Ndebele',
   'nor' => 'Norwegian',
   'nob' => 'Norwegian Bokmal',
   'nno' => 'Norwegian Nynorsk',
   'nub' => 'Nubian languages',
   'nym' => 'Nyamwezi',
   'nya' => 'Nyanja',
   'nyn' => 'Nyankole',
   'nno' => 'Nynorsk, Norwegian',
   'nyo' => 'Nyoro',
   'nzi' => 'Nzima',
   'oci' => 'Occitan (post 1500)',
   'oji' => 'Ojibwa',
   'ori' => 'Oriya',
   'orm' => 'Oromo',
   'osa' => 'Osage',
   'oss' => 'Ossetian; Ossetic',
   'oto' => 'Otomian languages',
   'pal' => 'Pahlavi',
   'pau' => 'Palauan',
   'pli' => 'Pali',
   'pam' => 'Pampanga',
   'pag' => 'Pangasinan',
   'pan' => 'Panjabi',
   'pap' => 'Papiamento',
   'paa' => 'Papuan (Other)',
   'per' => 'Persian',
   'fas' => 'Persian',
   'peo' => 'Persian, Old (ca.600-400)',
   'phi' => 'Philippine (Other)',
   'phn' => 'Phoenician',
   'pon' => 'Pohnpeian',
   'pol' => 'Polish',
   'por' => 'Portuguese',
   'pra' => 'Prakrit languages',
   'oci' => 'Provencal',
   'pro' => 'Provencal, Old (to 1500)',
   'pan' => 'Punjabi',
   'pus' => 'Pushto',
   'que' => 'Quechua',
   'roh' => 'Raeto-Romance',
   'raj' => 'Rajasthani',
   'rap' => 'Rapanui',
   'rar' => 'Rarotongan',
   'qaa' => 'Reserved for local use',
   'qtz' => 'Reserved for local use',
   'roa' => 'Romance (Other)',
   'rum' => 'Romanian',
   'ron' => 'Romanian',
   'rom' => 'Romany',
   'run' => 'Rundi',
   'rus' => 'Russian',
   'sal' => 'Salishan languages',
   'sam' => 'Samaritan Aramaic',
   'smi' => 'Sami languages (Other)',
   'smo' => 'Samoan',
   'sad' => 'Sandawe',
   'sag' => 'Sango',
   'san' => 'Sanskrit',
   'sat' => 'Santali',
   'srd' => 'Sardinian',
   'sas' => 'Sasak',
   'nds' => 'Saxon, Low',
   'sco' => 'Scots',
   'gla' => 'Scottish Gaelic',
   'sel' => 'Selkup',
   'sem' => 'Semitic (Other)',
   'nso' => 'Sepedi; Northern Sotho; Pedi',
   'scc' => 'Serbian',
   'srp' => 'Serbian',
   'srr' => 'Serer',
   'shn' => 'Shan',
   'sna' => 'Shona',
   'iii' => 'Sichuan Yi',
   'scn' => 'Sicilian',
   'sid' => 'Sidamo',
   'sgn' => 'Sign languages',
   'bla' => 'Siksika',
   'snd' => 'Sindhi',
   'sin' => 'Sinhalese',
   'sit' => 'Sino-Tibetan (Other)',
   'sio' => 'Siouan languages',
   'sms' => 'Skolt Sami',
   'den' => 'Slave (Athapascan)',
   'sla' => 'Slavic (Other)',
   'slo' => 'Slovak',
   'slk' => 'Slovak',
   'slv' => 'Slovenian',
   'sog' => 'Sogdian',
   'som' => 'Somali',
   'son' => 'Songhai',
   'snk' => 'Soninke',
   'wen' => 'Sorbian languages',
   'nso' => 'Sotho, Northern',
   'sot' => 'Sotho, Southern',
   'sai' => 'South American Indian (Other)',
   'alt' => 'Southern Altai',
   'sma' => 'Southern Sami',
   'nbl' => 'South Ndebele',
   'spa' => 'Spanish',
   'srn' => 'Sranan Tongo',
   'suk' => 'Sukuma',
   'sux' => 'Sumerian',
   'sun' => 'Sundanese',
   'sus' => 'Susu',
   'swa' => 'Swahili',
   'ssw' => 'Swati',
   'swe' => 'Swedish',
   'gsw' => 'Swiss German; Alemanic',
   'syr' => 'Syriac',
   'tgl' => 'Tagalog',
   'tah' => 'Tahitian',
   'tai' => 'Tai (Other)',
   'tgk' => 'Tajik',
   'tmh' => 'Tamashek',
   'tam' => 'Tamil',
   'tat' => 'Tatar',
   'tel' => 'Telugu',
   'ter' => 'Tereno',
   'tet' => 'Tetum',
   'tha' => 'Thai',
   'tib' => 'Tibetan',
   'bod' => 'Tibetan',
   'tig' => 'Tigre',
   'tir' => 'Tigrinya',
   'tem' => 'Timne',
   'tiv' => 'Tiv',
   'tlh' => 'tlhIngan-Hol; Klingon',
   'tli' => 'Tlingit',
   'tpi' => 'Tok Pisin',
   'tkl' => 'Tokelau',
   'tog' => 'Tonga (Nyasa)',
   'ton' => 'Tonga (Tonga Islands)',
   'tsi' => 'Tsimshian',
   'tso' => 'Tsonga',
   'tsn' => 'Tswana',
   'tum' => 'Tumbuka',
   'tup' => 'Tupi languages',
   'tur' => 'Turkish',
   'ota' => 'Turkish, Ottoman (1500-1928)',
   'tuk' => 'Turkmen',
   'tvl' => 'Tuvalu',
   'tyv' => 'Tuvinian',
   'twi' => 'Twi',
   'udm' => 'Udmurt',
   'uga' => 'Ugaritic',
   'uig' => 'Uighur',
   'ukr' => 'Ukrainian',
   'umb' => 'Umbundu',
   'und' => 'Undetermined',
   'hsb' => 'Upper Sorbian',
   'urd' => 'Urdu',
   'uzb' => 'Uzbek',
   'vai' => 'Vai',
   'cat' => 'Valencian',
   'ven' => 'Venda',
   'vie' => 'Vietnamese',
   'vol' => 'Volapuk',
   'vot' => 'Votic',
   'wak' => 'Wakashan languages',
   'wal' => 'Walamo',
   'wln' => 'Walloon',
   'war' => 'Waray',
   'was' => 'Washo',
   'wel' => 'Welsh',
   'cym' => 'Welsh',
   'fry' => 'Wester Frisian',
   'wol' => 'Wolof',
   'xho' => 'Xhosa',
   'sah' => 'Yakut',
   'yao' => 'Yao',
   'yap' => 'Yapese',
   'yid' => 'Yiddish',
   'yor' => 'Yoruba',
   'ypk' => 'Yupik languages',
   'znd' => 'Zande',
   'zap' => 'Zapotec',
   'zen' => 'Zenaga',
   'zha' => 'Zhuang',
   'zul' => 'Zulu',
   'zun' => 'Zuni'
}

Instance Method Summary collapse

Instance Method Details

#_(str) ⇒ Object



20
# File 'lib/feed_tools/vendor/html5/lib/html5/filters/validator.rb', line 20

def _(str); str; end

#assert_xhtml_equal(input, expected = nil, parser = HTML5::XHTMLParser) ⇒ Object



20
21
22
# File 'lib/feed_tools/vendor/html5/tests/test_lxp.rb', line 20

def assert_xhtml_equal(input, expected=nil, parser=HTML5::XHTMLParser)
  assert_xml_equal(input, expected, parser)
end

#assert_xml_equal(input, expected = nil, parser = HTML5::XMLParser) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/feed_tools/vendor/html5/tests/test_lxp.rb', line 7

def assert_xml_equal(input, expected=nil, parser=HTML5::XMLParser)
  sortattrs = proc {"<#{$1+$2.split.sort.join(' ')+$3}>"}
  document = parser.parse(input.chomp, :lowercase_attr_name => false, :lowercase_element_name => false).root
  if not expected
    expected = input.chomp.gsub(XMLELEM,&sortattrs)
    expected = expected.gsub(/&#(\d+);/) {[$1.to_i].pack('U')}
    output = document.to_s.gsub(/'/,'"').gsub(XMLELEM,&sortattrs)
    assert_equal(expected, output)
  else
    assert_equal(expected, document.to_s.gsub(/'/,'"'))
  end
end

#html5_test_files(subdirectory) ⇒ Object



17
18
19
# File 'lib/feed_tools/vendor/html5/tests/preamble.rb', line 17

def html5_test_files(subdirectory)
  Dir[File.join(TESTDATA_DIR, subdirectory, '*.*')]
end

#is_valid_fully_qualified_uri(value) ⇒ Object



87
88
89
# File 'lib/feed_tools/vendor/html5/lib/html5/filters/rfc3987.rb', line 87

def is_valid_fully_qualified_uri(value)
  is_valid_uri(value, rfc2396_full)
end

#is_valid_iri(value) ⇒ Object



77
78
79
80
81
82
83
84
85
# File 'lib/feed_tools/vendor/html5/lib/html5/filters/rfc3987.rb', line 77

def is_valid_iri(value)
  begin
    if value.length > 0
      value = value.encode('idna')
    end
  rescue
  end
  is_valid_uri(value)
end

#is_valid_lang_code(value) ⇒ Object



745
746
747
748
749
750
751
752
# File 'lib/feed_tools/vendor/html5/lib/html5/filters/iso639codes.rb', line 745

def is_valid_lang_code(value)
  if value.include? '-'
    lang, sublang = value.split('-', 2)
  else
    lang = value
  end
  !!ISO_LANG[lang.downcase]
end

#is_valid_mime_type(value) ⇒ Object

mime_re = Regexp.new(‘[^s()<>,;:\“/?=]+/[^s()<>,;:\“/?=]+(s*;s*[^s()<>,;:\“/?=]+=(”(\“|[^”])*“|[^s()<>,;:\“/?=]+))*$’)



26
27
28
29
# File 'lib/feed_tools/vendor/html5/lib/html5/filters/rfc2046.rb', line 26

def is_valid_mime_type(value)
  # !!mime_re.match(value)
  true
end

#is_valid_uri(value, uri_pattern = RFC2396) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/feed_tools/vendor/html5/lib/html5/filters/rfc3987.rb', line 39

def is_valid_uri(value, uri_pattern = RFC2396)
  scheme = value.split(':').first
  scheme.downcase! if scheme
  if scheme == 'tag'
    if !TAG.match(value)
      return false, "invalid-tag-uri"
    end
  elsif scheme == "urn"
    if !URN.match(value)
      return false, "invalid-urn"
    end
  elsif uri_pattern.match(value).to_a.reject{|i| i == ''}.compact.length == 0 || uri_pattern.match(value)[0] != value
    urichars = Regexp.new("^[0-9a-zA-Z;/?:@&=+$\\.\\-_!~*'()%,#]$", Regexp::MULTILINE)
    if value.length > 0
      value.each_byte do |b|
        if b < 128 and !urichars.match([b].pack('c*'))
          return false, "invalid-uri-char"
        end
      end
    else
      begin
        if uri_pattern.match(value.encode('idna'))
          return false, "uri-not-iri"
        end
      rescue
      end
      return false, "invalid-uri"
    end
  elsif ['http','ftp'].include?(scheme)
    if !value.match(%r{^\w+://[^/].*})
      return false, "invalid-http-or-ftp-uri"
    end
  elsif value.index(':') && scheme.match(/^[a-z]+$/) && !ALLOWED_SCHEMES.include?(scheme)
    return false, "invalid-scheme"
  end
  return true, ""
end