improve entries and display of parameters

pull/1002/head
Mathieu PATUREL 6 years ago
parent 09e47c49f1
commit 94b50f3cc3

@ -10,14 +10,24 @@ module Docs
css('.headerlink').remove css('.headerlink').remove
css('dt').each do |node| css('dt').each do |node|
if node.parent.classes.include? 'class' node.name = 'h3'
new_node = doc.document.create_element 'h2' 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 else
new_node = doc.document.create_element "h3" code = doc.document.create_element 'code'
if em = node.at_css('.property')
code.inner_html = "<em>#{em.text.strip}</em> "
em.remove
end
code.inner_html += node.inner_text.strip
node.inner_html = code
end end
new_node['id'] = node['id']
new_node.content = node.inner_text
node.replace new_node
end end
css('pre').each do |node| css('pre').each do |node|
@ -28,6 +38,15 @@ module Docs
end end
node.parent.parent.replace(node) node.parent.parent.replace(node)
end 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 doc
end end
end end

@ -20,9 +20,14 @@ module Docs
dl = node.parent.parent 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 parent = dl.parent.previous_element
cls = '' cls = ''
if n = parent.at_css('.descclassname')
cls += n.text
end
if n = parent.at_css('.descname') if n = parent.at_css('.descname')
if n.text == "The nursery interface" if n.text == "The nursery interface"
cls += "Nursery." cls += "Nursery."

@ -63,7 +63,7 @@
"code": "https://github.com/python-trio/trio" "code": "https://github.com/python-trio/trio"
}, },
"release": "0.11", "release": "0.11",
"mtime": 1556275385, "mtime": 1556279513,
"db_size": 746040 "db_size": 757201
} }
] ]
Loading…
Cancel
Save