Refactor GitHub scraper code

pull/359/merge
Thibaut Courouble 9 years ago
parent ac3aaea531
commit c5caeff917

@ -1,6 +1,9 @@
#= require views/pages/base
class app.views.GithubPage extends app.views.BasePage
LANGUAGE_RGX = /highlight-source-(\w+)/
prepare: ->
@highlightCode @findAll('pre.highlight-source-lua'), 'lua'
for el in @findAll('pre.highlight')
@highlightCode(el, el.className.match(LANGUAGE_RGX)[1])
return

@ -26,7 +26,6 @@ app.views.MomentPage =
app.views.MongoosePage =
app.views.NodePage =
app.views.PhaserPage =
app.views.QPage =
app.views.RamdaPage =
app.views.RethinkdbPage =
app.views.SinonPage =

@ -45,6 +45,7 @@
'pages/erlang',
'pages/express',
'pages/git',
'pages/github',
'pages/go',
'pages/haskell',
'pages/jquery',
@ -63,7 +64,6 @@
'pages/php',
'pages/phpunit',
'pages/postgres',
'pages/q',
'pages/ramda',
'pages/rdoc',
'pages/react',

@ -45,6 +45,7 @@
'pages/erlang',
'pages/express',
'pages/git',
'pages/github',
'pages/go',
'pages/haskell',
'pages/jquery',
@ -63,7 +64,6 @@
'pages/php',
'pages/phpunit',
'pages/postgres',
'pages/q',
'pages/ramda',
'pages/rdoc',
'pages/react',

@ -17,7 +17,6 @@
}
._cordova,
._github,
._grunt,
._less,
._lodash,

@ -0,0 +1,5 @@
._github {
@extend %simple;
h4 { @extend %block-label; }
}

@ -1,5 +0,0 @@
._q {
> h2, > h3 { @extend %block-heading; }
> h4 { @extend %block-label, %label-blue; }
code { @extend %label; }
}

@ -1,18 +0,0 @@
module Docs
class Q
class CleanHtmlFilter < Filter
def call
css('.anchor').each do |node|
node.parent['id'] = node['href'].remove('#')
node.remove
end
css('.highlight > pre').each do |node|
node.content = node.content.gsub(' ', ' ')
end
doc
end
end
end
end

@ -1,7 +1,6 @@
module Docs
class Q < UrlScraper
class Q < Github
self.name = 'Q'
self.type = 'q'
self.release = '1.4.1'
self.base_url = 'https://github.com/kriskowal/q/wiki/'
self.root_path = 'API-Reference'
@ -10,7 +9,7 @@ module Docs
code: 'https://github.com/kriskowal/q'
}
html_filters.push 'q/clean_html', 'q/entries', 'title'
html_filters.push 'q/entries', 'title'
options[:container] = '.markdown-body'
options[:title] = 'Q'

Loading…
Cancel
Save