mirror of https://github.com/freeCodeCamp/devdocs
commit
536fa35ff9
@ -0,0 +1,8 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
@ -1,4 +1,7 @@
|
||||
language: ruby
|
||||
|
||||
cache: bundler
|
||||
|
||||
before_script:
|
||||
- gem update --system
|
||||
- gem install bundler
|
||||
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 48 KiB |
File diff suppressed because it is too large
Load Diff
@ -1,105 +0,0 @@
|
||||
//= depend_on docs-1.png
|
||||
//= depend_on docs-1@2x.png
|
||||
//= depend_on docs-2.png
|
||||
//= depend_on docs-2@2x.png
|
||||
|
||||
/*!
|
||||
* Copyright 2013-2018 Thibaut Courouble and other contributors
|
||||
*
|
||||
* This source code is licensed under the terms of the Mozilla
|
||||
* Public License, v. 2.0, a copy of which may be obtained at:
|
||||
* http://mozilla.org/MPL/2.0/
|
||||
*/
|
||||
|
||||
@import 'global/variables-dark',
|
||||
'global/mixins',
|
||||
'global/icons',
|
||||
'global/classes',
|
||||
'global/base';
|
||||
|
||||
@import 'components/app',
|
||||
'components/header',
|
||||
'components/notif',
|
||||
'components/sidebar',
|
||||
'components/settings',
|
||||
'components/content',
|
||||
'components/page',
|
||||
'components/fail',
|
||||
'components/path',
|
||||
'components/notice',
|
||||
'components/prism',
|
||||
'components/mobile';
|
||||
|
||||
@import 'pages/simple',
|
||||
'pages/angular',
|
||||
'pages/angularjs',
|
||||
'pages/apache',
|
||||
'pages/async',
|
||||
'pages/bootstrap',
|
||||
'pages/c',
|
||||
'pages/cakephp',
|
||||
'pages/clojure',
|
||||
'pages/codeception',
|
||||
'pages/coffeescript',
|
||||
'pages/cordova',
|
||||
'pages/crystal',
|
||||
'pages/d',
|
||||
'pages/d3',
|
||||
'pages/dojo',
|
||||
'pages/drupal',
|
||||
'pages/elixir',
|
||||
'pages/ember',
|
||||
'pages/erlang',
|
||||
'pages/express',
|
||||
'pages/git',
|
||||
'pages/github',
|
||||
'pages/go',
|
||||
'pages/haskell',
|
||||
'pages/jekyll',
|
||||
'pages/jquery',
|
||||
'pages/julia',
|
||||
'pages/knockout',
|
||||
'pages/kotlin',
|
||||
'pages/laravel',
|
||||
'pages/liquid',
|
||||
'pages/love',
|
||||
'pages/lua',
|
||||
'pages/mariadb',
|
||||
'pages/mdn',
|
||||
'pages/meteor',
|
||||
'pages/modernizr',
|
||||
'pages/moment',
|
||||
'pages/nginx',
|
||||
'pages/node',
|
||||
'pages/npm',
|
||||
'pages/openjdk',
|
||||
'pages/perl',
|
||||
'pages/phalcon',
|
||||
'pages/phaser',
|
||||
'pages/php',
|
||||
'pages/phpunit',
|
||||
'pages/postgres',
|
||||
'pages/pug',
|
||||
'pages/python',
|
||||
'pages/ramda',
|
||||
'pages/rdoc',
|
||||
'pages/react_native',
|
||||
'pages/redis',
|
||||
'pages/rethinkdb',
|
||||
'pages/rfc',
|
||||
'pages/rubydoc',
|
||||
'pages/rust',
|
||||
'pages/sinon',
|
||||
'pages/socketio',
|
||||
'pages/sphinx',
|
||||
'pages/sphinx_simple',
|
||||
'pages/sqlite',
|
||||
'pages/support_tables',
|
||||
'pages/tcl_tk',
|
||||
'pages/tensorflow',
|
||||
'pages/terraform',
|
||||
'pages/underscore',
|
||||
'pages/vue',
|
||||
'pages/webpack',
|
||||
'pages/yard',
|
||||
'pages/yii';
|
@ -1,92 +1,76 @@
|
||||
$baseFont: -apple-system, BlinkMacSystemFont, 'San Francisco', 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', Arial, sans-serif;
|
||||
$monoFont: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
||||
$boldFontWeight: 500;
|
||||
$bolderFontWeight: 600;
|
||||
html._theme-dark {
|
||||
--absolute: white;
|
||||
|
||||
$style: 'dark';
|
||||
--documentBackground: #222;
|
||||
--contentBackground: #33373a;
|
||||
|
||||
$maxWidth: 80rem;
|
||||
$headerHeight: 3rem;
|
||||
$sidebarWidth: 20rem;
|
||||
$sidebarMediumWidth: 16rem;
|
||||
--textColor: #cbd0d0;
|
||||
--textColorLight: #9da5ad;
|
||||
--textColorLighter: #77787a;
|
||||
|
||||
$documentBackground: #222;
|
||||
$contentBackground: #33373a;
|
||||
--externalsBackground: #fff;
|
||||
|
||||
$textColor: #cbd0d0;
|
||||
$textColorLight: #9da5ad;
|
||||
$textColorLighter: #77787a;
|
||||
$textColorRed: #f44336;
|
||||
--inputFocusBorder: transparent;
|
||||
|
||||
$inputFocusBorder: false;
|
||||
--focusBackground: #3f4042;
|
||||
--focusBorder: #000;
|
||||
--focusText: #f7f2f2;
|
||||
|
||||
$focusBackground: #3f4042;
|
||||
$focusBorder: #000;
|
||||
$focusText: #f7f2f2;
|
||||
--loadingText: #5d6164;
|
||||
|
||||
$loadingText: #5d6164;
|
||||
$splashText: $loadingText;
|
||||
--selectionBackground: #007acc;
|
||||
--selectionBorder: #000;
|
||||
|
||||
$selectionBackground: #007acc;
|
||||
$selectionBorder: #000;
|
||||
$selectionText: #fff;
|
||||
--highlightBackground: #64675f;
|
||||
|
||||
$highlightBackground: #64675f;
|
||||
--linkColor: var(--textColor);
|
||||
--linkColorHover: white;
|
||||
--linkTextDecoration: underline;
|
||||
|
||||
$linkColor: $textColor;
|
||||
$linkColorHover: white;
|
||||
$linkTextDecoration: underline;
|
||||
--headerBackground: #1c1c1c;
|
||||
--headerBorder: #000;
|
||||
--searchTagBackground: #{darken(#1c1c1c, 5%)};
|
||||
--searchBorder: #{darken(#000, 2%)};
|
||||
|
||||
$headerBackground: #1c1c1c;
|
||||
$headerBorder: #000;
|
||||
--sidebarBackground: #24282a;
|
||||
--transparentSidebarBackground: #{rgba(#24282a, 0)};
|
||||
--sidebarBorder: #000;
|
||||
|
||||
$sidebarBackground: #24282a;
|
||||
$sidebarBorder: #000;
|
||||
--scrollbarColor: #6c6c6f;
|
||||
--scrollbarColorHover: #949697;
|
||||
|
||||
$scrollbarColor: #6c6c6f;
|
||||
$scrollbarColorHover: #949697;
|
||||
--pathBackground: var(--headerBackground);
|
||||
--pathBorder: var(--headerBorder);
|
||||
|
||||
$pathBackground: $headerBackground;
|
||||
$pathBorder: $headerBorder;
|
||||
--noticeBackground: var(--sidebarBackground);
|
||||
--noticeBorder: var(--sidebarBorder);
|
||||
|
||||
$noticeBackground: $sidebarBackground;
|
||||
$noticeBorder: $sidebarBorder;
|
||||
--boxBackground: var(--sidebarBackground);
|
||||
--boxBorder: var(--headerBorder);
|
||||
--boxBorderLight: var(--headerBorder);
|
||||
--boxHeaderColor: #dbe4e4;
|
||||
--boxHeaderBackground: var(--sidebarBackground);
|
||||
|
||||
$boxBackground: $sidebarBackground;
|
||||
$boxBorder: $headerBorder;
|
||||
$boxBorderLight: $headerBorder;
|
||||
$boxHeaderColor: #dbe4e4;
|
||||
$boxHeaderBackground: $sidebarBackground;
|
||||
--noteBackground: #45474b;
|
||||
--noteBorder: #000;
|
||||
|
||||
$noteBackground: #45474b;
|
||||
$noteBorder: #000;
|
||||
--noteGreenBackground: #284a2a;
|
||||
--noteGreenBorder: #000;
|
||||
|
||||
$noteGreenBackground: #284a2a;
|
||||
$noteGreenBorder: #000;
|
||||
--noteBlueBackground: #2a4151;
|
||||
--noteBlueBorder: #000;
|
||||
|
||||
$noteBlueBackground: #2a4151;
|
||||
$noteBlueBorder: #000;
|
||||
--noteOrangeBackground: #563322;
|
||||
--noteOrangeBorder: #000;
|
||||
|
||||
$noteOrangeBackground: #563322;
|
||||
$noteOrangeBorder: #000;
|
||||
--noteRedBackground: #603033;
|
||||
--noteRedBorder: #000;
|
||||
|
||||
$noteRedBackground: #603033;
|
||||
$noteRedBorder: #000;
|
||||
--labelBackground: var(--boxBackground);
|
||||
|
||||
$labelBackground: $boxBackground;
|
||||
--notifBackground: #{rgba(#555, .95)};
|
||||
--notifBorder: 1px solid #000;
|
||||
|
||||
$notifBackground: rgba(#555, .95);
|
||||
$notifBorder: 1px solid #000;
|
||||
$notifColor: #fff;
|
||||
$notifColorLight: #ccc;
|
||||
|
||||
$tipBackground: $notifBackground;
|
||||
$tipBorder: $notifBorder;
|
||||
|
||||
$mediumScreen: '(max-width: 800px)';
|
||||
|
||||
$contentZ: 1;
|
||||
$sidebarZ: 2;
|
||||
$headerZ: 3;
|
||||
$noticeZ: 4;
|
||||
$hoverZ: 5;
|
||||
--tipBackground: var(--notifBackground);
|
||||
--tipBorder: var(--notifBorder);
|
||||
}
|
||||
|
@ -0,0 +1,76 @@
|
||||
html._theme-default {
|
||||
--absolute: black;
|
||||
|
||||
--documentBackground: #f3f3f3;
|
||||
--contentBackground: #fff;
|
||||
|
||||
--textColor: #333;
|
||||
--textColorLight: #666;
|
||||
--textColorLighter: #888;
|
||||
|
||||
--externalsBackground: #fff;
|
||||
|
||||
--inputFocusBorder: #35b5f4;
|
||||
|
||||
--focusBackground: #e5e5e5;
|
||||
--focusBorder: #d4d4d4;
|
||||
--focusText: #000;
|
||||
|
||||
--loadingText: #ccc;
|
||||
|
||||
--selectionBackground: #398df0;
|
||||
--selectionBorder: #196fc2;
|
||||
|
||||
--highlightBackground: #fffdcd;
|
||||
|
||||
--linkColor: #3377c0;
|
||||
--linkColorHover: #2f6cb6;
|
||||
--linkTextDecoration: none;
|
||||
|
||||
--headerBackground: #eee;
|
||||
--headerBorder: #d7d7d7;
|
||||
--searchTagBackground: #{darken(#eee, 5%)};
|
||||
--searchBorder: #{darken(#d7d7d7, 2%)};
|
||||
|
||||
--sidebarBackground: #f9f9f9;
|
||||
--transparentSidebarBackground: #{rgba(#f9f9f9, 0)};
|
||||
--sidebarBorder: #e1e1e1;
|
||||
|
||||
--scrollbarColor: #ccc;
|
||||
--scrollbarColorHover: #999;
|
||||
|
||||
--pathBackground: var(--sidebarBackground);
|
||||
--pathBorder: var(--sidebarBorder);
|
||||
|
||||
--noticeBackground: #faf9e2;
|
||||
--noticeBorder: #e2e2c1;
|
||||
|
||||
--boxBackground: #fafafa;
|
||||
--boxBorder: #d8d8d8;
|
||||
--boxBorderLight: #e5e5e5;
|
||||
--boxHeaderColor: var(--textColor);
|
||||
--boxHeaderBackground: #f5f5f5;
|
||||
|
||||
--noteBackground: #f8f8dd;
|
||||
--noteBorder: #d3d952;
|
||||
|
||||
--noteGreenBackground: #e7f8e1;
|
||||
--noteGreenBorder: #89da70;
|
||||
|
||||
--noteBlueBackground: #d4f3fd;
|
||||
--noteBlueBorder: #94bbeb;
|
||||
|
||||
--noteOrangeBackground: #fbe6d1;
|
||||
--noteOrangeBorder: #ec8b01;
|
||||
|
||||
--noteRedBackground: #fed5d3;
|
||||
--noteRedBorder: #dc7874;
|
||||
|
||||
--labelBackground: #f4f4f4;
|
||||
|
||||
--notifBackground: #{rgba(#333, .85)};
|
||||
--notifBorder: none;
|
||||
|
||||
--tipBackground: #{rgba(#fffdcd, .95)};
|
||||
--tipBorder: 1px solid #e7dca9;
|
||||
}
|
@ -1,92 +1,35 @@
|
||||
// Variables needed to style the error message for browsers that don't support CSS variables.
|
||||
$baseFont: -apple-system, BlinkMacSystemFont, 'San Francisco', 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', Arial, sans-serif;
|
||||
$monoFont: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
||||
$boldFontWeight: 500;
|
||||
$bolderFontWeight: 600;
|
||||
|
||||
$style: 'light';
|
||||
|
||||
$maxWidth: 80rem;
|
||||
$headerHeight: 3rem;
|
||||
$sidebarWidth: 20rem;
|
||||
$sidebarMediumWidth: 16rem;
|
||||
|
||||
$documentBackground: #f3f3f3;
|
||||
$contentBackground: #fff;
|
||||
|
||||
$textColor: #333;
|
||||
$textColorLight: #666;
|
||||
$textColorLighter: #888;
|
||||
$textColorRed: #f44336;
|
||||
|
||||
$inputFocusBorder: #35b5f4;
|
||||
|
||||
$focusBackground: #e5e5e5;
|
||||
$focusBorder: #d4d4d4;
|
||||
$focusText: #000;
|
||||
|
||||
$loadingText: #ccc;
|
||||
$splashText: #ccc;
|
||||
|
||||
$selectionBackground: #398df0;
|
||||
$selectionBorder: #196fc2;
|
||||
$selectionText: #fff;
|
||||
|
||||
$highlightBackground: #fffdcd;
|
||||
|
||||
$linkColor: #3377c0;
|
||||
$linkColorHover: #2f6cb6;
|
||||
$linkTextDecoration: none;
|
||||
|
||||
$headerBackground: #eee;
|
||||
$headerBorder: #d7d7d7;
|
||||
|
||||
$sidebarBackground: #f9f9f9;
|
||||
$sidebarBorder: #e1e1e1;
|
||||
|
||||
$scrollbarColor: #ccc;
|
||||
$scrollbarColorHover: #999;
|
||||
|
||||
$pathBackground: $sidebarBackground;
|
||||
$pathBorder: $sidebarBorder;
|
||||
|
||||
$noticeBackground: #faf9e2;
|
||||
$noticeBorder: #e2e2c1;
|
||||
|
||||
$boxBackground: #fafafa;
|
||||
$boxBorder: #d8d8d8;
|
||||
$boxBorderLight: #e5e5e5;
|
||||
$boxHeaderColor: $textColor;
|
||||
$boxHeaderBackground: #f5f5f5;
|
||||
|
||||
$noteBackground: #f8f8dd;
|
||||
$noteBorder: #d3d952;
|
||||
|
||||
$noteGreenBackground: #e7f8e1;
|
||||
$noteGreenBorder: #89da70;
|
||||
|
||||
$noteBlueBackground: #d4f3fd;
|
||||
$noteBlueBorder: #94bbeb;
|
||||
html {
|
||||
--baseFont: #{$baseFont};
|
||||
--monoFont: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, Courier, monospace;
|
||||
--boldFontWeight: 500;
|
||||
--bolderFontWeight: 600;
|
||||
|
||||
$noteOrangeBackground: #fbe6d1;
|
||||
$noteOrangeBorder: #ec8b01;
|
||||
--textColorRed: #f44336;
|
||||
|
||||
$noteRedBackground: #fed5d3;
|
||||
$noteRedBorder: #dc7874;
|
||||
--splashText: var(--loadingText);
|
||||
|
||||
$labelBackground: #f4f4f4;
|
||||
--selectionText: #fff;
|
||||
--transparentSelectionText: rgba(255, 255, 255, 0.9);
|
||||
|
||||
$notifBackground: rgba(#333, .85);
|
||||
$notifBorder: none;
|
||||
$notifColor: #fff;
|
||||
$notifColorLight: #ccc;
|
||||
--notifColor: #fff;
|
||||
--notifColorLight: #ccc;
|
||||
|
||||
$tipBackground: rgba(#fffdcd, .95);
|
||||
$tipBorder: 1px solid #e7dca9;
|
||||
--maxWidth: 80rem;
|
||||
--headerHeight: 3rem;
|
||||
--sidebarWidth: 20rem;
|
||||
--sidebarMediumWidth: 16rem;
|
||||
|
||||
$mediumScreen: '(max-width: 800px)';
|
||||
--focusBackground: #e5e5e5;
|
||||
--focusBorder: #d4d4d4;
|
||||
--focusText: #000;
|
||||
|
||||
$contentZ: 1;
|
||||
$sidebarZ: 2;
|
||||
$headerZ: 3;
|
||||
$noticeZ: 4;
|
||||
$hoverZ: 5;
|
||||
--contentZ: 1;
|
||||
--sidebarZ: 2;
|
||||
--headerZ: 3;
|
||||
--noticeZ: 4;
|
||||
--hoverZ: 5;
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
._bash {
|
||||
dl > dt > code,
|
||||
dl > dt > kbd {
|
||||
@extend %block-label, %label-blue;
|
||||
}
|
||||
|
||||
th[align=left] {
|
||||
border-left: 1px solid var(--boxBorder);
|
||||
}
|
||||
|
||||
code { @extend %label; }
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
._dart {
|
||||
@extend %simple;
|
||||
|
||||
dl:not(.dl-horizontal) dt, .multi-line-signature {
|
||||
@extend %block-label;
|
||||
|
||||
.features {
|
||||
float: right;
|
||||
color: var(--textColorLight);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
._dojo {
|
||||
@extend %simple;
|
||||
|
||||
.jsdoc-inheritance { color: $textColorLight; }
|
||||
.jsdoc-inheritance { color: var(--textColorLight); }
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
._graphite {
|
||||
@extend %simple;
|
||||
|
||||
dl > dt {
|
||||
@extend %block-label, %label-blue;
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
._qt {
|
||||
@extend %simple;
|
||||
|
||||
// Function headers
|
||||
h3.fn > code {
|
||||
float: right;
|
||||
color: var(--textColorLight);
|
||||
}
|
||||
}
|
@ -1,5 +1,5 @@
|
||||
._yard {
|
||||
@extend %simple;
|
||||
|
||||
.tag_title { font-weight: $boldFontWeight; }
|
||||
.tag_title { font-weight: var(--boldFontWeight); }
|
||||
}
|
||||
|
@ -0,0 +1,74 @@
|
||||
module Docs
|
||||
class Bash
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
# Remove the navigation header and footer and the lines underneath and above it
|
||||
at_css('.header + hr').remove
|
||||
line_above = at_xpath('//div[@class="header"]/preceding::hr[1]')
|
||||
line_above.remove unless line_above.nil?
|
||||
css('.header').remove
|
||||
|
||||
# Remove chapter and section numbers from title
|
||||
title_node = at_css('h1, h2, h3, h4, h5, h6')
|
||||
title_node.content = title_node.content.gsub(/(\d+\.?)+/, '').strip
|
||||
title_node.name = 'h1'
|
||||
|
||||
# Remove the "D. " from names like "D. Concept Index" and "D. Function Index"
|
||||
title_node.content = title_node.content[3..-1] if title_node.content.start_with?("D. ")
|
||||
|
||||
# Remove columns containing a single space from tables
|
||||
# In the original reference they are used to add width between two columns
|
||||
xpath('//td[text()=" " and not(descendant::*)]').remove
|
||||
|
||||
# Add id's to additional entry nodes
|
||||
css('dl > dt > code').each do |node|
|
||||
# Only take the direct text (i.e. "<div>Hello <span>World</span></div>" becomes "Hello")
|
||||
node['id'] = node.xpath('text()').to_s.strip
|
||||
end
|
||||
|
||||
# Fix hashes of index entries so they link to the correct hash on the linked page
|
||||
css('table[class^=index-] td[valign=top] > a').each do |node|
|
||||
path = node['href'].split('#')[0]
|
||||
hash = node.content
|
||||
|
||||
# Fix the index entries linking to the Special Parameters page
|
||||
# There are multiple index entries that should link to the same paragraph on that page
|
||||
# Example: the documentation for "$!" is equal to the documentation for "!"
|
||||
if path.downcase.include?('special-parameters')
|
||||
if hash.size > 1 && hash[0] == '$'
|
||||
hash = hash[1..-1]
|
||||
end
|
||||
end
|
||||
|
||||
node['href'] = path + '#' + hash
|
||||
end
|
||||
|
||||
# Fix index table letter hashes (the "Jump to" hashes)
|
||||
css('table[class^=index-] th > a').each do |node|
|
||||
node['id'] = node['name']
|
||||
end
|
||||
|
||||
# Remove the rows with a horizontal line in them from the index tables
|
||||
css('td[colspan="4"]').remove
|
||||
|
||||
# Remove additional text from menu entry and index entry cells
|
||||
css('td[valign=top]').each do |node|
|
||||
link = node.at_css('a')
|
||||
node.children = link unless link.nil?
|
||||
end
|
||||
|
||||
css('tt', 'code', 'table').remove_attr('class')
|
||||
|
||||
css('tt').each do |node|
|
||||
node.name = 'code'
|
||||
end
|
||||
|
||||
css('pre').each do |node|
|
||||
node.content = node.content
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,56 @@
|
||||
module Docs
|
||||
class Bash
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
name = at_css('hr + a + *').content.gsub(/(\d+\.?)+/, '')
|
||||
|
||||
# Remove the "D. " from names like "D. Concept Index" and "D. Function Index"
|
||||
name = name[3..-1] if name.start_with?('D. ')
|
||||
|
||||
name
|
||||
end
|
||||
|
||||
def get_type
|
||||
return 'Manual: Appendices' if name.start_with?('Appendix')
|
||||
return 'Manual: Indexes' if at_css('a[rel=up]').content.include?("Index")
|
||||
"Manual"
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
entry_type = {
|
||||
"Function Index" => "Functions",
|
||||
"Index of Shell Builtin Commands" => "Builtin Commands",
|
||||
"Index of Shell Reserved Words" => "Reserved Words",
|
||||
"Parameter and Variable Index" => "Parameters and Variables"
|
||||
}[name]
|
||||
|
||||
# Only extract additional entries from certain index pages
|
||||
return [] if entry_type.nil?
|
||||
|
||||
entries = []
|
||||
|
||||
css('table[class^=index-] td[valign=top] > a').each_slice(2) do |entry_node, section_node|
|
||||
entry_name = entry_node.content
|
||||
|
||||
page = section_node['href'].split('#')[0]
|
||||
hash = entry_name
|
||||
|
||||
# The Special Parameters page has multiple additional entries which should link to the same paragraph
|
||||
# Example: the documentation for "$!" is equal to the documentation for "!"
|
||||
if page == 'special-parameters'
|
||||
if hash.size > 1 && hash[0] == '$'
|
||||
hash = hash[1..-1]
|
||||
end
|
||||
end
|
||||
|
||||
# Construct path to the page which the index links to
|
||||
entry_path = '/html_node/' + page + '#' + hash
|
||||
|
||||
entries << [entry_name, entry_path, entry_type]
|
||||
end
|
||||
|
||||
entries
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,66 @@
|
||||
module Docs
|
||||
class Dart
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
# Move the title into the main content node in the v1 docs
|
||||
title = at_css('h1.title')
|
||||
if title
|
||||
name = title.children.last.content.strip
|
||||
kind = title.at_css('.kind').content
|
||||
at_css('.main-content').prepend_child("<h1>#{name} #{kind}</h1>")
|
||||
end
|
||||
|
||||
# Add a title to the homepage of the v2 docs
|
||||
if subpath == 'index.html' && at_css('.main-content > h1').nil?
|
||||
at_css('.main-content').prepend_child('<h1>Dart SDK</h1>')
|
||||
end
|
||||
|
||||
# Add the library to the main content (it is not always visible in the menu entry)
|
||||
breadcrumbs = at_css('.breadcrumbs').css('li:not(.self-crumb) > a')
|
||||
if breadcrumbs.length > 1
|
||||
library = breadcrumbs[1].content
|
||||
|
||||
# Generate the link to the homepage of the library
|
||||
with_hypens = library.gsub(/:/, '-')
|
||||
location = "#{'../' * subpath.count('/')}#{with_hypens}/#{with_hypens}-library"
|
||||
link = "<a href=\"#{location}\" class=\"_links-link\">#{library}</span>"
|
||||
|
||||
# Add the link to the main title, just like how the "Homepage" and "Source code" links appear
|
||||
at_css('.main-content').prepend_child("<p class=\"_links\">#{link}</p>")
|
||||
end
|
||||
|
||||
# Extract the actual content
|
||||
# We can't use options[:container] here because the entries filter uses the breadcrumbs node
|
||||
@doc = at_css('.main-content')
|
||||
|
||||
# Move the features (i.e. "read-only, inherited") into the blue header
|
||||
css('.features').each do |node|
|
||||
header = node.xpath('parent::dd/preceding::dt').last
|
||||
header.add_child node unless header.nil?
|
||||
end
|
||||
|
||||
css('section').each do |node|
|
||||
if node['id'] && node.first_element_child
|
||||
node.first_element_child['id'] ||= node['id']
|
||||
end
|
||||
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
css('span').each do |node|
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
# Make code blocks detectable by Prism
|
||||
css('pre').each do |node|
|
||||
node['data-language'] = 'dart'
|
||||
node.content = node.content
|
||||
end
|
||||
|
||||
css('.properties', '.property', '.callables', '.callable').remove_attr('class')
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,42 @@
|
||||
module Docs
|
||||
class Dart
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
title = at_css('h1.title')
|
||||
if title # v1
|
||||
name = title.element_children.last.content.strip
|
||||
kind = title.at_css('.kind').content
|
||||
else # v2
|
||||
title = at_css('.main-content > h1')
|
||||
name = title.content[/(.*)( )/, 1].split(' top-level')[0]
|
||||
kind = title.content[/(.*)( )(.+)/, 3]
|
||||
end
|
||||
|
||||
breadcrumbs = at_css('.breadcrumbs').css('li:not(.self-crumb) > a')
|
||||
first_part = ''
|
||||
|
||||
if breadcrumbs.length == 2 && !kind.include?('class')
|
||||
first_part = breadcrumbs[1].content
|
||||
elsif breadcrumbs.length == 3
|
||||
first_part = breadcrumbs[2].content
|
||||
end
|
||||
|
||||
separator = ''
|
||||
|
||||
unless first_part.empty?
|
||||
if kind.include?('class')
|
||||
separator = ':'
|
||||
else
|
||||
separator = '.'
|
||||
end
|
||||
end
|
||||
|
||||
"#{first_part}#{separator}#{name}"
|
||||
end
|
||||
|
||||
def get_type
|
||||
at_css('.breadcrumbs > li:nth-child(2)').content.split(' ')[0]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,27 @@
|
||||
module Docs
|
||||
class Graphite
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
# Remove the paragraph icon after all headers
|
||||
css('.headerlink').remove
|
||||
|
||||
css('dl.function > dt').each do |node|
|
||||
node.content = node.content
|
||||
end
|
||||
|
||||
css('.section').each do |node|
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
css('div[class*="highlight-"]').each do |node|
|
||||
node.content = node.content.strip
|
||||
node.name = 'pre'
|
||||
node['data-language'] = node['class'][/highlight\-(\w+)/, 1]
|
||||
node.remove_attribute('class')
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,46 @@
|
||||
module Docs
|
||||
class Graphite
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
at_css('h1').children[0].to_s
|
||||
end
|
||||
|
||||
def get_type
|
||||
get_name
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
entries = []
|
||||
|
||||
# Sections
|
||||
css('.section > .section').each do |node|
|
||||
title = node.at_css('h2, h3')
|
||||
|
||||
next if title.nil?
|
||||
|
||||
# Move the id attribute to the title
|
||||
# If this is excluded, the complete section will be highlighted in yellow when someone navigates to it
|
||||
title['id'] = node['id']
|
||||
node.remove_attribute('id')
|
||||
|
||||
parent_title_selector = "parent::div[@class='section']/preceding::#{title.name == 'h2' ? 'h1' : 'h2'}"
|
||||
|
||||
entries << [
|
||||
title.children[0].to_s,
|
||||
title['id'],
|
||||
title.xpath(parent_title_selector).last.children[0].to_s
|
||||
]
|
||||
end
|
||||
|
||||
# Functions
|
||||
css('dl.function > dt').each do |node|
|
||||
name = node.at_css('.descname').content
|
||||
name << '()'
|
||||
entries << [name, node['id'], 'Functions']
|
||||
end
|
||||
|
||||
entries
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,44 @@
|
||||
module Docs
|
||||
class Handlebars
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
# Remove the t-shirt shop advertisement
|
||||
css('#callout').remove
|
||||
|
||||
# The title filter is used to add titles to pages without one, remove original headers
|
||||
css('h1').remove
|
||||
|
||||
# Remove the link to the issue tracker
|
||||
css('.issue-tracker').remove
|
||||
|
||||
css('pre').each do |node|
|
||||
# Remove nested nodes inside pre tags
|
||||
node.content = node.content
|
||||
|
||||
# Add syntax highlighting
|
||||
node['data-language'] = 'html'
|
||||
end
|
||||
|
||||
# Transform 'Learn More' links to headers in the "Getting Started" part of the homepage
|
||||
# If this step is skipped, that section looks cluttered with 4 sub-sections without any dividers
|
||||
css('#getting-started + .contents a.more-info').each do |node|
|
||||
clone = node.clone
|
||||
|
||||
# Move it to the top of the sub-section
|
||||
node.parent.prepend_child(clone)
|
||||
|
||||
# Turn it into a header
|
||||
clone.name = 'h3'
|
||||
|
||||
# Remove the "Learn More: " part
|
||||
clone.content = clone.content[12..-1]
|
||||
end
|
||||
|
||||
# Remove class attributes from div elements to reduce file size
|
||||
css('div').remove_attr('class')
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,19 @@
|
||||
module Docs
|
||||
class Handlebars
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
subpath[0..-6].titleize
|
||||
end
|
||||
|
||||
def get_type
|
||||
name
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
css('h2, h3').to_a.map do |node|
|
||||
[node.content.strip, node['id'], root_page? ? 'Manual' : nil]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,24 @@
|
||||
module Docs
|
||||
class Puppeteer
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
at_css('h1').content = 'Puppeteer Documentation'
|
||||
|
||||
# None of the elements to remove have classes, so the order of the remove calls is trivial
|
||||
|
||||
# Remove links to previous versions of the reference
|
||||
at_css('h1 + ul').remove
|
||||
|
||||
# Remove table of contents
|
||||
at_css('h1 + h5').remove
|
||||
at_css('h1 + ul').remove
|
||||
|
||||
# Make headers bigger by transforming them into a bigger variant
|
||||
css('h3').each { |node| node.name = 'h2' }
|
||||
css('h4').each { |node| node.name = 'h3' }
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,41 @@
|
||||
module Docs
|
||||
class Puppeteer
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
# The entire reference is one big page, so get_name and get_type are not necessary
|
||||
|
||||
def additional_entries
|
||||
entries = []
|
||||
|
||||
css('h3').each do |node|
|
||||
name = node.content.split(': ').last
|
||||
|
||||
# Find all sub-items (all h4's between the current h3 and the next)
|
||||
current = node.next
|
||||
while !current.nil? && current.name != 'h3'
|
||||
if current.name == 'h4'
|
||||
current_name = current.content
|
||||
|
||||
# Prepend events with the class name
|
||||
if current_name.start_with?('event: ')
|
||||
current_name = "#{name} event: #{current_name[/'(.*)'/, 1]}"
|
||||
end
|
||||
|
||||
# Remove arguments from functions
|
||||
if current_name.include?('(')
|
||||
current_name = current_name.split('(')[0] + '()'
|
||||
end
|
||||
|
||||
entries << [current_name, current['id'], name]
|
||||
end
|
||||
|
||||
current = current.next
|
||||
end
|
||||
|
||||
entries << [name, node['id'], name]
|
||||
end
|
||||
|
||||
entries
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,102 @@
|
||||
module Docs
|
||||
class Pygame
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
@doc = at_css '.body'
|
||||
|
||||
if root_page?
|
||||
# remove unneeded stuff
|
||||
at_css('.modindex-jumpbox').remove
|
||||
css('[role="navigation"],.pcap, .cap, .footer').remove
|
||||
# table -> list
|
||||
list = at_css('table')
|
||||
list.replace(list.children)
|
||||
list.name = 'ul'
|
||||
css('tr').each do |row|
|
||||
row.name = 'li'
|
||||
row.remove_attribute('class')
|
||||
end
|
||||
at_css('h1').content = 'Pygame'
|
||||
return doc
|
||||
end
|
||||
|
||||
# remove unwanted stuff
|
||||
# .headerlink => ¶ after links
|
||||
# .toc => table of content
|
||||
# .tooltip-content => tooltips after links to functions
|
||||
css('table.toc.docutils, .headerlink, .tooltip-content').remove
|
||||
|
||||
# Remove wrapper .section
|
||||
section = at_css('.section')
|
||||
definition = at_css('.definition')
|
||||
definition['id'] = section['id']
|
||||
section.replace(section.children)
|
||||
|
||||
# Format code for it be highlighted
|
||||
css('.highlight-default.notranslate').each do |node|
|
||||
pre = node.at_css('pre')
|
||||
node.replace(pre)
|
||||
# gets rid of the already existing syntax highlighting
|
||||
pre.content = pre.content
|
||||
pre['class'] = 'language-python'
|
||||
pre['data-language'] = "python"
|
||||
end
|
||||
|
||||
# change descriptions of functions/attributes to blockquote
|
||||
css('.line-block').each do |node|
|
||||
node.name = 'blockquote'
|
||||
end
|
||||
|
||||
# change functions
|
||||
css('.definition').each do |d|
|
||||
|
||||
# the header is the function/attribute name. It might look something like
|
||||
# this:
|
||||
# pygame.image.load()
|
||||
# It'll end up being something like this:
|
||||
# pygame.image.load(filename) -> Surface
|
||||
# pygame.image.load(fileobj, namehint="") -> Surface
|
||||
|
||||
header = d.at_css('dt.title')
|
||||
if d['class'].include?('class') or d['class'].include?('module')
|
||||
header.name = 'h1'
|
||||
@section = header.content.strip
|
||||
else
|
||||
header.name = 'h3'
|
||||
end
|
||||
# save the original header
|
||||
initial_header = header.content.strip
|
||||
# save the real name for the entries
|
||||
header['data-name'] = initial_header
|
||||
# empty the header
|
||||
if header.name == 'h3'
|
||||
header.inner_html = ''
|
||||
end
|
||||
# to replace it with the signatures
|
||||
next_el = header.next_element
|
||||
signatures = next_el.css('.signature')
|
||||
signatures.each do |sig|
|
||||
sig.name = 'code'
|
||||
if header.name == 'h3'
|
||||
sig.parent = header
|
||||
# the signature don't contain pygame.module. I think it's better
|
||||
# to display them, as it avoids confusion with methods (have a
|
||||
# look at the pygame.Rect page)
|
||||
if initial_header.start_with?(@section)
|
||||
sig.content = @section + '.' + sig.text
|
||||
end
|
||||
# seperate the signatures on different lines.
|
||||
header.add_child "<br>"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
css('> dl', '> dl > dd', 'h1 code').each do |node|
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,29 @@
|
||||
module Docs
|
||||
class Pygame
|
||||
class EntriesFilter < Docs::EntriesFilter
|
||||
def get_name
|
||||
at_css('h1').content.remove('pygame.')
|
||||
end
|
||||
|
||||
def get_type
|
||||
at_css('h1').content
|
||||
end
|
||||
|
||||
def additional_entries
|
||||
return [] if root_page?
|
||||
|
||||
css('h1, h2, h3').each_with_object [] do |node, entries|
|
||||
name = node['id'] || node['data-name']
|
||||
|
||||
if node.parent['class'].include?('function') or node.parent['class'].include?('method')
|
||||
name << '()'
|
||||
end
|
||||
|
||||
name.remove!('pygame.')
|
||||
|
||||
entries << [name, node['id']] unless name == self.name
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
@ -0,0 +1,31 @@
|
||||
module Docs
|
||||
class Qt
|
||||
class CleanHtmlFilter < Filter
|
||||
def call
|
||||
# Remove unneeded elements
|
||||
css('.copy-notice, .navigationbar, .headerNavi, .footerNavi, .sidebar, .toc, #ec_toggle', '.landingicons img', 'br').remove
|
||||
|
||||
# QML property/method header
|
||||
css('.qmlproto').each do |node|
|
||||
id = node.at_css('tr')['id']
|
||||
node.inner_html = node.at_css('td').inner_html
|
||||
node.name = 'h3'
|
||||
node['id'] = id
|
||||
end
|
||||
|
||||
css('.main-rounded', '.content', '.line', '.context', '.descr', '.types', '.func', '.table', 'div:not([class])', '.landing', '.col-1', '.heading', '.qmlitem', '.qmldoc', 'div.pre').each do |node|
|
||||
node.before(node.children).remove
|
||||
end
|
||||
|
||||
css('pre').each do |node|
|
||||
node.content = node.content
|
||||
node['data-language'] = 'cpp' if node['class'].include?('cpp')
|
||||
node['data-language'] = 'qml' if node['class'].include?('qml')
|
||||
node.remove_attribute('class')
|
||||
end
|
||||
|
||||
doc
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue