add Sanctuary

pull/1771/head
David Chambers 3 years ago
parent ac4131b791
commit 6510b06a36
No known key found for this signature in database
GPG Key ID: 9A9048E2885F5668

@ -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/v3.1.0/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,77 @@
._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);
color: #eee;
}
.pilcrow: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;
}
}

@ -0,0 +1,86 @@
def repeat(n, s)
Array.new(n, s).join("")
end
def _(n)
repeat(n, " ")
end
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) }
# 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|
if node.content.start_with?("! Invalid value")
# XXX: Reinstate newlines and consecutive spaces.
content = node.content.dup()
content[ 15] = "\n\n"
content[ 68] = "\n" + _("add :: FiniteNumber -> ".size)
content[104] = "\n" + _("add :: FiniteNumber -> ".size + ("FiniteNumber".size - 1) / 2)
content[134] = "\n\n"
content[138] = _(2)
content[155] = "\n\n"
content[215] = "\n\n"
content[337] = "\n"
content
else
node.content
end
})
.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,33 @@
module Docs
class EntryIndex
# Override to prevent sorting.
def entries_as_json
@entries.map(&:as_json)
end
# Override to prevent sorting.
def types_as_json
@types.values.map(&:as_json)
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,25 @@
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")
html_filters.push("sanctuary/clean_html")
options[:title] = "Sanctuary"
options[:attribution] = "Licensed under the MIT License."
def get_latest_version(opts)
get_npm_version("sanctuary", opts)
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