Update Julia documentation (0.6, 0.5)

pull/647/head
Thibaut Courouble 8 years ago
parent 6a77e253f5
commit f54d2b428c

@ -56,6 +56,7 @@
'pages/go',
'pages/haskell',
'pages/jquery',
'pages/julia',
'pages/knockout',
'pages/kotlin',
'pages/laravel',

@ -56,6 +56,7 @@
'pages/go',
'pages/haskell',
'pages/jquery',
'pages/julia',
'pages/knockout',
'pages/kotlin',
'pages/laravel',

@ -0,0 +1,7 @@
._julia {
@extend %simple;
.footnote { @extend %note; }
.note { @extend %note; }
.docstring-category { float: right; }
}

@ -2,7 +2,26 @@ module Docs
class Julia
class CleanHtmlFilter < Filter
def call
@doc = at_css('.document .section')
css('> header', '> footer').remove
css('.docstring', 'div:not([class])').each do |node|
node.before(node.children).remove
end
css('.docstring-header').each do |node|
node.name = 'h3'
node.children.each { |child| child.remove if child.text? }
node.remove_attribute('class')
end
css('a.docstring-binding[id]', 'a.nav-anchor').each do |node|
node.parent['id'] = node['id']
node.before(node.children).remove
end
css('pre').each do |node|
node.content = node.content
end
doc
end

@ -0,0 +1,11 @@
module Docs
class Julia
class CleanHtmlSphinxFilter < Filter
def call
@doc = at_css('.document .section')
doc
end
end
end
end

@ -2,9 +2,7 @@ module Docs
class Julia
class EntriesFilter < Docs::EntriesFilter
def get_name
name = at_css('.document h1').content
name.remove! "\u{00B6}"
name
at_css('h1').content
end
def get_type
@ -17,17 +15,15 @@ module Docs
def additional_entries
return [] unless slug.start_with?('stdlib')
entries = []
css('.function dt[id]').each do |node|
entries << [node['id'].remove('Base.') + '()', node['id']]
css('.docstring-binding[id]').map do |node|
name = node.content
name.gsub! '.:', '.'
name.remove! 'Base.'
category = node.parent.at_css('.docstring-category').content
name << '()' if category == 'Function' || category == 'Method'
[name, node['id']]
end
css('.data dt[id]').each do |node|
entries << [node['id'].remove('Base.'), node['id']]
end
entries
end
end
end

@ -0,0 +1,34 @@
module Docs
class Julia
class EntriesSphinxFilter < Docs::EntriesFilter
def get_name
name = at_css('.document h1').content
name.remove! "\u{00B6}"
name
end
def get_type
if slug.start_with?('manual')
'Manual'
else
name
end
end
def additional_entries
return [] unless slug.start_with?('stdlib')
entries = []
css('.function dt[id]').each do |node|
entries << [node['id'].remove('Base.') + '()', node['id']]
end
css('.data dt[id]').each do |node|
entries << [node['id'].remove('Base.'), node['id']]
end
entries
end
end
end
end

@ -1,20 +1,33 @@
module Docs
class Julia < UrlScraper
self.type = 'sphinx_simple'
self.release = '0.5.2'
self.base_url = 'https://docs.julialang.org/en/stable/'
self.links = {
home: 'https://julialang.org/',
code: 'https://github.com/JuliaLang/julia'
}
html_filters.push 'julia/entries', 'julia/clean_html', 'sphinx/clean_html'
options[:only_patterns] = [/\Amanual\//, /\Astdlib\//]
options[:attribution] = <<-HTML
&copy; 2009&ndash;2016 Jeff Bezanson, Stefan Karpinski, Viral B. Shah, and other contributors<br>
Licensed under the MIT License.
HTML
version '0.6' do
self.release = '0.6.0'
self.base_url = 'https://docs.julialang.org/en/release-0.6/'
self.type = 'julia'
html_filters.push 'julia/entries', 'julia/clean_html'
options[:container] = '#docs'
end
version '0.5' do
self.release = '0.5.2'
self.base_url = 'https://docs.julialang.org/en/release-0.5/'
self.type = 'sphinx_simple'
html_filters.push 'julia/entries_sphinx', 'julia/clean_html_sphinx', 'sphinx/clean_html'
end
end
end

Loading…
Cancel
Save