improve entries and display of parameters

This commit is contained in:
Mathieu PATUREL 2019-04-26 21:56:05 +10:00
parent 09e47c49f1
commit 94b50f3cc3
3 changed files with 33 additions and 9 deletions

View file

@ -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>#{em.text.strip}</em> "
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

View file

@ -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."

View file

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