From 77730c3073b12c2b829a5bf71126ca6ee591895c Mon Sep 17 00:00:00 2001 From: xjkdev Date: Wed, 9 Mar 2022 14:50:32 +0800 Subject: [PATCH] Added eigen3 scrapers, filters, icons, and etc. --- .../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(+) create mode 100644 assets/stylesheets/pages/_eigen3.scss create mode 100644 lib/docs/filters/eigen3/clean_html.rb create mode 100644 lib/docs/filters/eigen3/entries.rb create mode 100644 lib/docs/scrapers/eigen3.rb create mode 100644 public/icons/docs/eigen3/16.png create mode 100644 public/icons/docs/eigen3/16@2x.png create mode 100644 public/icons/docs/eigen3/SOURCE 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
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>/m, "\\1\n").gsub(/
(.*?)<\/div>/m, '
\1
') + # 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 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.
+ 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 0000000000000000000000000000000000000000..265a2f49df6d386a0188315a6170e46f02966cbb GIT binary patch literal 1460 zcmZuwdsNd^9KYLs+wZrH!C*YbU}G=FCa@EuZhr5~q1I-R=beDC-Bz4v~;_xoI%VN0Tr z7$g7yB_-LIg>vdFAvkmwMta#%22~lX1^~u3kf$AZRA*NtXITMg5dg5F1Asr#qZRi6 zSR@7Dei;DjUH}5>`zA8A0AR0Xq-C3CF>FChOgz&IYc$%JOs-HUHVG*_p3ojaP(`UL zqv4q@NI}QWQ^E)YNO(ZR0~{9ECGd<==}*Df41Vm8P}G7xJ~=vC%cNo@fjA8ZuMWZK zxKO+R?@s|(94wV8qoQ;(Gc(OCOUKXOppk%%4WVB+6!;bssoh2?Q4)+oj}RuuWJ+T& zxN~!?3+ieLiyaaE*nA0Gt|W=WL}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eigen3/16@2x.png b/public/icons/docs/eigen3/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..9cc98d2c1e7941be530d4f3e3496280b59f3de4a GIT binary patch literal 3088 zcmV+r4Da)aP)004R>004l5008;`004mK004C`008P>0026e000+ooVrmw00006 zVoOIv0RI600RN!9r;`8x010qNS#tmY3ljhU3ljkVnw%H_000McNliru<^u^6A|33t zP_+O63jaw&K~z}7tyf!&p2t~!X6F0mJO1ax?*ISmwbyoHCoVoTZK6N}Nn32I6sQV{ zDgiAh7nBPSTu=%U>J3*d5(q(|NWIHNs*(bM0O~5GX;PfTt`i?)d)Is3wg1EJfBMef z9Jp}6wJ1bLeWlTiG_OX_yzevfyf49z+4k)_h%`-(v|9VVTqqQ8Sls-UkmBku{qnDd zzw_Il{U84H#|9OO-KZJMQ=|AAl-simkH$WkB zoId@F>E_mI!F9Yd0IHO*lcs6OixLhQq=81DGpOxEv36O7z#N4k>z^>`hXg zzPD`xC@{cx4Y-tmNeu}=w_Ec#f8jMSX4G8Q{bZwAcL88D8W%XX{)I7PI2_)Og7LrJ zL}^4h_SyyVld}c-CD*3sj%E7!EYrz>D*HGy$V0A8eZwR=SLk2c%GNh_#geDjm(VO9 zBbN8Me!pL}xQ)(S3&RmVRIS#3s$8zE^!q!QOh)$soIQIMgb*4<5nEnf7QXN6n>TOb zi8&rO%XYeYR$kr-=nscHlOO4CSH$W-K}di<(IE_Ivv^Vb|Iw3 zB-JAV%u}t8lsK`t#mv;1$2cya+YcZW!6?uejRnd!Xx*bcjRi)upG^04AbcZ%S*SR zwVWdaKfAVe3yj^%zVUNsKL+sPhgYt>`Qg{U_v+t%`uopgZS5XQADd&C26RSHw_#Bh75*7Woref!ejiIbgsk7IkRu-upXixz#n zXb}*?;JQ8>)4;VWm$9+A32j%fy}5y6xr|n;f=<{l6la}S)KQF)ewLj@N`QRgS72}A(NPT;(UU}{rCwgNkN0{Tle3^cxW|JnR z07`A-P7`nZ$M>OB1b6mCzA;h%K8(dzg~Xdu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