[devdocsgjs/main: 609/1867] improve titles and pre
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 609/1867] improve titles and pre
- Date: Fri, 19 Nov 2021 23:47:18 +0000 (UTC)
commit 09e47c49f1c9c3b67d2a93c90a8c7ef28208e319
Author: Mathieu PATUREL <australie p gmail com>
Date: Fri Apr 26 20:43:31 2019 +1000
improve titles and pre
Gemfile | 2 +-
lib/docs/filters/trio/clean_html.rb | 18 ++++++++++++++++--
lib/docs/filters/trio/entries.rb | 23 ++++++++++++++++++++++-
public/docs/docs.json | 4 ++--
4 files changed, 41 insertions(+), 6 deletions(-)
---
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]