[devdocsgjs/main: 19/69] sanctuary: simplify




commit d1edab7a5019c99bfa8a63f535180e4be4065e22
Author: Simon Legner <Simon Legner gmail com>
Date:   Sat Aug 27 19:19:42 2022 +0200

    sanctuary: simplify

 assets/stylesheets/pages/_sanctuary.scss | 74 --------------------------------
 lib/docs/filters/sanctuary/clean_html.rb |  7 +--
 lib/docs/scrapers/sanctuary.rb           |  4 +-
 3 files changed, 4 insertions(+), 81 deletions(-)
---
diff --git a/assets/stylesheets/pages/_sanctuary.scss b/assets/stylesheets/pages/_sanctuary.scss
index 2d815e5e..45f5a839 100644
--- a/assets/stylesheets/pages/_sanctuary.scss
+++ b/assets/stylesheets/pages/_sanctuary.scss
@@ -1,80 +1,6 @@
 ._sanctuary {
   @extend %simple;
 
-  --base-font-size: 14px;
-
-  --h2-padding-top: 0.5em;
-  --h2-line-height: 1.25rem;
-  --h2-padding-bottom: 0.5em;
-  --h2-border-bottom-width: 1px;
-  --h2-margin-bottom: 1em;
-
-  --h3-padding-top: 1px;
-  --h3-line-height: 1.375rem;
-  --h3-padding-bottom: 2px;
-  --h3-border-bottom-width: 1px;
-  --h3-margin-bottom: 1em;
-
-  --h4-padding-top: 0px;
-  --h4-line-height: calc(1.3 * var(--base-font-size));
-  --h4-padding-bottom: 0px;
-  --h4-margin-bottom: 1em;
-
-  padding-left: 32px;
-
-  .pilcrow {
-    position: absolute;
-    display: block;
-    width: 24px;
-    text-align: center;
-    text-decoration: none;
-    font-weight: var(--bolderFontWeight);
-
-    html._theme-default & {
-      color: #eee;
-      &:hover { color: var(--linkColor); }
-    }
-    html._theme-dark & {
-      color: #555;
-      &:hover { color: var(--linkColor); }
-    }
-  }
-
-  .pilcrow.h2 {
-    margin-left: -40px;
-    margin-top: calc(0px - (var(--h2-padding-top) +
-                            var(--h2-line-height) +
-                            var(--h2-padding-bottom) +
-                            var(--h2-border-bottom-width) +
-                            var(--h2-margin-bottom)));
-    padding: var(--h2-padding-top) 0 var(--h2-padding-bottom);
-    font-size: 1rem;
-    line-height: var(--h2-line-height);
-  }
-
-  .pilcrow.h3 {
-    margin-left: -40px;
-    margin-top: calc(0px - (var(--h3-padding-top) +
-                            var(--h3-line-height) +
-                            var(--h3-padding-bottom) +
-                            var(--h3-border-bottom-width) +
-                            var(--h3-margin-bottom)));
-    padding: var(--h3-padding-top) 0 var(--h3-padding-bottom);
-    font-size: inherit;
-    line-height: var(--h3-line-height);
-  }
-
-  .pilcrow.h4 {
-    margin-left: -24px;
-    margin-top: calc(0px - (var(--h4-padding-top) +
-                            var(--h4-line-height) +
-                            var(--h4-padding-bottom) +
-                            var(--h4-margin-bottom)));
-    padding: var(--h4-padding-top) 0 var(--h4-padding-bottom);
-    font-size: inherit;
-    line-height: var(--h4-line-height);
-  }
-
   pre > code {
     font-size: inherit;
   }
diff --git a/lib/docs/filters/sanctuary/clean_html.rb b/lib/docs/filters/sanctuary/clean_html.rb
index c3b00728..bfd3fa71 100644
--- a/lib/docs/filters/sanctuary/clean_html.rb
+++ b/lib/docs/filters/sanctuary/clean_html.rb
@@ -3,14 +3,11 @@ module Docs
   class Sanctuary
     class CleanHtmlFilter < Filter
       def call
-        # Remove header containing GitHub, Gitter, and Stack Overflow links.
-        doc.at("#css-header").unlink()
-
         # Remove redundant section links from table of contents.
         doc.at("a[href='#section:api']").next_element.unlink()
 
-        # Swap headings and accompanying pilcrows to aid positioning via CSS.
-        doc.css(".pilcrow").each { |node| node.next_element.after(node) }
+        # Remove pilcrows.
+        doc.css(".pilcrow").remove()
 
         # Insert Fink link in place of logo.
         doc.at("[id='section:sponsors'] ~ ul > li > p").prepend_child(
diff --git a/lib/docs/scrapers/sanctuary.rb b/lib/docs/scrapers/sanctuary.rb
index b569868d..533107f3 100644
--- a/lib/docs/scrapers/sanctuary.rb
+++ b/lib/docs/scrapers/sanctuary.rb
@@ -11,9 +11,9 @@ module Docs
       code: "https://github.com/sanctuary-js/sanctuary";,
     }
 
-    html_filters.push("sanctuary/entries")
-    html_filters.push("sanctuary/clean_html")
+    html_filters.push "sanctuary/entries", "sanctuary/clean_html"
 
+    options[:container] = '#css-main'
     options[:title] = "Sanctuary"
     options[:attribution] = "Licensed under the MIT License."
 


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