Improve TensorFlow scraper

pull/393/merge
Thibaut Courouble 9 years ago
parent 51e1b3f7e8
commit 1b06b299d3

@ -12,6 +12,7 @@ app.views.MeteorPage =
app.views.RamdaPage = app.views.RamdaPage =
app.views.ReactPage = app.views.ReactPage =
app.views.RethinkdbPage = app.views.RethinkdbPage =
app.views.TensorflowPage =
app.views.TypescriptPage = app.views.TypescriptPage =
app.views.UnderscorePage = app.views.UnderscorePage =
app.views.SimplePage app.views.SimplePage

@ -1,7 +0,0 @@
#= require views/pages/base
class app.views.TensorflowPage extends app.views.BasePage
prepare: ->
@highlightCode @findAll('pre[class*="lang-c++"]'), 'cpp'
@highlightCode @findAll('pre.lang-python'), 'python'
return

@ -9,6 +9,16 @@ module Docs
node.parent.content = node.content node.parent.content = node.content
end end
css('pre').each do |node|
node.inner_html = node.inner_html.strip_heredoc
if node['class'].include?('lang-c++')
node['data-language'] = 'cpp'
elsif node['class'].include?('lang-python')
node['data-language'] = 'python'
end
end
css('b').each do |node| css('b').each do |node|
node.before(node.children).remove node.before(node.children).remove
end end

Loading…
Cancel
Save