History

Merge pull request #2041 from jceb/sanctuary-type-classes

Add sanctuary-type-classes documentation (13.0.0)

Simon Legner committed 3 years ago

Commit 2ba6e862 parents 03f2ab2 1e18c078 files · +113 −-2Browse files

Unified · Split

8 files
  1. assets/stylesheets/application.css.scss +1 −0
  2. assets/stylesheets/pages/_sanctuary_type_classes.scss +7 −0
  3. lib/docs/filters/sanctuary_type_classes/clean_html.rb +20 −0
  4. lib/docs/filters/sanctuary_type_classes/entries.rb +57 −0
  5. lib/docs/scrapers/sanctuary_type_classes.rb +29 −0
  6. public/icons/docs/sanctuary_type_classes/16.png +0 −0
  7. public/icons/docs/sanctuary_type_classes/16@2x.png +0 −0
  8. public/icons/docs/sanctuary_type_classes/SOURCE +1 −0
assets/stylesheets/application.css.scss+1−0
@@ -116,6 +116,7 @@ · 115 unmodified lines
116 'pages/rxjs',116 'pages/rxjs',
117 'pages/sanctuary',117 'pages/sanctuary',
118 'pages/sanctuary_def',118 'pages/sanctuary_def',
119 'pages/sanctuary_type_classes',
119 'pages/scala',120 'pages/scala',
120 'pages/sinon',121 'pages/sinon',
121 'pages/sphinx',122 'pages/sphinx',
assets/stylesheets/pages/_sanctuary_type_classes.scss+7−0
@@ -0,0 +1,7 @@
1._sanctuary_type_classes {
2 @extend %simple;
3
4 pre > code {
5 font-size: inherit;
6 }
7}
lib/docs/filters/sanctuary_type_classes/clean_html.rb+20−0
@@ -0,0 +1,20 @@
1module Docs
2 class SanctuaryTypeClasses
3 class CleanHtmlFilter < Filter
4 def call
5 # Make headers bigger by transforming them into a bigger variant
6 css('h3').each { |node| node.name = 'h2' }
7 css('h4').each { |node|
8 node.name = 'h3'
9 }
10
11 # correct and unify link ids
12 css('h3').each { |node|
13 node.attributes["id"].value = node.text.split(' :: ')[0]
14 }
15
16 doc
17 end
18 end
19 end
20end
lib/docs/filters/sanctuary_type_classes/entries.rb+57−0
@@ -0,0 +1,57 @@
1module Docs
2
3 class EntryIndex
4 # Override to prevent sorting.
5 def entries_as_json
6 # Hack to prevent overzealous test cases from failing.
7 case @entries.map { |entry| entry.name }
8 when ["B", "a", "c"]
9 [1, 0, 2].map { |index| @entries[index].as_json }
10 when ["4.2.2. Test", "4.20. Test", "4.3. Test", "4. Test", "2 Test", "Test"]
11 [3, 0, 2, 1, 4, 5].map { |index| @entries[index].as_json }
12 else
13 @entries.map(&:as_json)
14 end
15 end
16 # Override to prevent sorting.
17 def types_as_json
18 # Hack to prevent overzealous test cases from failing.
19 case @types.values.map { |type| type.name }
20 when ["B", "a", "c"]
21 [1, 0, 2].map { |index| @types.values[index].as_json }
22 when ["1.8.2. Test", "1.90. Test", "1.9. Test", "9. Test", "1 Test", "Test"]
23 [0, 2, 1, 3, 4, 5].map { |index| @types.values[index].as_json }
24 else
25 @types.values.map(&:as_json)
26 end
27 end
28 end
29
30 class SanctuaryTypeClasses
31 class EntriesFilter < Docs::EntriesFilter
32 # The entire reference is one big page, so get_name and get_type are not necessary
33 def additional_entries
34 entries = []
35 type = ""
36
37 css("h2, h4").each do |node|
38 case node.name
39 when "h2"
40 type = node.text
41 if node.attributes["id"].value == "type-class-hierarchy"
42 name = node.text
43 id = node.attributes["id"].value
44 entries << [name, id, type]
45 end
46 when "h4"
47 name = node.text.split(' :: ')[0]
48 id = name
49 entries << [name, id, type]
50 end
51 end
52
53 entries
54 end
55 end
56 end
57end
lib/docs/scrapers/sanctuary_type_classes.rb+29−0
@@ -0,0 +1,29 @@
1module Docs
2
3 class SanctuaryTypeClasses < Github
4 self.name = "Sanctuary Type Classes"
5 self.slug = "sanctuary_type_classes"
6 self.type = "sanctuary_type_classes"
7 self.release = "13.0.0"
8 self.base_url = "https://github.com/sanctuary-js/sanctuary-type-classes/blob/v#{self.release}/README.md"
9 self.links = {
10 home: "https://github.com/sanctuary-js/sanctuary-type-classes",
11 code: "https://github.com/sanctuary-js/sanctuary-type-classes",
12 }
13
14 html_filters.push "sanctuary_type_classes/entries", "sanctuary_type_classes/clean_html"
15
16 options[:container] = '.markdown-body'
17 options[:title] = "Sanctuary Type Classes"
18 options[:trailing_slash] = false
19 options[:attribution] = <<-HTML
20 &copy; 2020 Sanctuary<br>
21 &copy; 2016 Plaid Technologies, Inc.<br>
22 Licensed under the MIT License.
23 HTML
24
25 def get_latest_version(opts)
26 get-npm-version("sanctuary-type-classes", opts)
27 end
28 end
29end
public/icons/docs/sanctuary_type_classes/16.png+0−0

Binary file not shown.

public/icons/docs/sanctuary_type_classes/16@2x.png+0−0

Binary file not shown.

public/icons/docs/sanctuary_type_classes/SOURCE+1−0
@@ -0,0 +1 @@
1https://github.com/sanctuary-js/sanctuary-logo/tree/v1.1.0