[devdocsgjs/main: 218/239] Restructuring entries, duplicated items removed.




commit b4a1491c4e2edcad24a1094b44921b8793581d87
Author: xjkdev <xjk2008 gmail com>
Date:   Wed Mar 9 21:35:54 2022 +0800

    Restructuring entries, duplicated items removed.

 lib/docs/filters/eigen3/entries.rb | 52 +++++++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 23 deletions(-)
---
diff --git a/lib/docs/filters/eigen3/entries.rb b/lib/docs/filters/eigen3/entries.rb
index 12248a2f..3f2a585d 100644
--- a/lib/docs/filters/eigen3/entries.rb
+++ b/lib/docs/filters/eigen3/entries.rb
@@ -7,34 +7,33 @@ module Docs
         title = get_title()
         downtitle = title.downcase
         name = get_name
+
+        # Remove Empty pages.
         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 'Topics'
+        elsif downtitle.end_with?("class template reference") || downtitle.end_with?("class reference")
           return 'Classes'
+        elsif downtitle.end_with?("struct reference")
+          return 'Structs'
         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
+            return 'Namespaces'
+        elsif not group.nil? and group.content.include?('Reference') and (downtitle.end_with?("module") || 
downtitle.end_with?("modules"))
+            return "Modules"
+        elsif not group.nil?
+          if group.children.length > 0
+            return 'Chapter: ' + group.children[-1].content
+          else
+            return 'Chapter: ' + group.content
+          end
         else
           return 'Eigen'
         end
@@ -67,11 +66,13 @@ module Docs
           doxygen_type = table.at_css("tr.heading").text.strip
           case doxygen_type
           when "Functions"
-            type = name == 'Eigen' ? "Functions" : nil
+            type = "Functions"
           when "Public Member Functions", "Static Public Member Functions"
             type = nil
-          when "Classes", "Typedefs"
+          when "Classes"
             type = "Classes"
+          when "Typedefs"
+            type = "Typedefs"
           when "Variables"
             type = "Variables"
           else
@@ -88,12 +89,17 @@ module Docs
             end
 
             href = node.at_css("a").attr('href')
-            if href.index("#").nil? then
-              href += "#"
-            end
-            if slug.include?('unsupported') and not href.include?('unsupported')
+
+            if not href.include?("#") and (name == 'Eigen' || type = "Classes") then
               next
             end
+            if slug.include?('unsupported')
+              if not (href.include?('unsupported') || href.include?('#'))
+                next
+              elsif href.include?('#') and not href.include?('unsupported')
+                href = 'unsupported/' + href
+              end
+            end
 
             content = node.content
             if doxygen_type == "Typedefs"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]