diff --git a/assets/images/docs-2.png b/assets/images/docs-2.png index a51bd345..fcfb9f25 100644 Binary files a/assets/images/docs-2.png and b/assets/images/docs-2.png differ diff --git a/assets/images/docs-2@2x.png b/assets/images/docs-2@2x.png index 6c9d7be6..1b88fe32 100644 Binary files a/assets/images/docs-2@2x.png and b/assets/images/docs-2@2x.png differ diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index deb27dbd..d18ec141 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,5 +1,8 @@ [ [ + "2017-07-23", + "New documentation: Godot" + ], [ "2017-06-04", "New documentations: Electron, Pug, and Falcon" ], [ diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index de315db1..ed092c5d 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -268,6 +268,11 @@ credits = [ 'Google, Inc.', 'CC BY', 'https://creativecommons.org/licenses/by/3.0/' + ], [ + 'Godot', + '2014-2017 Juan Linietsky, Ariel Manzur, Godot Engine contributors', + 'MIT', + 'https://raw.githubusercontent.com/godotengine/godot/master/LICENSE.txt' ], [ 'Grunt', 'GruntJS Team', diff --git a/assets/stylesheets/global/_icons.scss b/assets/stylesheets/global/_icons.scss index 3d2db9fd..b52cbb02 100644 --- a/assets/stylesheets/global/_icons.scss +++ b/assets/stylesheets/global/_icons.scss @@ -175,3 +175,4 @@ ._icon-pug:before { background-position: -1rem -2rem; @extend %doc-icon-2; } ._icon-electron:before { background-position: -2rem -2rem; @extend %doc-icon-2; } ._icon-falcon:before { background-position: -3rem -2rem; @extend %doc-icon-2; } +._icon-godot:before { background-position: -4rem -2rem; @extend %doc-icon-2; } diff --git a/assets/stylesheets/pages/_sphinx_simple.scss b/assets/stylesheets/pages/_sphinx_simple.scss index af679219..7cb7e0dc 100644 --- a/assets/stylesheets/pages/_sphinx_simple.scss +++ b/assets/stylesheets/pages/_sphinx_simple.scss @@ -3,6 +3,7 @@ .admonition { @extend %note; } .admonition.warning { @extend %note-orange; } + .admonition.tip { @extend %note-green; } .admonition-title { margin: 0 0 .25rem; font-weight: $boldFontWeight; diff --git a/lib/docs/filters/godot/clean_html.rb b/lib/docs/filters/godot/clean_html.rb index 8d9cc7e4..1a1adc6b 100644 --- a/lib/docs/filters/godot/clean_html.rb +++ b/lib/docs/filters/godot/clean_html.rb @@ -2,7 +2,23 @@ module Docs class Godot class CleanHtmlFilter < Filter def call - @doc = at_css('.document .section') + if root_page? + at_css('h1').content = 'Godot Engine' + at_css('.admonition.tip').remove + end + + css('ul[id].simple li:first-child:last-child').each do |node| + heading = Nokogiri::XML::Node.new 'h3', doc + heading['id'] = node.parent['id'] + heading.children = node.children + node.parent.before(heading).remove + end + + css('h3 strong').each do |node| + node.before(node.children).remove + end + + css('a.reference').remove_attr('class') doc end diff --git a/lib/docs/filters/godot/entries.rb b/lib/docs/filters/godot/entries.rb index 5f678a99..c3622b5a 100644 --- a/lib/docs/filters/godot/entries.rb +++ b/lib/docs/filters/godot/entries.rb @@ -2,33 +2,43 @@ module Docs class Godot class EntriesFilter < Docs::EntriesFilter def get_name - name = at_css('.document h1').content + name = at_css('h1').content name.remove! "\u{00B6}" # Remove the pilcrow name end + TYPE_BY_LEARNING_PATH = { + 'step_by_step' => 'Guides: Step by step', + 'editor' => 'Guides: Editor', + 'features' => 'Guides: Engine features', + 'scripting' => 'Guides: Scripting', + 'workflow' => 'Guides: Project workflow' + } + def get_type if slug.start_with?('learning') - 'Learning' + TYPE_BY_LEARNING_PATH[slug.split('/')[1]] else - 'API Reference' + name end end def additional_entries return [] unless slug.start_with?('classes') - class_name = at_css('h1').content - class_name.remove! "\u{00B6}" # Remove the pilcrow - entries = [] - # Each page represents a class, and class methods are defined in - # individual sections. - css('.simple[id]').each do |node| - fn_name = node.at_css('strong') - entries << [class_name + '.' + fn_name + '()', node['id']] + css('.simple[id]').each_with_object [] do |node, entries| + name = node.at_css('strong').content + next if name == self.name + name.prepend "#{self.name}." + name << '()' + entries << [name, node['id']] unless entries.any? { |entry| entry[0] == name } end + end - entries + def include_default_entry? + return false if subpath.start_with?('learning') && subpath.end_with?('index.html') + return false if subpath == 'classes/index.html' + true end end end diff --git a/lib/docs/filters/sphinx/clean_html.rb b/lib/docs/filters/sphinx/clean_html.rb index 020ab435..409d16c9 100644 --- a/lib/docs/filters/sphinx/clean_html.rb +++ b/lib/docs/filters/sphinx/clean_html.rb @@ -87,9 +87,7 @@ module Docs node.remove_attribute 'cellspacing' end - css('code[class]').each do |node| - node.remove_attribute 'class' - end + css('code', 'tr').remove_attr('class') css('h1').each do |node| node.content = node.content diff --git a/lib/docs/scrapers/godot.rb b/lib/docs/scrapers/godot.rb index 34cfc9eb..335fe04a 100644 --- a/lib/docs/scrapers/godot.rb +++ b/lib/docs/scrapers/godot.rb @@ -8,18 +8,29 @@ module Docs html_filters.push 'godot/entries', 'godot/clean_html', 'sphinx/clean_html' - # `learning/` contains the guided learning materials, and `classes/` - # contains the API reference. + options[:download_images] = false + options[:container] = '.document .section' + options[:only_patterns] = [/\Alearning\//, /\Aclasses\//] + options[:skip] = %w(classes/class_@global\ scope.html) - options[:attribution] = <<-HTML - © Copyright 2014–2017, Juan Linietsky, Ariel Manzur and the Godot community (CC-BY 3.0). - HTML + options[:attribution] = ->(filter) do + if filter.subpath.start_with?('classes') + <<-HTML + © 2014–2017 Juan Linietsky, Ariel Manzur, Godot Engine contributors
+ Licensed under the MIT License. + HTML + else + <<-HTML + © 2014–2017 Juan Linietsky, Ariel Manzur and the Godot community
+ Licensed under the Creative Commons Attribution Unported License v3.0. + HTML + end + end version '2.1' do self.release = '2.1' self.base_url = "http://docs.godotengine.org/en/#{self.version}/" end - end end diff --git a/public/icons/docs/godot/16.png b/public/icons/docs/godot/16.png index bd947c25..c574a60d 100644 Binary files a/public/icons/docs/godot/16.png and b/public/icons/docs/godot/16.png differ diff --git a/public/icons/docs/godot/16@2x.png b/public/icons/docs/godot/16@2x.png index 4411cbae..8047384d 100644 Binary files a/public/icons/docs/godot/16@2x.png and b/public/icons/docs/godot/16@2x.png differ