diff --git a/assets/stylesheets/application.css.scss b/assets/stylesheets/application.css.scss index d54beb64..e2d717f3 100644 --- a/assets/stylesheets/application.css.scss +++ b/assets/stylesheets/application.css.scss @@ -115,6 +115,7 @@ 'pages/rust', 'pages/rxjs', 'pages/sanctuary', + 'pages/sanctuary_type_classes', 'pages/scala', 'pages/sinon', 'pages/sphinx', diff --git a/assets/stylesheets/pages/_sanctuary_type_classes.scss b/assets/stylesheets/pages/_sanctuary_type_classes.scss new file mode 100644 index 00000000..eb20d10a --- /dev/null +++ b/assets/stylesheets/pages/_sanctuary_type_classes.scss @@ -0,0 +1,7 @@ +._sanctuary_type_classes { + @extend %simple; + + pre > code { + font-size: inherit; + } +} diff --git a/lib/docs/filters/sanctuary_type_classes/clean_html.rb b/lib/docs/filters/sanctuary_type_classes/clean_html.rb new file mode 100644 index 00000000..247dbb39 --- /dev/null +++ b/lib/docs/filters/sanctuary_type_classes/clean_html.rb @@ -0,0 +1,20 @@ +module Docs + class SanctuaryTypeClasses + class CleanHtmlFilter < Filter + def call + # Make headers bigger by transforming them into a bigger variant + css('h3').each { |node| node.name = 'h2' } + css('h4').each { |node| + node.name = 'h3' + } + + # correct and unify link ids + css('h3').each { |node| + node.attributes["id"].value = node.text.split(' :: ')[0] + } + + doc + end + end + end +end diff --git a/lib/docs/filters/sanctuary_type_classes/entries.rb b/lib/docs/filters/sanctuary_type_classes/entries.rb new file mode 100644 index 00000000..25b04d25 --- /dev/null +++ b/lib/docs/filters/sanctuary_type_classes/entries.rb @@ -0,0 +1,29 @@ +module Docs + class SanctuaryTypeClasses + class EntriesFilter < Docs::EntriesFilter + # The entire reference is one big page, so get_name and get_type are not necessary + def additional_entries + entries = [] + type = "" + + css("h2, h4").each do |node| + case node.name + when "h2" + type = node.text + if node.attributes["id"].value == "type-class-hierarchy" + name = node.text + id = node.attributes["id"].value + entries << [name, id, type] + end + when "h4" + name = node.text.split(' :: ')[0] + id = name + entries << [name, id, type] + end + end + + entries + end + end + end +end diff --git a/lib/docs/scrapers/sanctuary_type_classes.rb b/lib/docs/scrapers/sanctuary_type_classes.rb new file mode 100644 index 00000000..5156e689 --- /dev/null +++ b/lib/docs/scrapers/sanctuary_type_classes.rb @@ -0,0 +1,29 @@ +module Docs + + class SanctuaryTypeClasses < Github + self.name = "Sanctuary Type Classes" + self.slug = "sanctuary_type_classes" + self.type = "sanctuary_type_classes" + self.release = "13.0.0" + self.base_url = "https://github.com/sanctuary-js/sanctuary-type-classes/blob/v#{self.release}/README.md" + self.links = { + home: "https://github.com/sanctuary-js/sanctuary-type-classes", + code: "https://github.com/sanctuary-js/sanctuary-type-classes", + } + + html_filters.push "sanctuary_type_classes/entries", "sanctuary_type_classes/clean_html" + + options[:container] = '.markdown-body' + options[:title] = "Sanctuary Type Classes" + options[:trailing_slash] = false + options[:attribution] = <<-HTML + © 2020 Sanctuary
+ © 2016 Plaid Technologies, Inc.
+ Licensed under the MIT License. + HTML + + def get_latest_version(opts) + get-npm-version("sanctuary-type-classes", opts) + end + end +end diff --git a/public/icons/docs/sanctuary_type_classes/16.png b/public/icons/docs/sanctuary_type_classes/16.png new file mode 100644 index 00000000..df0bbd4f Binary files /dev/null and b/public/icons/docs/sanctuary_type_classes/16.png differ diff --git a/public/icons/docs/sanctuary_type_classes/16@2x.png b/public/icons/docs/sanctuary_type_classes/16@2x.png new file mode 100644 index 00000000..0bf2b9f3 Binary files /dev/null and b/public/icons/docs/sanctuary_type_classes/16@2x.png differ diff --git a/public/icons/docs/sanctuary_type_classes/SOURCE b/public/icons/docs/sanctuary_type_classes/SOURCE new file mode 100644 index 00000000..4aba6a0d --- /dev/null +++ b/public/icons/docs/sanctuary_type_classes/SOURCE @@ -0,0 +1 @@ +https://github.com/sanctuary-js/sanctuary-logo/tree/v1.1.0