Finish Phaser scraper

pull/229/merge
Thibaut 10 years ago
parent 5e4c30c86a
commit 6e4f56f6c2

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

@ -1,7 +1,7 @@
[
[
"2015-07-05",
"New documentations: <a href=\"/drupal/\">Drupal</a> and <a href=\"/webpack/\">webpack</a>"
"New documentations: <a href=\"/drupal/\">Drupal</a>, <a href=\"/phaser/\">Phaser</a> and <a href=\"/webpack/\">webpack</a>"
], [
"2015-05-24",
"New <a href=\"/rust/\">Rust</a> documentation"

@ -275,6 +275,11 @@ credits = [
'npm, Inc. and Contributors<br>npm is a trademark of npm, Inc.',
'npm',
'https://raw.githubusercontent.com/npm/npm/master/LICENSE'
], [
'Phaser',
'2015 Richard Davey, Photon Storm Ltd.',
'MIT',
'https://raw.githubusercontent.com/photonstorm/phaser/master/license.txt'
], [
'PHP',
'1997-2015 The PHP Documentation Group',

@ -25,6 +25,7 @@ app.views.ModernizrPage =
app.views.MomentPage =
app.views.MongoosePage =
app.views.NodePage =
app.views.PhaserPage =
app.views.RethinkdbPage =
app.views.SinonPage =
app.views.UnderscorePage =

@ -1,6 +0,0 @@
#= require views/pages/base
class app.views.PhaserPage extends app.views.BasePage
afterRender: ->
@highlightCode @findAll('pre.source'), 'javascript'
return

@ -103,3 +103,4 @@
._icon-apache_http_server:before { background-position: -9rem -7rem; }
._icon-drupal:before { background-position: 0 -8rem; }
._icon-webpack:before { background-position: -1rem -8rem; @extend %darkIconFix !optional; }
._icon-phaser:before { background-position: -2rem -8rem; }

@ -1,23 +1,10 @@
._phaser {
h2 { @extend %block-heading; }
h4 { @extend %block-label, %label-blue; }
@extend %simple;
p > code, li > code, td > code { @extend %label; }
dt.tag-source {
.type-signature, dt.tag-source {
color: #666;
font-weight: normal;
}
.deprecated-notice {
@extend %note;
}
#docs-index > h3 { @extend %block-label, %label-blue; }
#docs > h3 { @extend %block-heading; }
#docs > h4 { @extend %block-label, %label-blue; }
#docs header {
display: none;
}
.deprecated-notice { @extend %note; }
}

@ -2,22 +2,47 @@ module Docs
class Phaser
class CleanHtmlFilter < Filter
def call
title = at_css('h1')
if root_page?
doc.children = at_css('#docs-index')
@doc = at_css('#docs-index')
# Remove first paragraph (old doc details)
doc.at_css('p').remove()
at_css('p').remove
title.content = 'Phaser'
else
doc.children = at_css('#docs')
@doc = at_css('#docs')
# Remove useless markup
css('section > article').each do |node|
node.parent.replace(node.children)
end
css('dt > h4').each do |node|
dt = node.parent
dd = dt.next_element
dt.before(node).remove
dd.before(dd.children).remove
end
css('> div', '> section').each do |node|
node.before(node.children).remove
end
css('h3.subsection-title').each do |node|
node.name = 'h2'
end
css('h4.name').each do |node|
node.name = 'h3'
end
# Remove "Jump to" block
doc.at_css('table').remove()
at_css('table').remove
end
doc.child.before title
doc.child.before(title)
# Clean code blocks
css('pre > code').each do |node|

@ -1,7 +1,6 @@
module Docs
class Phaser
class EntriesFilter < Docs::EntriesFilter
REPLACE_TYPES = {
'gameobjects' => 'Game Objects',
'geom' => 'Geometry',
@ -17,8 +16,8 @@ module Docs
def get_name
name = at_css('.title-frame h1').content
name.sub! /Phaser\./, ''
name.sub! /PIXI\./, ''
name.remove!('Phaser.')
name.remove!('PIXI.')
name
end
@ -39,6 +38,22 @@ module Docs
'Global'
end
def additional_entries
entries = []
%w(members methods).each do |type|
css("##{type} h4.name").each do |node|
sig = node.at_css('.type-signature')
next if node.parent.parent.at_css('.inherited-from') || (sig && sig.content.include?('internal'))
sep = sig && sig.content.include?('static') ? '.' : '#'
name = "#{self.name}#{sep}#{node['id']}#{'()' if type == 'methods'}"
entries << [name, node['id']]
end
end
entries
end
end
end
end

@ -1,7 +1,5 @@
module Docs
class Phaser < UrlScraper
self.name = 'Phaser'
self.slug = 'phaser'
self.type = 'phaser'
self.version = '2.3.0'
self.base_url = "https://phaser.io/docs/#{version}"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 221 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 241 B

Loading…
Cancel
Save