[devdocsgjs/main: 216/239] Added eigen3 scrapers, filters, icons, and etc.
- From: Andy Holmes <andyholmes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [devdocsgjs/main: 216/239] Added eigen3 scrapers, filters, icons, and etc.
- Date: Fri, 8 Apr 2022 07:47:43 +0000 (UTC)
commit 77730c3073b12c2b829a5bf71126ca6ee591895c
Author: xjkdev <xjk2008 gmail com>
Date: Wed Mar 9 14:50:32 2022 +0800
Added eigen3 scrapers, filters, icons, and etc.
.../javascripts/templates/pages/about_tmpl.coffee | 5 +
assets/stylesheets/application.css.scss | 1 +
assets/stylesheets/pages/_eigen3.scss | 267 +++++++++++++++++++++
lib/docs/filters/eigen3/clean_html.rb | 22 ++
lib/docs/filters/eigen3/entries.rb | 113 +++++++++
lib/docs/scrapers/eigen3.rb | 45 ++++
public/icons/docs/eigen3/16.png | Bin 0 -> 1460 bytes
public/icons/docs/eigen3/16 2x png | Bin 0 -> 3088 bytes
public/icons/docs/eigen3/SOURCE | 1 +
9 files changed, 454 insertions(+)
---
diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee
b/assets/javascripts/templates/pages/about_tmpl.coffee
index d8f1e249..f5fa3b14 100644
--- a/assets/javascripts/templates/pages/about_tmpl.coffee
+++ b/assets/javascripts/templates/pages/about_tmpl.coffee
@@ -262,6 +262,11 @@ credits = [
'2001-2015 by the original authors<br>Drupal is a registered trademark of Dries Buytaert.',
'GPLv2',
'https://api.drupal.org/api/drupal/LICENSE.txt'
+ ],[
+ 'Eigen3',
+ 'Eigen',
+ 'MPL2',
+ 'https://www.mozilla.org/en-US/MPL/2.0/'
], [
'Electron',
'GitHub Inc.',
diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss
index 3a6d428e..1d5da325 100644
--- a/assets/stylesheets/application.css.scss
+++ b/assets/stylesheets/application.css.scss
@@ -52,6 +52,7 @@
'pages/dart',
'pages/dojo',
'pages/drupal',
+ 'pages/eigen3',
'pages/elixir',
'pages/elisp',
'pages/ember',
diff --git a/assets/stylesheets/pages/_eigen3.scss b/assets/stylesheets/pages/_eigen3.scss
new file mode 100644
index 00000000..ae5c5f99
--- /dev/null
+++ b/assets/stylesheets/pages/_eigen3.scss
@@ -0,0 +1,267 @@
+._eigen3 {
+ /* General */
+ a.el {
+ font-weight: bold;
+ }
+ a {
+ color: #3D578C;
+ font-weight: normal;
+ text-decoration: none;
+ }
+ /* end General */
+
+ /* Title */
+ .title {
+ font: 400 14px/28px ,sans-serif;
+ font-size: 150%;
+ font-weight: bold;
+ margin: 10px 2px;
+ }
+
+ div.ingroups {
+ font-size: 8pt;
+ text-align: left;
+ }
+ /* end Title */
+
+ /* Fragments */
+ div.fragment {
+ display: table;
+ padding: 4px;
+ border: 1px solid #C4CFE5;
+ }
+ .fragment {
+ text-align: left;
+ direction: ltr;
+ overflow-x: auto;
+ overflow-y: hidden;
+ }
+
+ div.line {
+ font-family: var(--monoFont);
+ font-size: 13px;
+ min-height: 13px;
+ line-height: 1.0;
+ text-wrap: unrestricted;
+ white-space: -moz-pre-wrap;
+ white-space: -pre-wrap;
+ white-space: -o-pre-wrap;
+ white-space: pre-wrap;
+ word-wrap: break-word;
+ // text-indent: -53px;
+ // padding-left: 53px;
+ padding-bottom: 0px;
+ margin: 0px;
+ -webkit-transition-property: background-color, box-shadow;
+ -webkit-transition-duration: 0.5s;
+ -moz-transition-property: background-color, box-shadow;
+ -moz-transition-duration: 0.5s;
+ -ms-transition-property: background-color, box-shadow;
+ -ms-transition-duration: 0.5s;
+ -o-transition-property: background-color, box-shadow;
+ -o-transition-duration: 0.5s;
+ transition-property: background-color, box-shadow;
+ transition-duration: 0.5s;
+ }
+
+ .fragment {
+ text-align: left;
+ direction: ltr;
+ overflow-x: auto; /*Fixed: fragment lines overlap floating elements*/
+ overflow-y: hidden;
+ }
+
+ div.line::after {
+ content: "\000A";
+ white-space: pre;
+ }
+
+ a.code, a.code:visited, a.line, a.line:visited {
+ color: #4665A2;
+ }
+
+ a.codeRef, a.codeRef:visited, a.lineRef, a.lineRef:visited {
+ color: #4665A2;
+ }
+
+ /* end Fragements */
+
+ /* Code Colorization */
+
+ span.keyword {
+ color: var(--prismKeyword)
+ }
+
+ span.keywordtype {
+ color: var(--prismKeyword)
+ }
+
+ span.keywordflow {
+ color: var(--prismKeyword)
+ }
+
+ span.comment {
+ color: var(--textColorLight);
+ }
+
+ span.preprocessor {
+ color: var(--prismKeyword);
+ }
+
+ span.stringliteral {
+ color: var(--prismText);
+ }
+
+ span.charliteral {
+ color: var(--prismText);
+ }
+
+ // span.vhdldigit {
+ // color: #ff00ff
+ // }
+
+ // span.vhdlchar {
+ // color: #000000
+ // }
+
+ // span.vhdlkeyword {
+ // color: #700070
+ // }
+
+ // span.vhdllogic {
+ // color: #ff0000
+ // }
+
+ // blockquote {
+ // background-color: #F7F8FB;
+ // border-left: 2px solid #9CAFD4;
+ // margin: 0 24px 0 4px;
+ // padding: 0 12px 0 16px;
+ // }
+
+ // blockquote.DocNodeRTL {
+ // border-left: 0;
+ // border-right: 2px solid #9CAFD4;
+ // margin: 0 4px 0 24px;
+ // padding: 0 16px 0 12px;
+ // }
+
+ /* end Code Colorization */
+
+ /* Member List */
+
+ .memtitle {
+ padding: 8px;
+ border-top: 1px solid; //#A8B8D9;
+ border-left: 1px solid; //#A8B8D9;
+ border-right: 1px solid; //#A8B8D9;
+ border-top-right-radius: 4px;
+ border-top-left-radius: 4px;
+ margin-bottom: -1px;
+ // background-image: url('nav_f.png');
+ // background-repeat: repeat-x;
+ // background-color: #E2E8F2;
+ line-height: 1.25;
+ font-weight: 300;
+ // float: left;
+ }
+
+ .mdescLeft, .mdescRight, .memItemLeft, .memItemRight, .memTemplItemLeft, .memTemplItemRight,
.memTemplParams {
+ // background-color: #F9FAFC;
+ border: none;
+ margin: 4px;
+ padding: 1px 0 0 8px;
+ }
+
+ td.memTemplParams {
+ border: none;
+ white-space: nowrap;
+ font-size: 80%;
+ }
+
+ .memproto, dl.reflist dt {
+ border-top: 0.5px solid; // #A8B8D9;
+ border-left: 1px solid; // #A8B8D9;
+ border-right: 1px solid; // #A8B8D9;
+ border-bottom: 1px solid; // #A8B8D9;
+ padding: 6px 0px 6px 0px;
+ }
+
+ .memtemplate {
+ font-size: 80%;
+ color: #4665A2;
+ font-weight: normal;
+ margin-left: 9px;
+ }
+
+ .memdoc {
+ padding-left: 6px;
+ }
+
+ table.mlabels {
+ padding: 0;
+ margin: 0;
+ border: none;
+ }
+
+ td.mlabels-left, td.mlabels-right {
+ border: none;
+ padding: 0;
+ vertical-align: bottom;
+ }
+
+ td.memSeparator {
+ line-height: 1px;
+ padding: 0px;
+ }
+ /* end Member List */
+
+ /* Member Name */
+ td.mlabels-right {
+ vertical-align: bottom;
+ padding: 0px;
+ white-space: nowrap;
+ }
+
+ table.memname {
+ border: none;
+ margin-left: 6px;
+ margin-top: 0.5em;
+ }
+
+ table.memname tr{
+ border: none;
+ }
+
+ table.memname th, table.memname td{
+ border: none;
+ padding: 1px;
+ vertical-align: bottom;
+ }
+
+ td.mlabels-left {
+ width: 100%;
+ }
+
+ .paramname {
+ // color: #602020;
+ white-space: nowrap;
+ }
+
+ span.mlabel {
+ background-color: #728DC1;
+ // border-top: 1px solid #5373B4;
+ // border-left: 1px solid #5373B4;
+ // border-right: 1px solid #C4CFE5;
+ // border-bottom: 1px solid #C4CFE5;
+ text-shadow: none;
+ color: white;
+ margin-right: 4px;
+ padding: 2px 3px;
+ border-radius: 3px;
+ font-size: 7pt;
+ white-space: nowrap;
+ vertical-align: middle;
+ }
+ /* end Member Name */
+}
diff --git a/lib/docs/filters/eigen3/clean_html.rb b/lib/docs/filters/eigen3/clean_html.rb
new file mode 100644
index 00000000..e1215403
--- /dev/null
+++ b/lib/docs/filters/eigen3/clean_html.rb
@@ -0,0 +1,22 @@
+module Docs
+ class Eigen3
+ class CleanHtmlFilter < Filter
+
+ def call
+ # TODO doc.inner_html = parse
+ # inner_html = String.new(doc.inner_html).gsub(/<div class="line">(.*?)<\/div>/m,
"\\1\n").gsub(/<div class="fragment">(.*?)<\/div>/m, '<pre class="fragment">\1</pre>')
+ # doc.inner_html = inner_html
+ @doc = at_css('#doc-content')
+ css('#MSearchSelectWindow').remove
+ css('#MSearchResultsWindow').remove
+ css('.directory .levels').remove
+ css('.header .summary').remove
+ css('.ttc').remove
+ css('.top').remove
+ css('.dynheader.closed').remove
+ css('.permalink').remove
+ doc
+ end
+ end
+ end
+end
diff --git a/lib/docs/filters/eigen3/entries.rb b/lib/docs/filters/eigen3/entries.rb
new file mode 100644
index 00000000..1aa134bf
--- /dev/null
+++ b/lib/docs/filters/eigen3/entries.rb
@@ -0,0 +1,113 @@
+module Docs
+ class Eigen3
+ class EntriesFilter < Docs::EntriesFilter
+ def get_type
+ group = at_css('.title .ingroups')
+ content = at_css('.contents').content
+ title = get_title()
+ downtitle = title.downcase
+ name = get_name
+ if content.include?('TODO: write this dox page!') ||
+ content.blank? || content.empty?
+ return nil
+ end
+ if slug.include?('unsupported')
+ return 'Unsupported'
+ elsif title.end_with?('module')
+ return name
+ elsif not group.nil? and not group.children[-1].nil? and group.children[-1].content != 'Reference'
+ if group.children[-1].content.end_with?('module') || group.content.include?('Reference')
+ return group.children[-1].content
+ else
+ return 'Chapter: ' + group.children[-1].content
+ end
+ elsif slug.start_with?('Topic') || downtitle.end_with?("topics")
+ return 'Topics'
+ elsif downtitle.end_with?("class template reference") || downtitle.end_with?("class reference") ||
downtitle.end_with?("struct reference")
+ return 'Classes'
+ elsif downtitle.end_with?("typedefs")
+ return 'Typedefs'
+ elsif downtitle.end_with?("namespace reference")
+ return 'Namespaces'
+ elsif name.match(/^Eigen::.*::/)
+ return name.gsub(/^Eigen::/, '').gsub(/::.*/, '')
+ elsif not group.nil? and not group.children[0].nil?
+ return 'Chapter: ' + group.children[0].content
+ # elsif slug.downcase.include?('tutorial')
+ # return nil
+ else
+ return 'Eigen'
+ end
+ end
+
+ def get_name
+ title = get_title().gsub(/[<(].*/, '').gsub(/(Class|Class Template|Namespace|Struct) Reference/,
'').strip
+ end
+
+ def get_title
+ unless at_css('.title').nil?
+ group = at_css('.title .ingroups')
+ title = at_css('.title').content
+ if not group.nil?
+ title = title.delete_suffix(group.content)
+ end
+ return title.strip
+ else
+ return slug
+ end
+ end
+
+
+ def additional_entries
+ # return [] if slug.include?('unsupported')
+ name = get_name()
+ entries = []
+
+ css('table.memberdecls').map do |table|
+ doxygen_type = table.at_css("tr.heading").text.strip
+ case doxygen_type
+ when "Functions"
+ type = name == 'Eigen' ? "Functions" : nil
+ when "Public Member Functions", "Static Public Member Functions"
+ type = nil
+ when "Classes", "Typedefs"
+ type = "Classes"
+ when "Variables"
+ type = "Variables"
+ else
+ next
+ end
+
+ table.css('td.memItemRight,td.memTemplItemRight').map do |node|
+ if node.content.include?('KLU')
+ puts(node.content)
+ end
+ href = node.at_css("a")
+ if href.nil?
+ next
+ end
+
+ href = node.at_css("a").attr('href')
+ if href.index("#").nil? then
+ href += "#"
+ end
+ if slug.include?('unsupported') and not href.include?('unsupported')
+ next
+ end
+
+ content = node.content
+ if doxygen_type == "Typedefs"
+ content = content.sub(/\s*=.*$/, "")
+ end
+ if not (name.end_with?('module') || name.end_with?('typedefs'))
+ content = name + "::" + content
+ end
+
+ entries << [content, href, type]
+ end
+ end
+ entries
+ end
+ end
+ end
+end
diff --git a/lib/docs/scrapers/eigen3.rb b/lib/docs/scrapers/eigen3.rb
new file mode 100644
index 00000000..641ec72d
--- /dev/null
+++ b/lib/docs/scrapers/eigen3.rb
@@ -0,0 +1,45 @@
+module Docs
+ class Eigen3 < UrlScraper
+ self.name = 'Eigen3'
+ self.type = 'eigen3'
+ self.slug = 'eigen3'
+ self.base_url = 'https://eigen.tuxfamily.org/dox/'
+ self.root_path = 'index.html'
+ self.initial_paths = [
+ "modules.html"
+ ]
+ self.release = '3.4.0'
+
+ self.links = {
+ home: 'https://eigen.tuxfamily.org',
+ code: 'https://gitlab.com/libeigen/eigen'
+ }
+
+ html_filters.push 'eigen3/entries', 'eigen3/clean_html'
+
+ # Remove the `clean_text` because Doxygen are actually creating empty
+ # anchor such as <a id="asd"></a> to do anchor link.. and that anchor
+ # will be removed by clean_text
+ self.text_filters = FilterStack.new
+ text_filters.push 'images', 'inner_html', 'attribution'
+
+
+
+ def get_latest_version(opts)
+ tags = get_gitlab_tags("https://gitlab.com", "libeigen", "eigen", opts)
+ tags[0]['name']
+ end
+
+ options[:attribution] = <<-HTML
+ © Eigen.<br>
+ Licensed under the MPL License.
+ HTML
+
+ # Skip source code since it doesn't provide any useful docs
+ options[:skip_patterns] = [/_source/, /-members/, /__Reference\.html/, /_chapter\.html/,]
+
+ # TODO: replace cppreference
+ # options[:replace_urls] = { 'http://en.cppreference.com/w/cpp/' => 'cpp/' }
+
+ end
+end
diff --git a/public/icons/docs/eigen3/16.png b/public/icons/docs/eigen3/16.png
new file mode 100644
index 00000000..265a2f49
Binary files /dev/null and b/public/icons/docs/eigen3/16.png differ
diff --git a/public/icons/docs/eigen3/16 2x png b/public/icons/docs/eigen3/16 2x png
new file mode 100644
index 00000000..9cc98d2c
Binary files /dev/null and b/public/icons/docs/eigen3/16 2x png differ
diff --git a/public/icons/docs/eigen3/SOURCE b/public/icons/docs/eigen3/SOURCE
new file mode 100644
index 00000000..439adb72
--- /dev/null
+++ b/public/icons/docs/eigen3/SOURCE
@@ -0,0 +1 @@
+https://gitlab.com/libeigen/eigen/-/blob/master/doc/Eigen_Silly_Professor_64x64.png
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]