mirror of https://github.com/freeCodeCamp/devdocs
Merge pull request #1549 from Cimbali/webexts
commit
df7fa0ba5e
@ -0,0 +1,9 @@
|
||||
module Docs
|
||||
class WebExtensions
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,24 @@
|
||||
module Docs
|
||||
class WebExtensions
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
TYPE_BY_PATH = {
|
||||
'manifest.json' => 'manifest.json',
|
||||
'user_interface' => 'User Interface',
|
||||
'WebRequest' => 'webRequest',
|
||||
}
|
||||
|
||||
def get_name
|
||||
at_css('h1').text
|
||||
end
|
||||
|
||||
def get_type
|
||||
slug_parts = slug.split('/')
|
||||
if slug_parts[0] == 'API' and slug_parts.length() > 1
|
||||
return TYPE_BY_PATH.fetch(slug_parts[1], slug_parts[1])
|
||||
else
|
||||
return TYPE_BY_PATH.fetch(slug_parts[0], slug_parts.length() > 1 ? slug_parts[0] : 'Miscellaneous')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,18 @@
|
||||
module Docs
|
||||
class WebExtensions < Mdn
|
||||
self.name = 'Web Extensions'
|
||||
self.slug = 'web_extensions'
|
||||
self.links = {
|
||||
home: 'https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions'
|
||||
}
|
||||
|
||||
self.base_url = 'https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions'
|
||||
|
||||
html_filters.push 'web_extensions/entries', 'web_extensions/clean_html'
|
||||
|
||||
options[:skip_patterns] = [
|
||||
/\/contributors\.txt$/
|
||||
]
|
||||
|
||||
end
|
||||
end
|
Loading…
Reference in new issue