fix tests and allow SE onebox to onebox Meta cause I need that for an post I am writing

This commit is contained in:
Sam
2013-06-12 12:23:24 +10:00
parent 74041be23b
commit 54d8c963d0
3 changed files with 25 additions and 4 deletions

View File

@@ -12,7 +12,7 @@ module Oneboxer
# http://rubular.com/r/V3T0I1VTPn
REGEX =
/^http:\/\/(?:(?<subdomain>\w*)\.)?(?<domain>#{DOMAINS.join('|')})\.com\/(?:questions|q)\/(?<question>\d*)/
/^http:\/\/(?:(?:(?<subsubdomain>\w*)\.)?(?<subdomain>\w*)\.)?(?<domain>#{DOMAINS.join('|')})\.com\/(?:questions|q)\/(?<question>\d*)/
matcher REGEX
favicon 'stackexchange.png'
@@ -20,9 +20,9 @@ module Oneboxer
def translate_url
@url.match(REGEX) do |match|
site = if match[:domain] == 'stackexchange'
match[:subdomain]
[match[:subsubdomain],match[:subdomain]].compact.join('.')
else
match[:domain]
[match[:subdomain],match[:domain]].compact.join('.')
end
["http://api.stackexchange.com/2.1/",