improve titles and pre

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

@ -1,5 +1,5 @@
source 'https://rubygems.org'
ruby '2.6.0'
ruby '2.6.2'
gem 'rake'
gem 'thor'

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

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

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