diff --git a/Gemfile b/Gemfile index 31b57064..da6e8ba0 100644 --- a/Gemfile +++ b/Gemfile @@ -1,5 +1,5 @@ source 'https://rubygems.org' -ruby '2.6.0' +ruby '2.6.2' gem 'rake' gem 'thor' diff --git a/lib/docs/filters/trio/clean_html.rb b/lib/docs/filters/trio/clean_html.rb index 5c2ef228..3d3517c2 100644 --- a/lib/docs/filters/trio/clean_html.rb +++ b/lib/docs/filters/trio/clean_html.rb @@ -10,10 +10,24 @@ module Docs css('.headerlink').remove css('dt').each do |node| - new_node = doc.document.create_element "h3" - new_node.content = node.inner_text[0...-1] + if node.parent.classes.include? 'class' + new_node = doc.document.create_element 'h2' + else + new_node = doc.document.create_element "h3" + end + new_node['id'] = node['id'] + new_node.content = node.inner_text node.replace new_node end + + css('pre').each do |node| + classes = node.parent.parent.classes + if classes.include? 'highlight-python3' + node['class'] = 'language-python' + node['data-language'] = 'python' + end + node.parent.parent.replace(node) + end doc end end diff --git a/lib/docs/filters/trio/entries.rb b/lib/docs/filters/trio/entries.rb index 64387d6e..7bd7e124 100644 --- a/lib/docs/filters/trio/entries.rb +++ b/lib/docs/filters/trio/entries.rb @@ -11,7 +11,28 @@ module Docs def additional_entries css('.descname').each_with_object [] do |node, entries| - name = node.previous.text + node.text + + name = node.text + if node.previous.classes.include? 'descclassname' + name = node.previous.text + name + end + name.strip! + + dl = node.parent.parent + + if dl.classes.include?('attribute') or dl.classes.include?('method') + parent = dl.parent.previous_element + cls = '' + if n = parent.at_css('.descname') + if n.text == "The nursery interface" + cls += "Nursery." + else + cls += n.text + '.' + end + end + name = cls + name + end + id = node.parent['id'] entries << [name, id] end diff --git a/public/docs/docs.json b/public/docs/docs.json index eff8727c..ce43dbf3 100644 --- a/public/docs/docs.json +++ b/public/docs/docs.json @@ -63,7 +63,7 @@ "code": "https://github.com/python-trio/trio" }, "release": "0.11", - "mtime": 1556272773, - "db_size": 736670 + "mtime": 1556275385, + "db_size": 746040 } ] \ No newline at end of file