History

sanctuary: simplify

Simon Legner committed 4 years ago

Commit d1edab71 parent 05362983 files · +4 −81Browse files

Unified · Split

3 files
  1. assets/stylesheets/pages/_sanctuary.scss +0 −74
  2. lib/docs/filters/sanctuary/clean_html.rb +2 −5
  3. lib/docs/scrapers/sanctuary.rb +2 −2
assets/stylesheets/pages/_sanctuary.scss+0−74
@@ -1,80 +1,6 @@
1._sanctuary {1._sanctuary {
2 @extend %simple;2 @extend %simple;
3 3
4 --base-font-size: 14px;
5
6 --h2-padding-top: 0.5em;
7 --h2-line-height: 1.25rem;
8 --h2-padding-bottom: 0.5em;
9 --h2-border-bottom-width: 1px;
10 --h2-margin-bottom: 1em;
11
12 --h3-padding-top: 1px;
13 --h3-line-height: 1.375rem;
14 --h3-padding-bottom: 2px;
15 --h3-border-bottom-width: 1px;
16 --h3-margin-bottom: 1em;
17
18 --h4-padding-top: 0px;
19 --h4-line-height: calc(1.3 * var(--base-font-size));
20 --h4-padding-bottom: 0px;
21 --h4-margin-bottom: 1em;
22
23 padding-left: 32px;
24
25 .pilcrow {
26 position: absolute;
27 display: block;
28 width: 24px;
29 text-align: center;
30 text-decoration: none;
31 font-weight: var(--bolderFontWeight);
32
33 html._theme-default & {
34 color: #eee;
35 &:hover { color: var(--linkColor); }
36 }
37 html._theme-dark & {
38 color: #555;
39 &:hover { color: var(--linkColor); }
40 }
41 }
42
43 .pilcrow.h2 {
44 margin-left: -40px;
45 margin-top: calc(0px - (var(--h2-padding-top) +
46 var(--h2-line-height) +
47 var(--h2-padding-bottom) +
48 var(--h2-border-bottom-width) +
49 var(--h2-margin-bottom)));
50 padding: var(--h2-padding-top) 0 var(--h2-padding-bottom);
51 font-size: 1rem;
52 line-height: var(--h2-line-height);
53 }
54
55 .pilcrow.h3 {
56 margin-left: -40px;
57 margin-top: calc(0px - (var(--h3-padding-top) +
58 var(--h3-line-height) +
59 var(--h3-padding-bottom) +
60 var(--h3-border-bottom-width) +
61 var(--h3-margin-bottom)));
62 padding: var(--h3-padding-top) 0 var(--h3-padding-bottom);
63 font-size: inherit;
64 line-height: var(--h3-line-height);
65 }
66
67 .pilcrow.h4 {
68 margin-left: -24px;
69 margin-top: calc(0px - (var(--h4-padding-top) +
70 var(--h4-line-height) +
71 var(--h4-padding-bottom) +
72 var(--h4-margin-bottom)));
73 padding: var(--h4-padding-top) 0 var(--h4-padding-bottom);
74 font-size: inherit;
75 line-height: var(--h4-line-height);
76 }
77
78 pre > code {4 pre > code {
79 font-size: inherit;5 font-size: inherit;
80 }6 }
lib/docs/filters/sanctuary/clean_html.rb+2−5
@@ -3,14 +3,11 @@ module Docs · 2 unmodified lines
3 class Sanctuary3 class Sanctuary
4 class CleanHtmlFilter < Filter4 class CleanHtmlFilter < Filter
5 def call5 def call
6 # Remove header containing GitHub, Gitter, and Stack Overflow links.
7 doc.at("#css-header").unlink()
8
9 # Remove redundant section links from table of contents.6 # Remove redundant section links from table of contents.
10 doc.at("a[href='#section:api']").next_element.unlink()7 doc.at("a[href='#section:api']").next_element.unlink()
11 8
12 # Swap headings and accompanying pilcrows to aid positioning via CSS.9 # Remove pilcrows.
13 doc.css(".pilcrow").each { |node| node.next_element.after(node) }10 doc.css(".pilcrow").remove()
14 11
15 # Insert Fink link in place of logo.12 # Insert Fink link in place of logo.
16 doc.at("[id='section:sponsors'] ~ ul > li > p").prepend_child(13 doc.at("[id='section:sponsors'] ~ ul > li > p").prepend_child(
lib/docs/scrapers/sanctuary.rb+2−2
@@ -11,9 +11,9 @@ module Docs · 10 unmodified lines
11 code: "https://github.com/sanctuary-js/sanctuary",11 code: "https://github.com/sanctuary-js/sanctuary",
12 }12 }
13 13
14 html_filters.push("sanctuary/entries")14 html_filters.push "sanctuary/entries", "sanctuary/clean_html"
15 html_filters.push("sanctuary/clean_html")
16 15
16 options[:container] = '#css-main'
17 options[:title] = "Sanctuary"17 options[:title] = "Sanctuary"
18 options[:attribution] = "Licensed under the MIT License."18 options[:attribution] = "Licensed under the MIT License."
19 19