Unified · Split
| @@ -7,4 +7,3 @@ public/fonts · 6 unmodified lines | ||
| 7 | 7 | public/docs/**/* |
| 8 | 8 | docs/**/* |
| 9 | 9 | !docs/*.md |
| 10 | −vendor | |
| @@ -721,6 +721,11 @@ credits = [ · 720 unmodified lines | ||
| 721 | 721 | '2018 HashiCorp', |
| 722 | 722 | 'MPL', |
| 723 | 723 | 'https://raw.githubusercontent.com/hashicorp/terraform-website/master/LICENSE.md' |
| 724 | + ], [ | |
| 725 | + 'Trio', | |
| 726 | + '2017 Nathaniel J. Smith', | |
| 727 | + 'MIT', | |
| 728 | + 'https://raw.githubusercontent.com/python-trio/trio/master/LICENSE.MIT' | |
| 724 | 729 | ], [ |
| 725 | 730 | 'Twig', |
| 726 | 731 | '2009-2018 The Twig Team', |
| @@ -3,6 +3,7 @@ module Docs · 2 unmodified lines | ||
| 3 | 3 | class CleanHtmlFilter < Filter |
| 4 | 4 | def call |
| 5 | 5 | @doc = at_css('div[role="main"]') |
| 6 | + | |
| 6 | 7 | css('.section, [itemprop=articleBody]').each do |node| |
| 7 | 8 | node.replace node.children |
| 8 | 9 | end |
| @@ -11,9 +12,11 @@ module Docs · 2 unmodified lines | ||
| 11 | 12 | |
| 12 | 13 | css('dt').each do |node| |
| 13 | 14 | node.name = 'h3' |
| 15 | + | |
| 14 | 16 | if node.parent.classes.include? 'field-list' |
| 15 | 17 | node.name = 'h4' |
| 16 | 18 | node['style'] = 'margin: 0' |
| 19 | + | |
| 17 | 20 | if node.text == 'Parameters' or node.text == 'Raises' |
| 18 | 21 | node.next_element.css('strong').each do |n| |
| 19 | 22 | n.name = 'code' |
| @@ -21,30 +24,31 @@ module Docs · 1 unmodified line | ||
| 21 | 24 | end |
| 22 | 25 | else |
| 23 | 26 | code = doc.document.create_element 'code' |
| 27 | + | |
| 24 | 28 | if em = node.at_css('.property') |
| 25 | 29 | code.inner_html = "<em>#{em.text.strip}</em> " |
| 26 | 30 | em.remove |
| 27 | 31 | end |
| 32 | + | |
| 28 | 33 | code.inner_html += node.inner_text.strip |
| 29 | 34 | node.inner_html = code |
| 30 | 35 | end |
| 31 | 36 | end |
| 32 | 37 | |
| 33 | 38 | css('pre').each do |node| |
| 39 | + node.content = node.content.strip | |
| 40 | + | |
| 34 | 41 | classes = node.parent.parent.classes |
| 35 | 42 | if classes.include? 'highlight-python3' |
| 36 | − node['class'] = 'language-python' | |
| 37 | 43 | node['data-language'] = 'python' |
| 38 | 44 | end |
| 45 | + | |
| 39 | 46 | node.parent.parent.replace(node) |
| 40 | 47 | end |
| 41 | 48 | |
| 42 | 49 | css('.admonition').each do |node| |
| 43 | 50 | node.name = 'blockquote' |
| 44 | 51 | node.at_css('.admonition-title').name = 'h4' |
| 45 | − # new_node = node.document.create_element 'blockquote' | |
| 46 | − # new_node.inner_html = node.inner_html | |
| 47 | − # node.replace new_node | |
| 48 | 52 | end |
| 49 | 53 | |
| 50 | 54 | doc |
| @@ -11,7 +11,6 @@ module Docs · 10 unmodified lines | ||
| 11 | 11 | |
| 12 | 12 | def additional_entries |
| 13 | 13 | css('.descname').each_with_object [] do |node, entries| |
| 14 | − | |
| 15 | 14 | name = node.text |
| 16 | 15 | if node.previous.classes.include? 'descclassname' |
| 17 | 16 | name = node.previous.text + name |
| @@ -25,9 +24,11 @@ module Docs · 7 unmodified lines | ||
| 25 | 24 | or dl.classes.include?('data') |
| 26 | 25 | parent = dl.parent.previous_element |
| 27 | 26 | cls = '' |
| 27 | + | |
| 28 | 28 | if n = parent.at_css('.descclassname') |
| 29 | 29 | cls += n.text |
| 30 | 30 | end |
| 31 | + | |
| 31 | 32 | if n = parent.at_css('.descname') |
| 32 | 33 | if n.text == "The nursery interface" |
| 33 | 34 | cls += "Nursery." |
| @@ -35,6 +36,7 @@ module Docs · 1 unmodified line | ||
| 35 | 36 | cls += n.text + '.' |
| 36 | 37 | end |
| 37 | 38 | end |
| 39 | + | |
| 38 | 40 | name = cls + name |
| 39 | 41 | end |
| 40 | 42 | |
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | module Docs |
| 2 | 2 | class Trio < UrlScraper |
| 3 | 3 | self.type = 'simple' |
| 4 | − self.release = '0.11' | |
| 5 | − self.base_url = 'https://trio.readthedocs.io/en/latest/' | |
| 4 | + self.release = '0.12.1' | |
| 5 | + self.base_url = 'https://trio.readthedocs.io/en/v0.12.1/' | |
| 6 | 6 | self.root_path = 'index.html' |
| 7 | 7 | self.links = { |
| 8 | 8 | home: 'https://trio.readthedocs.io/', |
| @@ -19,9 +19,13 @@ module Docs · 10 unmodified lines | ||
| 19 | 19 | ] |
| 20 | 20 | |
| 21 | 21 | options[:attribution] = <<-HTML |
| 22 | − © 2017-2019 Nathaniel J. Smith<br> | |
| 23 | − Licensed under MIT and Apache2. | |
| 22 | + © 2017 Nathaniel J. Smith<br> | |
| 23 | + Licensed under the MIT License. | |
| 24 | 24 | HTML |
| 25 | 25 | |
| 26 | + def get_latest_version(opts) | |
| 27 | + doc = fetch_doc('https://trio.readthedocs.io/en/stable/', opts) | |
| 28 | + doc.at_css('.rst-other-versions a[href^="/en/v"]').content[1..-1] | |
| 29 | + end | |
| 26 | 30 | end |
| 27 | 31 | end |
File renamed without changes.