[devdocsgjs/main: 220/239] Improve code fragment.
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 220/239] Improve code fragment.
- Date: Fri, 8 Apr 2022 07:47:43 +0000 (UTC)
commit add3280261bb2ea2513d67d9cfe99e55c0ebc1f1
Author: xjkdev <xjk2008 gmail com>
Date: Thu Mar 10 17:11:53 2022 +0800
Improve code fragment.
However, some indents are still eaten.
lib/docs/filters/eigen3/clean_html.rb | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/lib/docs/filters/eigen3/clean_html.rb b/lib/docs/filters/eigen3/clean_html.rb
index 21c2a1e2..0542507e 100644
--- a/lib/docs/filters/eigen3/clean_html.rb
+++ b/lib/docs/filters/eigen3/clean_html.rb
@@ -4,14 +4,6 @@ module Docs
def call
@doc = at_css('#doc-content')
-
- css("div.fragment").each do |node|
- node.css("div.line").each do |node|
- node.replace(node.inner_html + "\n")
- end
- node.replace("<pre data-language=\"cpp\" class=\"fragment\">" + node.inner_html + "</pre>")
- end
-
css('#MSearchSelectWindow').remove
css('#MSearchResultsWindow').remove
css('.directory .levels').remove
@@ -20,6 +12,16 @@ module Docs
css('.top').remove
css('.dynheader.closed').remove
css('.permalink').remove
+
+ css("div.fragment").each do |node|
+ node.name = 'pre'
+ node['data-language'] = 'cpp'
+ node_content = ""
+ node.css('div').each do |inner_node|
+ node_content += inner_node.text + "\n"
+ end
+ node.content = node_content
+ end
doc
end
end
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]