History

Add Phaser documentation

Jérémie Ledentu committed 11 years ago

Commit 5e4c30c1 parent f0cb4b610 files · +135 −-2Browse files

Unified · Split

10 files
  1. assets/javascripts/views/pages/phaser.coffee +6 −0
  2. assets/stylesheets/application-dark.css.scss +1 −0
  3. assets/stylesheets/application.css.scss +1 −0
  4. assets/stylesheets/pages/_phaser.scss +23 −0
  5. lib/docs/filters/phaser/clean_html.rb +31 −0
  6. lib/docs/filters/phaser/entries.rb +44 −0
  7. lib/docs/scrapers/phaser.rb +30 −0
  8. public/icons/docs/phaser/16.png +0 −0
  9. public/icons/docs/phaser/16@2x.png +0 −0
  10. public/icons/docs/phaser/SOURCE +1 −0
assets/javascripts/views/pages/phaser.coffee+6−0
@@ -0,0 +1,6 @@
1#= require views/pages/base
2
3class app.views.PhaserPage extends app.views.BasePage
4 afterRender: ->
5 @highlightCode @findAll('pre.source'), 'javascript'
6 return
assets/stylesheets/application-dark.css.scss+1−0
@@ -54,6 +54,7 @@ · 53 unmodified lines
54 'pages/nginx',54 'pages/nginx',
55 'pages/node',55 'pages/node',
56 'pages/npm',56 'pages/npm',
57 'pages/phaser',
57 'pages/php',58 'pages/php',
58 'pages/phpunit',59 'pages/phpunit',
59 'pages/postgres',60 'pages/postgres',
assets/stylesheets/application.css.scss+1−0
@@ -54,6 +54,7 @@ · 53 unmodified lines
54 'pages/nginx',54 'pages/nginx',
55 'pages/node',55 'pages/node',
56 'pages/npm',56 'pages/npm',
57 'pages/phaser',
57 'pages/php',58 'pages/php',
58 'pages/phpunit',59 'pages/phpunit',
59 'pages/postgres',60 'pages/postgres',
assets/stylesheets/pages/_phaser.scss+23−0
@@ -0,0 +1,23 @@
1._phaser {
2 h2 { @extend %block-heading; }
3 h4 { @extend %block-label, %label-blue; }
4
5 p > code, li > code, td > code { @extend %label; }
6
7 dt.tag-source {
8 color: #666;
9 font-weight: normal;
10 }
11
12 .deprecated-notice {
13 @extend %note;
14 }
15
16 #docs-index > h3 { @extend %block-label, %label-blue; }
17 #docs > h3 { @extend %block-heading; }
18 #docs > h4 { @extend %block-label, %label-blue; }
19
20 #docs header {
21 display: none;
22 }
23}
lib/docs/filters/phaser/clean_html.rb+31−0
@@ -0,0 +1,31 @@
1module Docs
2 class Phaser
3 class CleanHtmlFilter < Filter
4 def call
5
6 title = at_css('h1')
7
8 if root_page?
9 doc.children = at_css('#docs-index')
10
11 # Remove first paragraph (old doc details)
12 doc.at_css('p').remove()
13 else
14 doc.children = at_css('#docs')
15
16 # Remove "Jump to" block
17 doc.at_css('table').remove()
18 end
19
20 doc.child.before title
21
22 # Clean code blocks
23 css('pre > code').each do |node|
24 node.before(node.children).remove
25 end
26
27 doc
28 end
29 end
30 end
31end
lib/docs/filters/phaser/entries.rb+44−0
@@ -0,0 +1,44 @@
1module Docs
2 class Phaser
3 class EntriesFilter < Docs::EntriesFilter
4
5 REPLACE_TYPES = {
6 'gameobjects' => 'Game Objects',
7 'geom' => 'Geometry',
8 'tilemap' => 'Tilemaps',
9 'net' => 'Network',
10 'tween' => 'Tweens',
11 'pixi' => 'PIXI'
12 }
13
14 TYPE_GROUPS = {
15 'Core' => ['loader']
16 }
17
18 def get_name
19 name = at_css('.title-frame h1').content
20 name.sub! /Phaser\./, ''
21 name.sub! /PIXI\./, ''
22 name
23 end
24
25 def get_type
26 src = at_css('.container-overview .details > .tag-source > a')
27
28 if src
29 src = src.content.split('/').first
30
31 TYPE_GROUPS.each_pair do |replacement, types|
32 types.each do |t|
33 return replacement if src == t
34 end
35 end
36
37 return REPLACE_TYPES[src] || src.capitalize
38 end
39
40 'Global'
41 end
42 end
43 end
44end
lib/docs/scrapers/phaser.rb+30−0
@@ -0,0 +1,30 @@
1module Docs
2 class Phaser < UrlScraper
3 self.name = 'Phaser'
4 self.slug = 'phaser'
5 self.type = 'phaser'
6 self.version = '2.3.0'
7 self.base_url = "https://phaser.io/docs/#{version}"
8 self.links = {
9 home: 'https://phaser.io/',
10 code: 'https://github.com/photonstorm/phaser'
11 }
12
13 html_filters.push 'phaser/entries', 'phaser/clean_html'
14
15 options[:skip] = %w(
16 /docs_pixi-jsdoc.js.html
17 /p2.Body.html
18 /Phaser.html
19 /PIXI.html
20 /PIXI.WebGLMaskManager.html
21 /PIXI.WebGLShaderManager.html
22 /PIXI.WebGLSpriteBatch.html
23 /PIXI.WebGLStencilManager.html)
24
25 options[:attribution] = <<-HTML
26 &copy; 2015 Richard Davey, Photon Storm Ltd.<br>
27 Licensed under the MIT License.
28 HTML
29 end
30end
public/icons/docs/phaser/16.png+0−0

Binary file not shown.

public/icons/docs/phaser/16@2x.png+0−0

Binary file not shown.

public/icons/docs/phaser/SOURCE+1−0
@@ -0,0 +1 @@
1https://phaser.io/

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t