Merge remote-tracking branch 'upstream/master' into css-variables

This also converts 1 usage of SCSS variables in the added docs to CSS variables.
pull/858/head
Jed Fox 7 years ago
commit 2bb4df3ced

@ -0,0 +1,8 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

@ -28,7 +28,7 @@ GEM
ffi (1.9.25)
fspath (3.1.0)
highline (1.7.10)
html-pipeline (2.8.3)
html-pipeline (2.8.4)
activesupport (>= 2)
nokogiri (>= 1.4)
i18n (1.0.1)
@ -63,14 +63,14 @@ GEM
rack (2.0.5)
rack-protection (2.0.3)
rack
rack-test (1.0.0)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rake (12.3.1)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
rr (1.2.1)
sass (3.5.6)
sass (3.5.7)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
@ -107,18 +107,18 @@ GEM
strings (~> 0.1.0)
tty-screen (~> 0.6.4)
tty-which (~> 0.3.0)
tty-screen (0.6.4)
tty-screen (0.6.5)
tty-which (0.3.0)
typhoeus (1.3.0)
ethon (>= 0.9.0)
tzinfo (1.2.5)
thread_safe (~> 0.1)
uglifier (4.1.14)
uglifier (4.1.17)
execjs (>= 0.3.0, < 3)
unicode-display_width (1.3.3)
unicode_utils (1.4.0)
unix_utils (0.0.15)
yajl-ruby (1.4.0)
yajl-ruby (1.4.1)
PLATFORMS
ruby

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 45 KiB

@ -1,5 +1,8 @@
[
[
"2018-07-29",
"New documentations: <a href=\"/bash/\">Bash</a>, <a href=\"/graphite/\">Graphite</a> and <a href=\"/pygame/\">Pygame</a>"
], [
"2018-07-08",
"New documentations: <a href=\"/leaflet/\">Leaflet</a>, <a href=\"/terraform/\">Terraform</a> and <a href=\"/koa/\">Koa</a>"
], [

@ -115,6 +115,11 @@ credits = [
'2010-2016 Jeremy Ashkenas, DocumentCloud',
'MIT',
'https://raw.githubusercontent.com/jashkenas/backbone/master/LICENSE'
], [
'Bash',
'2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.',
'GFDL',
'https://www.gnu.org/licenses/fdl-1.3.en.html'
], [
'Bluebird',
'2013-2017 Petka Antonov',
@ -290,6 +295,11 @@ credits = [
'2014-2018 Juan Linietsky, Ariel Manzur, Godot Engine contributors',
'MIT',
'https://raw.githubusercontent.com/godotengine/godot/master/LICENSE.txt'
], [
'Graphite',
'2008-2012 Chris Davis<br>&copy; 2011-2016 The Graphite Project',
'Apache',
'https://raw.githubusercontent.com/graphite-project/graphite-web/master/LICENSE'
], [
'Grunt',
'GruntJS Team',
@ -545,6 +555,11 @@ credits = [
'1996-2018 The PostgreSQL Global Development Group<br>&copy; 1994 The Regents of the University of California',
'PostgreSQL',
'https://www.postgresql.org/about/licence/'
], [
'Pygame',
'Pygame Developpers',
'LGPLv2.1',
'https://raw.githubusercontent.com/pygame/pygame/master/LICENSE'
], [
'Python',
'2001-2018 Python Software Foundation<br>Python is a trademark of the Python Software Foundation.',

@ -37,6 +37,7 @@
'pages/angularjs',
'pages/apache',
'pages/async',
'pages/bash',
'pages/bootstrap',
'pages/c',
'pages/cakephp',
@ -56,6 +57,7 @@
'pages/git',
'pages/github',
'pages/go',
'pages/graphite',
'pages/haskell',
'pages/jekyll',
'pages/jquery',

@ -94,6 +94,7 @@ html._theme-dark {
._icon-marionette:before { background-position: -6rem -5rem; }
._icon-jsdoc:before,
._icon-koa:before,
._icon-graphite:before,
._icon-mongoose:before { background-position: -7rem -5rem; }
._icon-phpunit:before { background-position: -8rem -5rem; }
._icon-nokogiri:before { background-position: -9rem -5rem; @extend %darkIconFix !optional; }
@ -173,3 +174,5 @@ html._theme-dark {
._icon-babel:before { background-position: -2rem -3rem; @extend %doc-icon-2; }
._icon-leaflet:before { background-position: -3rem -3rem; @extend %doc-icon-2; }
._icon-terraform:before { background-position: -4rem -3rem; @extend %doc-icon-2; }
._icon-pygame:before { background-position: -5rem -3rem; @extend %doc-icon-2; }
._icon-bash:before { background-position: -6rem -3rem; @extend %doc-icon-2; }

@ -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,7 @@
._graphite {
@extend %simple;
dl > dt {
@extend %block-label, %label-blue;
}
}

@ -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,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,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,21 @@
module Docs
class Bash < UrlScraper
self.type = 'bash'
self.release = '4.4'
self.base_url = 'https://www.gnu.org/software/bash/manual'
self.root_path = '/html_node/index.html'
self.links = {
home: 'https://www.gnu.org/software/bash/',
code: 'http://git.savannah.gnu.org/cgit/bash.git'
}
html_filters.push 'bash/entries', 'bash/clean_html'
options[:only_patterns] = [/\/html_node\//]
options[:attribution] = <<-HTML
Copyright &copy; 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.<br>
Licensed under the GNU Free Documentation License.
HTML
end
end

@ -0,0 +1,21 @@
module Docs
class Graphite < UrlScraper
self.type = 'graphite'
self.release = '1.1.3'
self.base_url = 'https://graphite.readthedocs.io/en/latest/'
self.links = {
code: 'https://github.com/graphite-project/graphite-web'
}
html_filters.push 'graphite/entries', 'graphite/clean_html'
options[:container] = '.document > div'
options[:skip] = %w(releases.html who-is-using.html composer.html search.html py-modindex.html genindex.html)
options[:attribution] = <<-HTML
&copy; 2008&ndash;2012 Chris Davis<br>
&copy; 2011&ndash;2016 The Graphite Project<br>
Licensed under the Apache License, Version 2.0.
HTML
end
end

@ -0,0 +1,20 @@
module Docs
class Pygame < UrlScraper
self.type = 'simple'
self.release = '1.9.4'
self.root_path = 'py-modindex.html'
self.links = {
home: 'https://www.pygame.org/',
code: 'https://github.com/pygame/pygame'
}
html_filters.push 'pygame/clean_html', 'pygame/entries'
options[:only_patterns] = [/ref\//]
options[:attribution] = <<-HTML
&copy; Pygame Developpers.<br>
Licensed under the GNU LGPL License version 2.1.
HTML
end
end

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

@ -0,0 +1 @@
https://github.com/odb/official-bash-logo

Binary file not shown.

After

Width:  |  Height:  |  Size: 791 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Loading…
Cancel
Save