Top Level Namespace
Defined Under Namespace
Modules: XRDSUtil, XRI Classes: Discovery, HTMLComment, HTMLTag, HTMLText, HTMLToken, HTMLTokenizer, NetHTTPFetcher, ServiceEndpoint, TC_TestHTMLTokenizer, XRDS, YADIS, YADISHTTPError, YADISParseError, YadisServiceManager
Constant Summary collapse
- XRI_AUTHORITIES =
The ‘(’ is for cross-reference authorities, and hopefully has a matching ‘)’ somewhere.
["!", "=", "@", "+", "$", "("]
Instance Method Summary collapse
Instance Method Details
#html_yadis_location(html) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/yadis/parsehtml.rb', line 3 def html_yadis_location(html) parser = HTMLTokenizer.new(html) # to keep track of whether or not we are in the head element in_head = false begin while el = parser.getTag('head', '/head', 'meta', 'body') # we are leaving head or have reached body, so we bail return nil if ['/head', 'body'].member?(el.tag_name) # meta needs to be in head, so we mark it in_head = true if el.tag_name == 'head' continue unless in_head if el.tag_name == 'meta' and (equiv = el.attr_hash['http-equiv']) if ['x-xrds-location','x-yadis-location'].member?(equiv.downcase) return el.attr_hash['content'] end end end rescue return nil end end |