diff --git a/lib/docs/filters/trio/clean_html.rb b/lib/docs/filters/trio/clean_html.rb index 3d3517c2..17542601 100644 --- a/lib/docs/filters/trio/clean_html.rb +++ b/lib/docs/filters/trio/clean_html.rb @@ -10,14 +10,24 @@ module Docs css('.headerlink').remove css('dt').each do |node| - if node.parent.classes.include? 'class' - new_node = doc.document.create_element 'h2' + node.name = 'h3' + if node.parent.classes.include? 'field-list' + node.name = 'h4' + node['style'] = 'margin: 0' + if node.text == 'Parameters' or node.text == 'Raises' + node.next_element.css('strong').each do |n| + n.name = 'code' + end + end else - new_node = doc.document.create_element "h3" + code = doc.document.create_element 'code' + if em = node.at_css('.property') + code.inner_html = "#{em.text.strip} " + em.remove + end + code.inner_html += node.inner_text.strip + node.inner_html = code end - new_node['id'] = node['id'] - new_node.content = node.inner_text - node.replace new_node end css('pre').each do |node| @@ -28,6 +38,15 @@ module Docs end node.parent.parent.replace(node) end + + css('.admonition').each do |node| + node.name = 'blockquote' + node.at_css('.admonition-title').name = 'h4' + # new_node = node.document.create_element 'blockquote' + # new_node.inner_html = node.inner_html + # node.replace new_node + end + doc end end diff --git a/lib/docs/filters/trio/entries.rb b/lib/docs/filters/trio/entries.rb index 7bd7e124..bb5207f0 100644 --- a/lib/docs/filters/trio/entries.rb +++ b/lib/docs/filters/trio/entries.rb @@ -20,9 +20,14 @@ module Docs dl = node.parent.parent - if dl.classes.include?('attribute') or dl.classes.include?('method') + if dl.classes.include?('attribute') \ + or dl.classes.include?('method') \ + or dl.classes.include?('data') parent = dl.parent.previous_element cls = '' + if n = parent.at_css('.descclassname') + cls += n.text + end if n = parent.at_css('.descname') if n.text == "The nursery interface" cls += "Nursery." diff --git a/public/docs/docs.json b/public/docs/docs.json index ce43dbf3..df09fc48 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": 1556275385, - "db_size": 746040 + "mtime": 1556279513, + "db_size": 757201 } ] \ No newline at end of file