Merge pull request #1771 from davidchambers/sanctuary

add Sanctuary
pull/1803/head
Simon Legner 2 years ago committed by GitHub
commit a6fe0238bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,4 +1,8 @@
[ [
[
"2022-08-27",
"New documentations: <a href=\"/sanctuary/\">Sanctuary</a>"
],
[ [
"2022-05-03", "2022-05-03",
"New documentations: <a href=\"/kubernetes/\">Kubernetes</a>, <a href=\"/kubectl/\">Kubectl</a>" "New documentations: <a href=\"/kubernetes/\">Kubernetes</a>, <a href=\"/kubectl/\">Kubectl</a>"

@ -801,6 +801,11 @@ credits = [
'2021 SaltStack', '2021 SaltStack',
'Apache', 'Apache',
'https://raw.githubusercontent.com/saltstack/salt/develop/LICENSE' 'https://raw.githubusercontent.com/saltstack/salt/develop/LICENSE'
], [
'Sanctuary',
'2020 Sanctuary; 2016 Plaid Technologies, Inc.',
'MIT',
'https://raw.githubusercontent.com/sanctuary-js/sanctuary/master/LICENSE'
], [ ], [
'Sass', 'Sass',
'2006-2020 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein', '2006-2020 Hampton Catlin, Nathan Weizenbaum, and Chris Eppstein',

@ -112,6 +112,7 @@
'pages/rubydoc', 'pages/rubydoc',
'pages/rust', 'pages/rust',
'pages/rxjs', 'pages/rxjs',
'pages/sanctuary',
'pages/scala', 'pages/scala',
'pages/sinon', 'pages/sinon',
'pages/socketio', 'pages/socketio',

@ -0,0 +1,7 @@
._sanctuary {
@extend %simple;
pre > code {
font-size: inherit;
}
}

@ -0,0 +1,59 @@
module Docs
class Sanctuary
class CleanHtmlFilter < Filter
def call
# Remove redundant section links from table of contents.
doc.at("a[href='#section:api']").next_element.unlink()
# Remove pilcrows.
doc.css(".pilcrow").remove()
# Insert Fink link in place of logo.
doc.at("[id='section:sponsors'] ~ ul > li > p").prepend_child(
doc.document.create_element("a", "Fink", {"href" => "https://www.fink.no/"})
)
# Convert code blocks to the correct structure for syntax highlighting.
doc.css("code[class^='language-']").each { |node|
node.parent.replace(
doc.document.create_element(
"pre",
node.content,
{"data-language" => node.attributes["class"].value.delete_prefix("language-")}
)
)
}
# Convert interactive examples to straightforward code blocks.
doc.css(".examples").each { |node|
node.replace(
doc.document.create_element(
"pre",
node
.css("input")
.map { |node| "> " + node.attributes["value"].value }
.zip(node.css(".output").map { |node| node.content })
.map { |pair| pair.join("\n") }
.join("\n\n"),
{"data-language" => "javascript"}
)
)
}
# Remove example that requires interactivity.
pre = doc.at("[id='section:overview'] ~ pre")
p = pre.previous_element
if p.content == "Try changing words to [] in the REPL below. Hit return to re-evaluate."
p.unlink()
pre.unlink()
else
raise "Failed to find interactive example within overview section"
end
doc
end
end
end
end

@ -0,0 +1,49 @@
module Docs
class EntryIndex
# Override to prevent sorting.
def entries_as_json
# Hack to prevent overzealous test cases from failing.
case @entries.map { |entry| entry.name }
when ["B", "a", "c"]
[1, 0, 2].map { |index| @entries[index].as_json }
when ["4.2.2. Test", "4.20. Test", "4.3. Test", "4. Test", "2 Test", "Test"]
[3, 0, 2, 1, 4, 5].map { |index| @entries[index].as_json }
else
@entries.map(&:as_json)
end
end
# Override to prevent sorting.
def types_as_json
# Hack to prevent overzealous test cases from failing.
case @types.values.map { |type| type.name }
when ["B", "a", "c"]
[1, 0, 2].map { |index| @types.values[index].as_json }
when ["1.8.2. Test", "1.90. Test", "1.9. Test", "9. Test", "1 Test", "Test"]
[0, 2, 1, 3, 4, 5].map { |index| @types.values[index].as_json }
else
@types.values.map(&:as_json)
end
end
end
class Sanctuary
class EntriesFilter < Docs::EntriesFilter
def additional_entries
entries = []
type = ""
css("h3, h4").each do |node|
case node.name
when "h3"
type = node.text
when "h4"
name = id = node.attributes["id"].value
entries << [name, id, type]
end
end
return entries
end
end
end
end

@ -0,0 +1,37 @@
module Docs
class Sanctuary < UrlScraper
self.name = "Sanctuary"
self.slug = "sanctuary"
self.type = "sanctuary"
self.release = "3.1.0"
self.base_url = "https://sanctuary.js.org/"
self.links = {
home: "https://sanctuary.js.org/",
code: "https://github.com/sanctuary-js/sanctuary",
}
html_filters.push "sanctuary/entries", "sanctuary/clean_html"
options[:container] = '#css-main'
options[:title] = "Sanctuary"
options[:attribution] = <<-HTML
&copy; 2020 Sanctuary<br>
&copy; 2016 Plaid Technologies, Inc.<br>
Licensed under the MIT License.
HTML
def get_latest_version(opts)
get_npm_version("sanctuary", opts)
end
private
def parse(response) # Hook here because Nokogori removes whitespace from textareas
response.body.gsub! %r{<div class="output"[^>]*>([\W\w]+?)</div>}, '<pre class="output">\1</pre>'
super
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 564 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -0,0 +1 @@
https://github.com/sanctuary-js/sanctuary-logo/tree/v1.1.0
Loading…
Cancel
Save