2016-10-03 21:19:13 +03:00
|
|
|
//- 💫 INCLUDES > MIXINS
|
2016-03-31 17:24:48 +03:00
|
|
|
|
2016-10-03 21:19:13 +03:00
|
|
|
include _functions
|
2017-10-30 15:15:13 +03:00
|
|
|
|
|
|
|
|
|
|
|
//- Section
|
|
|
|
id - [string] anchor assigned to section (used for breadcrumb navigation)
|
|
|
|
|
|
|
|
mixin section(id)
|
2018-04-29 03:06:46 +03:00
|
|
|
section.o-section(id=id ? "section-" + id : null data-section=id)&attributes(attributes)
|
2017-10-30 15:15:13 +03:00
|
|
|
block
|
|
|
|
|
|
|
|
|
2017-11-05 18:08:13 +03:00
|
|
|
//- Accordion (collapsible sections)
|
|
|
|
title - [string] Section title.
|
|
|
|
id - [string] Optional section ID for permalinks.
|
|
|
|
level - [integer] Headline level for section title.
|
|
|
|
|
|
|
|
mixin accordion(title, id, level)
|
|
|
|
section.o-accordion.o-block
|
|
|
|
+h(level || 4).o-no-block(id=id)
|
|
|
|
button.o-accordion__button.o-grid.o-grid--vcenter.o-grid--space.js-accordion(aria-expanded="false")=title
|
|
|
|
svg.o-accordion__icon(width="20" height="20" viewBox="0 0 10 10" aria-hidden="true" focusable="false")
|
|
|
|
rect.o-accordion__hide(height="8" width="2" y="1" x="4")
|
|
|
|
rect(height="2" width="8" y="4" x="1")
|
|
|
|
|
|
|
|
.o-accordion__content(hidden="")
|
|
|
|
block
|
|
|
|
|
|
|
|
|
2017-10-30 15:15:13 +03:00
|
|
|
//- Headlines Helper Mixin
|
|
|
|
level - [integer] 1, 2, 3, 4, or 5
|
|
|
|
|
|
|
|
mixin headline(level)
|
|
|
|
if level == 1
|
|
|
|
h1.u-heading-1&attributes(attributes)
|
|
|
|
block
|
|
|
|
|
|
|
|
else if level == 2
|
|
|
|
h2.u-heading-2&attributes(attributes)
|
|
|
|
block
|
|
|
|
|
|
|
|
else if level == 3
|
|
|
|
h3.u-heading-3&attributes(attributes)
|
|
|
|
block
|
|
|
|
|
|
|
|
else if level == 4
|
|
|
|
h4.u-heading-4&attributes(attributes)
|
|
|
|
block
|
|
|
|
|
|
|
|
else if level == 5
|
|
|
|
h5.u-heading-5&attributes(attributes)
|
|
|
|
block
|
2016-03-31 17:24:48 +03:00
|
|
|
|
2016-10-31 21:04:15 +03:00
|
|
|
|
|
|
|
//- Headlines
|
|
|
|
level - [integer] headline level, corresponds to h1, h2, h3 etc.
|
|
|
|
id - [string] unique identifier, creates permalink (optional)
|
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
mixin h(level, id, source)
|
|
|
|
+headline(level).u-heading(id=id)&attributes(attributes)
|
2016-10-31 21:04:15 +03:00
|
|
|
+permalink(id)
|
|
|
|
block
|
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
if source
|
|
|
|
+button(gh("spacy", source), false, "secondary", "small").u-nowrap.u-float-right
|
|
|
|
span Source #[+icon("code", 14).o-icon--inline]
|
|
|
|
|
2016-10-31 21:04:15 +03:00
|
|
|
|
2017-10-30 15:15:13 +03:00
|
|
|
//- Permalink rendering
|
|
|
|
id - [string] permalink ID used for link anchor
|
|
|
|
|
|
|
|
mixin permalink(id)
|
|
|
|
if id
|
|
|
|
a.u-permalink(href="##{id}")
|
|
|
|
block
|
|
|
|
|
|
|
|
else
|
|
|
|
block
|
|
|
|
|
|
|
|
|
2016-10-31 21:04:15 +03:00
|
|
|
//- External links
|
|
|
|
url - [string] link href
|
|
|
|
trusted - [boolean] if not set / false, rel="noopener nofollow" is added
|
|
|
|
info: https://mathiasbynens.github.io/rel-noopener/
|
|
|
|
|
|
|
|
mixin a(url, trusted)
|
2016-12-24 14:24:04 +03:00
|
|
|
- external = url.includes("http")
|
|
|
|
a(href=url target=external ? "_blank" : null rel=external && !trusted ? "noopener nofollow" : null)&attributes(attributes)
|
2016-10-31 21:04:15 +03:00
|
|
|
block
|
|
|
|
|
2016-12-18 19:40:20 +03:00
|
|
|
|
2016-10-31 21:04:15 +03:00
|
|
|
//- Source link (with added icon for "code")
|
|
|
|
url - [string] link href, can also be gh() function to generate GitHub link
|
|
|
|
see _functions.jade for more info
|
|
|
|
|
|
|
|
mixin src(url)
|
2016-12-18 19:41:03 +03:00
|
|
|
span.u-inline-block.u-nowrap
|
|
|
|
+a(url)
|
|
|
|
block
|
2016-10-31 21:04:15 +03:00
|
|
|
|
2017-05-19 02:05:16 +03:00
|
|
|
| #[+icon("code", 16).o-icon--inline.u-color-theme]
|
2016-10-31 21:04:15 +03:00
|
|
|
|
|
|
|
|
|
|
|
//- API link (with added tag and automatically generated path)
|
2017-10-03 15:20:13 +03:00
|
|
|
path - [string] path to API docs page relative to /api/
|
2016-10-31 21:04:15 +03:00
|
|
|
|
|
|
|
mixin api(path)
|
2017-10-03 15:20:13 +03:00
|
|
|
- path = convertAPIPath(path)
|
|
|
|
+a("/api/" + path, true)(target="_self").u-no-border.u-inline-block.u-nowrap
|
2016-10-31 21:04:15 +03:00
|
|
|
block
|
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
| #[+icon("book", 16).o-icon--inline.u-color-theme]
|
2016-10-31 21:04:15 +03:00
|
|
|
|
|
|
|
|
2017-05-17 12:38:35 +03:00
|
|
|
//- Help icon with tooltip
|
2017-10-03 15:20:13 +03:00
|
|
|
tooltip - [string] Tooltip text
|
|
|
|
icon_size - [integer] Optional size of help icon in px.
|
2017-05-17 12:38:35 +03:00
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
mixin help(tooltip, icon_size)
|
2017-05-17 12:38:35 +03:00
|
|
|
span(data-tooltip=tooltip)&attributes(attributes)
|
2017-10-29 02:17:49 +03:00
|
|
|
if tooltip
|
|
|
|
span.u-hidden(aria-role="tooltip")=tooltip
|
|
|
|
+icon("help_o", icon_size || 16).o-icon--inline
|
2017-05-17 12:38:35 +03:00
|
|
|
|
|
|
|
|
2017-10-30 15:15:13 +03:00
|
|
|
//- Aside wrapper
|
|
|
|
label - [string] aside label
|
|
|
|
|
2017-11-07 02:23:00 +03:00
|
|
|
mixin aside-wrapper(label, emoji)
|
2017-10-30 15:15:13 +03:00
|
|
|
aside.c-aside
|
|
|
|
.c-aside__content(role="complementary")&attributes(attributes)
|
|
|
|
if label
|
2017-11-07 02:23:00 +03:00
|
|
|
h4.u-text-label.u-text-label--dark
|
|
|
|
if emoji
|
|
|
|
span.o-emoji=emoji
|
|
|
|
| #{label}
|
2017-10-30 15:15:13 +03:00
|
|
|
block
|
|
|
|
|
|
|
|
|
2016-10-31 21:04:15 +03:00
|
|
|
//- Aside for text
|
|
|
|
label - [string] aside title (optional)
|
|
|
|
|
2017-11-07 02:23:00 +03:00
|
|
|
mixin aside(label, emoji)
|
|
|
|
+aside-wrapper(label, emoji)
|
2018-04-29 03:06:46 +03:00
|
|
|
.c-aside__text.u-text-small&attributes(attributes)
|
2016-10-31 21:04:15 +03:00
|
|
|
block
|
|
|
|
|
|
|
|
|
|
|
|
//- Aside for code
|
|
|
|
label - [string] aside title (optional or false for no label)
|
|
|
|
language - [string] language for syntax highlighting (default: "python")
|
|
|
|
supports basic relevant languages available for PrismJS
|
2017-10-03 15:20:13 +03:00
|
|
|
prompt - [string] prompt displayed before first line, e.g. "$"
|
2016-10-31 21:04:15 +03:00
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
mixin aside-code(label, language, prompt)
|
2018-04-29 03:06:46 +03:00
|
|
|
+aside-wrapper(label)&attributes(attributes)
|
2017-10-03 15:20:13 +03:00
|
|
|
+code(false, language, prompt).o-no-block
|
2016-10-31 21:04:15 +03:00
|
|
|
block
|
|
|
|
|
|
|
|
|
2017-03-16 23:53:15 +03:00
|
|
|
//- Infobox
|
|
|
|
label - [string] infobox title (optional or false for no title)
|
2017-10-03 15:20:13 +03:00
|
|
|
emoji - [string] optional emoji displayed before the title, necessary as
|
|
|
|
argument to be able to wrap it for spacing
|
2017-03-16 23:53:15 +03:00
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
mixin infobox(label, emoji)
|
2018-04-29 03:06:46 +03:00
|
|
|
aside.o-box.o-block.u-text-small&attributes(attributes)
|
2017-03-16 23:53:15 +03:00
|
|
|
if label
|
2017-10-03 15:20:13 +03:00
|
|
|
h3.u-heading.u-text-label.u-color-theme
|
|
|
|
if emoji
|
|
|
|
span.o-emoji=emoji
|
|
|
|
| #{label}
|
2017-03-16 23:53:15 +03:00
|
|
|
|
|
|
|
block
|
|
|
|
|
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
//- Logos displayed in the top corner of some infoboxes
|
|
|
|
logos - [array] List of icon ID, width, height and link.
|
|
|
|
|
|
|
|
mixin infobox-logos(...logos)
|
|
|
|
.o-box__logos.u-text-right.u-float-right
|
|
|
|
for logo in logos
|
|
|
|
if logo[3]
|
|
|
|
| #[+a(logo[3]).u-inline-block.u-hide-link.u-padding-small #[+icon(logo[0], logo[1], logo[2]).u-color-dark]]
|
|
|
|
else
|
|
|
|
| #[+icon(logo[0], logo[1], logo[2]).u-color-dark]
|
|
|
|
|
|
|
|
|
2017-10-30 15:15:13 +03:00
|
|
|
//- SVG from map (uses embedded SVG sprite)
|
|
|
|
name - [string] SVG symbol id
|
|
|
|
width - [integer] width in px
|
|
|
|
height - [integer] height in px (default: same as width)
|
|
|
|
|
|
|
|
mixin svg(name, width, height)
|
|
|
|
svg(aria-hidden="true" viewBox="0 0 #{width} #{height || width}" width=width height=(height || width))&attributes(attributes)
|
|
|
|
use(xlink:href="#svg_#{name}")
|
|
|
|
|
|
|
|
|
|
|
|
//- Icon
|
|
|
|
name - [string] icon name (will be used as symbol id: #svg_{name})
|
|
|
|
width - [integer] icon width (default: 20)
|
|
|
|
height - [integer] icon height (defaults to width)
|
|
|
|
|
|
|
|
mixin icon(name, width, height)
|
|
|
|
- var width = width || 20
|
|
|
|
- var height = height || width
|
|
|
|
+svg(name, width, height).o-icon(style="min-width: #{width}px")&attributes(attributes)
|
|
|
|
|
|
|
|
|
|
|
|
//- Pro/Con/Neutral icon
|
|
|
|
icon - [string] "pro", "con" or "neutral" (default: "neutral")
|
|
|
|
size - [integer] icon size (optional)
|
|
|
|
|
|
|
|
mixin procon(icon, label, show_label, size)
|
|
|
|
- var colors = { yes: "green", no: "red", neutral: "subtle" }
|
|
|
|
span.u-nowrap
|
|
|
|
+icon(icon, size || 20)(class="u-color-#{colors[icon] || 'subtle'}").o-icon--inline&attributes(attributes)
|
|
|
|
span.u-text-small(class=show_label ? null : "u-hidden")=(label || icon)
|
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
|
2016-10-31 21:04:15 +03:00
|
|
|
//- Link button
|
|
|
|
url - [string] link href
|
|
|
|
trusted - [boolean] if not set / false, rel="noopener nofollow" is added
|
|
|
|
info: https://mathiasbynens.github.io/rel-noopener/
|
|
|
|
...style - all other arguments are added as class names c-button--argument
|
|
|
|
see assets/css/_components/_buttons.sass
|
|
|
|
|
|
|
|
mixin button(url, trusted, ...style)
|
2017-10-03 15:20:13 +03:00
|
|
|
- external = url && url.includes("http")
|
2016-12-24 14:24:04 +03:00
|
|
|
a.c-button.u-text-label(href=url class=prefixArgs(style, "c-button") role="button" target=external ? "_blank" : null rel=external && !trusted ? "noopener nofollow" : null)&attributes(attributes)
|
2016-10-31 21:04:15 +03:00
|
|
|
block
|
|
|
|
|
|
|
|
|
|
|
|
//- Code block
|
|
|
|
label - [string] aside title (optional or false for no label)
|
|
|
|
language - [string] language for syntax highlighting (default: "python")
|
|
|
|
supports basic relevant languages available for PrismJS
|
2017-10-03 15:20:13 +03:00
|
|
|
prompt - [string] prompt displayed before first line, e.g. "$"
|
2017-05-24 00:13:26 +03:00
|
|
|
height - [integer] optional height to clip code block to
|
2017-10-03 15:20:13 +03:00
|
|
|
icon - [string] icon displayed next to code block (e.g. "accept" for new code)
|
|
|
|
wrap - [boolean] wrap text and disable horizontal scrolling
|
2016-10-31 21:04:15 +03:00
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
mixin code(label, language, prompt, height, icon, wrap)
|
2018-04-29 03:06:46 +03:00
|
|
|
- var lang = (language != "none") ? (language || DEFAULT_SYNTAX) : null
|
|
|
|
- var lang_class = (language != "none") ? "lang-" + (language || DEFAULT_SYNTAX) : null
|
|
|
|
pre.c-code-block.o-block(data-language=lang class=lang_class class=icon ? "c-code-block--has-icon" : null style=height ? "height: #{height}px" : null)&attributes(attributes)
|
2016-10-31 21:04:15 +03:00
|
|
|
if label
|
|
|
|
h4.u-text-label.u-text-label--dark=label
|
2017-05-21 14:22:34 +03:00
|
|
|
if icon
|
|
|
|
- var classes = {'accept': 'u-color-green', 'reject': 'u-color-red'}
|
2017-06-01 19:57:02 +03:00
|
|
|
.c-code-block__icon(class=classes[icon] || null class=classes[icon] ? "c-code-block__icon--border" : null)
|
2017-05-21 14:22:34 +03:00
|
|
|
+icon(icon, 18)
|
|
|
|
|
2017-11-06 22:16:19 +03:00
|
|
|
code.c-code-block__content(class=wrap ? "u-wrap" : null data-prompt=prompt)
|
2016-10-31 21:04:15 +03:00
|
|
|
block
|
|
|
|
|
2018-04-29 03:06:46 +03:00
|
|
|
//- Executable code
|
|
|
|
|
|
|
|
mixin code-exec(label, large)
|
|
|
|
- label = (label || "Editable code example") + " (experimental)"
|
|
|
|
+terminal-wrapper(label, !large)
|
2018-04-30 19:48:35 +03:00
|
|
|
figure.juniper-wrapper
|
|
|
|
span.juniper-wrapper__text.u-text-tiny v#{BINDER_VERSION} · Python 3 · via #[+a("https://mybinder.org/").u-hide-link Binder]
|
2018-04-29 03:06:46 +03:00
|
|
|
+code(data-executable="true")&attributes(attributes)
|
|
|
|
block
|
2016-10-31 21:04:15 +03:00
|
|
|
|
2017-10-29 02:17:49 +03:00
|
|
|
//- Wrapper for code blocks to display old/new versions
|
2017-05-21 14:22:34 +03:00
|
|
|
|
2017-10-10 05:22:23 +03:00
|
|
|
mixin code-wrapper()
|
2017-10-09 15:36:20 +03:00
|
|
|
span.u-inline-block.u-padding-top.u-width-full
|
|
|
|
block
|
|
|
|
|
2017-10-29 02:17:49 +03:00
|
|
|
//- Code blocks to display old/new versions
|
|
|
|
label - [string] ARIA label for block. Defaults to "correct"/"incorrect".
|
|
|
|
|
2017-11-06 22:16:19 +03:00
|
|
|
mixin code-old(label, lang, prompt)
|
2017-10-29 02:17:49 +03:00
|
|
|
- var label = label || 'incorrect'
|
2017-11-06 22:16:19 +03:00
|
|
|
+code(false, lang, prompt, false, "reject").o-block-small(aria-label=label)
|
2017-05-21 14:22:34 +03:00
|
|
|
block
|
|
|
|
|
2017-11-06 22:16:19 +03:00
|
|
|
mixin code-new(label, lang, prompt)
|
2017-10-29 02:17:49 +03:00
|
|
|
- var label = label || 'correct'
|
2017-11-06 22:16:19 +03:00
|
|
|
+code(false, lang, prompt, false, "accept").o-block-small(aria-label=label)
|
2017-05-21 14:22:34 +03:00
|
|
|
block
|
|
|
|
|
|
|
|
|
2016-11-25 04:29:48 +03:00
|
|
|
//- CodePen embed
|
|
|
|
slug - [string] ID of CodePen demo (taken from URL)
|
|
|
|
height - [integer] height of demo embed iframe
|
|
|
|
default_tab - [string] code tab(s) visible on load (default: "result")
|
|
|
|
|
|
|
|
mixin codepen(slug, height, default_tab)
|
|
|
|
figure.o-block(style="min-height: #{height}px")&attributes(attributes)
|
2017-10-03 15:20:13 +03:00
|
|
|
.codepen(data-height=height data-theme-id="31335" data-slug-hash=slug data-default-tab=(default_tab || "result") data-embed-version="2" data-user=SOCIAL.codepen)
|
2016-11-25 04:29:48 +03:00
|
|
|
+a("https://codepen.io/" + SOCIAL.codepen + "/" + slug) View on CodePen
|
|
|
|
|
|
|
|
script(async src="https://assets.codepen.io/assets/embed/ei.js")
|
|
|
|
|
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
//- GitHub embed
|
|
|
|
repo - [string] repository owned by explosion organization
|
|
|
|
file - [string] logical path to file, relative to repository root
|
|
|
|
alt_file - [string] alternative file path used in footer and link button
|
|
|
|
height - [integer] height of code preview in px
|
|
|
|
|
2017-10-27 13:30:59 +03:00
|
|
|
mixin github(repo, file, height, alt_file, language)
|
2017-10-03 15:20:13 +03:00
|
|
|
- var branch = ALPHA ? "develop" : "master"
|
|
|
|
- var height = height || 250
|
|
|
|
|
|
|
|
figure.o-block
|
|
|
|
pre.c-code-block.o-block-small(class="lang-#{(language || DEFAULT_SYNTAX)}" style="height: #{height}px; min-height: #{height}px")
|
2017-10-30 18:16:19 +03:00
|
|
|
code.c-code-block__content(data-gh-embed="#{repo}/#{branch}/#{file}").
|
|
|
|
Can't fetch code example from GitHub :(
|
|
|
|
|
|
|
|
Please use the link below to view the example. If you've come across
|
|
|
|
a broken link, we always appreciate a pull request to the repository,
|
|
|
|
or a report on the issue tracker. Thanks!
|
2017-10-03 15:20:13 +03:00
|
|
|
|
|
|
|
footer.o-grid.u-text
|
2017-10-14 13:51:52 +03:00
|
|
|
.o-block-small.u-flex-full.u-padding-small #[+icon("github")] #[code.u-break.u-break--all=repo + '/' + (alt_file || file)]
|
2017-10-03 15:20:13 +03:00
|
|
|
div
|
|
|
|
+button(gh(repo, alt_file || file), false, "primary", "small") View on GitHub
|
|
|
|
|
|
|
|
|
2017-11-13 10:29:57 +03:00
|
|
|
//- Youtube video embed
|
|
|
|
id - [string] ID of YouTube video.
|
|
|
|
ratio - [string] Video ratio, "16x9" or "4x3".
|
|
|
|
|
|
|
|
mixin youtube(id, ratio)
|
|
|
|
figure.o-video.o-block(class="o-video--" + (ratio || "16x9"))
|
|
|
|
iframe.o-video__iframe(src="https://www.youtube.com/embed/#{id}" frameborder="0" height="500" allowfullscreen)
|
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
|
2016-10-31 21:04:15 +03:00
|
|
|
//- Images / figures
|
|
|
|
url - [string] url or path to image
|
|
|
|
width - [integer] image width in px, for better rendering (default: 500)
|
|
|
|
caption - [string] image caption
|
|
|
|
alt - [string] alternative image text, defaults to caption
|
|
|
|
|
|
|
|
mixin image(url, width, caption, alt)
|
|
|
|
figure.o-block&attributes(attributes)
|
2017-05-13 04:10:35 +03:00
|
|
|
if url
|
|
|
|
img(src=url alt=(alt || caption) width="#{width || 500}")
|
2016-10-31 21:04:15 +03:00
|
|
|
|
|
|
|
if caption
|
|
|
|
+image-caption=caption
|
|
|
|
|
2017-05-13 04:10:35 +03:00
|
|
|
block
|
2016-10-31 21:04:15 +03:00
|
|
|
|
2017-05-13 13:02:39 +03:00
|
|
|
|
2016-10-31 21:04:15 +03:00
|
|
|
//- Image caption
|
|
|
|
|
|
|
|
mixin image-caption()
|
|
|
|
figcaption.u-text-small.u-color-subtle.u-padding-small&attributes(attributes)
|
|
|
|
block
|
|
|
|
|
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
//- Graphic or illustration with button
|
|
|
|
original - [string] Path to original image
|
|
|
|
|
|
|
|
mixin graphic(original)
|
|
|
|
+image
|
|
|
|
block
|
|
|
|
if original
|
|
|
|
.u-text-right
|
|
|
|
+button(original, false, "secondary", "small") View large graphic
|
|
|
|
|
|
|
|
|
2017-10-30 15:15:13 +03:00
|
|
|
//- Chart.js
|
|
|
|
id - [string] chart ID, will be assigned as #chart_{id}
|
|
|
|
|
|
|
|
mixin chart(id, height)
|
|
|
|
figure.o-block&attributes(attributes)
|
|
|
|
canvas(id="chart_#{id}" width="800" height=(height || "400") style="max-width: 100%")
|
|
|
|
|
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
//- Labels
|
2016-10-31 21:04:15 +03:00
|
|
|
|
|
|
|
mixin label()
|
2017-10-03 15:20:13 +03:00
|
|
|
.u-text-label.u-color-dark&attributes(attributes)
|
|
|
|
block
|
|
|
|
|
|
|
|
|
|
|
|
mixin label-inline()
|
|
|
|
strong.u-text-label.u-color-dark&attributes(attributes)
|
2016-10-31 21:04:15 +03:00
|
|
|
block
|
|
|
|
|
|
|
|
|
|
|
|
//- Tag
|
2017-10-29 02:17:49 +03:00
|
|
|
tooltip - [string] optional tooltip text.
|
|
|
|
hide_icon - [boolean] hide tooltip icon
|
2016-10-31 21:04:15 +03:00
|
|
|
|
2017-10-29 02:17:49 +03:00
|
|
|
mixin tag(tooltip, hide_icon)
|
|
|
|
div.u-text-tag.u-text-tag--spaced(data-tooltip=tooltip)&attributes(attributes)
|
2016-10-31 21:04:15 +03:00
|
|
|
block
|
2017-10-29 02:17:49 +03:00
|
|
|
if tooltip
|
|
|
|
if !hide_icon
|
|
|
|
| #[+icon("help", 12).o-icon--tag]
|
|
|
|
| #[span.u-hidden(aria-role="tooltip")=tooltip]
|
2016-10-31 21:04:15 +03:00
|
|
|
|
|
|
|
|
2017-05-19 21:24:17 +03:00
|
|
|
//- "Requires model" tag with tooltip and list of capabilities
|
|
|
|
...capabs - [string] Required model capabilities, e.g. "vectors".
|
|
|
|
|
|
|
|
mixin tag-model(...capabs)
|
|
|
|
- var intro = "To use this functionality, spaCy needs a model to be installed"
|
2017-05-21 02:12:30 +03:00
|
|
|
- var ext = capabs.length ? " that supports the following capabilities: " + capabs.join(', ') : ""
|
2017-10-29 02:17:49 +03:00
|
|
|
+tag(intro + ext + ".") Needs model
|
2017-05-19 21:24:17 +03:00
|
|
|
|
|
|
|
|
2017-05-26 13:42:36 +03:00
|
|
|
//- "New" tag to label features new in a specific version
|
|
|
|
By using a separate mixin with a version ID, it becomes easy to quickly
|
|
|
|
enable/disable tags without having to modify the markup in the docs.
|
|
|
|
version - [string or integer] version number, without "v" prefix
|
|
|
|
|
|
|
|
mixin tag-new(version)
|
|
|
|
- var version = (typeof version == 'number') ? version.toFixed(1) : version
|
2017-10-29 02:17:49 +03:00
|
|
|
- var tooltip = "This feature is new and was introduced in spaCy v" + version
|
|
|
|
+tag(tooltip, true) v#{version}
|
2017-05-26 13:42:36 +03:00
|
|
|
|
|
|
|
|
2016-10-31 21:04:15 +03:00
|
|
|
//- List
|
|
|
|
type - [string] "numbers", "letters", "roman" (bulleted list if none set)
|
|
|
|
start - [integer] start number
|
|
|
|
|
|
|
|
mixin list(type, start)
|
|
|
|
if type
|
2016-12-24 14:24:04 +03:00
|
|
|
ol.c-list.o-block.u-text(class="c-list--#{type}" style=(start === 0 || start) ? "counter-reset: li #{(start - 1)}" : null)&attributes(attributes)
|
2016-10-31 21:04:15 +03:00
|
|
|
block
|
|
|
|
|
|
|
|
else
|
|
|
|
ul.c-list.c-list--bullets.o-block.u-text&attributes(attributes)
|
|
|
|
block
|
|
|
|
|
|
|
|
|
|
|
|
//- List item (only used within +list)
|
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
mixin item()
|
|
|
|
li.c-list__item&attributes(attributes)
|
|
|
|
block
|
2016-10-31 21:04:15 +03:00
|
|
|
|
|
|
|
|
|
|
|
//- Table
|
|
|
|
head - [array] table headings (should match number of columns)
|
|
|
|
|
|
|
|
mixin table(head)
|
|
|
|
table.c-table.o-block&attributes(attributes)
|
|
|
|
|
|
|
|
if head
|
2017-10-03 15:20:13 +03:00
|
|
|
+row("head")
|
2016-10-31 21:04:15 +03:00
|
|
|
each column in head
|
2017-10-03 15:20:13 +03:00
|
|
|
+head-cell=column
|
2016-10-31 21:04:15 +03:00
|
|
|
|
|
|
|
block
|
|
|
|
|
|
|
|
|
|
|
|
//- Table row (only used within +table)
|
|
|
|
|
2017-04-26 17:02:59 +03:00
|
|
|
mixin row(...style)
|
|
|
|
tr.c-table__row(class=prefixArgs(style, "c-table__row"))&attributes(attributes)
|
2016-10-31 21:04:15 +03:00
|
|
|
block
|
|
|
|
|
|
|
|
|
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
//- Header table cell (only used within +row)
|
|
|
|
|
|
|
|
mixin head-cell()
|
|
|
|
th.c-table__head-cell.u-text-label&attributes(attributes)
|
2016-10-31 21:04:15 +03:00
|
|
|
block
|
|
|
|
|
|
|
|
|
|
|
|
//- Table cell (only used within +row in +table)
|
|
|
|
|
2017-11-06 21:36:02 +03:00
|
|
|
mixin cell(...style)
|
|
|
|
td.c-table__cell.u-text(class=prefixArgs(style, "c-table__cell"))&attributes(attributes)
|
2016-10-31 21:04:15 +03:00
|
|
|
block
|
|
|
|
|
|
|
|
|
|
|
|
//- Grid Container
|
2016-11-04 00:06:09 +03:00
|
|
|
...style - all arguments are added as class names o-grid--argument
|
|
|
|
see assets/css/_base/_grid.sass
|
2016-10-31 21:04:15 +03:00
|
|
|
|
2016-11-04 00:06:09 +03:00
|
|
|
mixin grid(...style)
|
|
|
|
.o-grid.o-block(class=prefixArgs(style, "o-grid"))&attributes(attributes)
|
2016-10-31 21:04:15 +03:00
|
|
|
block
|
|
|
|
|
|
|
|
|
|
|
|
//- Grid Column (only used within +grid)
|
|
|
|
width - [string] "quarter", "third", "half", "two-thirds", "three-quarters"
|
|
|
|
see $grid in assets/css/_variables.sass
|
|
|
|
|
2017-10-30 15:15:30 +03:00
|
|
|
mixin grid-col(...style)
|
|
|
|
.o-grid__col(class=prefixArgs(style, "o-grid__col"))&attributes(attributes)
|
2016-10-31 21:04:15 +03:00
|
|
|
block
|
|
|
|
|
|
|
|
|
|
|
|
//- Card (only used within +grid)
|
2017-10-03 15:20:13 +03:00
|
|
|
title - [string] card title
|
|
|
|
url - [string] link for card
|
|
|
|
author - [string] optional author, displayed as byline at the bottom
|
|
|
|
icon - [string] optional ID of icon displayed with card
|
|
|
|
width - [string] optional width of grid column, defaults to "half"
|
|
|
|
|
|
|
|
mixin card(title, url, author, icon, width)
|
|
|
|
+grid-col(width || "half").o-box.o-grid.o-grid--space.u-text&attributes(attributes)
|
|
|
|
+a(url)
|
|
|
|
h4.u-heading.u-text-label
|
|
|
|
if icon
|
|
|
|
+icon(icon, 25).u-float-right
|
|
|
|
if title
|
|
|
|
span.u-color-dark=title
|
|
|
|
.o-block-small.u-text-small
|
|
|
|
block
|
|
|
|
if author
|
|
|
|
.u-color-subtle.u-text-tiny by #{author}
|
2016-10-31 21:04:15 +03:00
|
|
|
|
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
//- Table of contents, to be used with +item mixins for links
|
|
|
|
col - [string] width of column (see +grid-col)
|
2016-10-31 21:04:15 +03:00
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
mixin table-of-contents(col)
|
|
|
|
+grid-col(col || "half")
|
|
|
|
+infobox
|
|
|
|
+label.o-block-small Table of contents
|
|
|
|
+list("numbers").u-text-small.o-no-block
|
|
|
|
block
|
2016-10-31 21:04:15 +03:00
|
|
|
|
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
//- Bibliography
|
|
|
|
id - [string] ID of bibliography component, for anchor links. Can be used if
|
|
|
|
there's more than one bibliography on one page.
|
2017-04-26 17:03:17 +03:00
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
mixin bibliography(id)
|
|
|
|
section(id=id || "bibliography")
|
|
|
|
+infobox
|
|
|
|
+label.o-block-small Bibliography
|
|
|
|
+list("numbers").u-text-small.o-no-block
|
|
|
|
block
|
2017-04-26 17:03:17 +03:00
|
|
|
|
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
//- Footnote
|
|
|
|
id - [string / integer] ID of footnote.
|
|
|
|
bib_id - [string] ID of bibliography component, defaults to "bibliography".
|
|
|
|
tooltip - [string] optional text displayed as tooltip
|
2017-04-26 17:03:17 +03:00
|
|
|
|
2017-10-03 15:20:13 +03:00
|
|
|
mixin fn(id, bib_id, tooltip)
|
|
|
|
sup.u-padding-small(id="bib" + id data-tooltip=tooltip)
|
|
|
|
span.u-text-tag
|
|
|
|
+a("#" + (bib_id || "bibliography")).u-hide-link #{id}
|
2017-05-03 20:40:08 +03:00
|
|
|
|
|
|
|
|
|
|
|
//- Table rows for annotation specs
|
|
|
|
|
|
|
|
mixin pos-row(tag, pos, morph, desc)
|
|
|
|
+row
|
2017-11-05 20:16:16 +03:00
|
|
|
+cell #[code(class=(tag.length > 10) ? "u-break u-break--all" : null)=tag]
|
2017-05-03 20:40:08 +03:00
|
|
|
+cell #[code=pos]
|
|
|
|
+cell
|
2017-11-05 20:16:16 +03:00
|
|
|
- var morphs = morph.includes("|") ? morph.split("|") : morph.split(" ")
|
|
|
|
for m in morphs
|
2017-05-03 20:40:08 +03:00
|
|
|
if m
|
|
|
|
| #[code=m]
|
|
|
|
+cell.u-text-small=desc
|
|
|
|
|
2017-11-05 20:46:24 +03:00
|
|
|
mixin ud-row(tag, desc, example)
|
2017-11-05 20:16:16 +03:00
|
|
|
+row
|
|
|
|
+cell #[code=tag]
|
|
|
|
+cell.u-text-small=desc
|
2017-11-05 20:46:24 +03:00
|
|
|
if example
|
|
|
|
+cell.u-text-small
|
|
|
|
em=example
|
2017-05-24 00:13:37 +03:00
|
|
|
|
2017-05-03 20:40:08 +03:00
|
|
|
mixin dep-row(label, desc)
|
|
|
|
+row
|
|
|
|
+cell #[code=label]
|
|
|
|
+cell=desc
|
2017-05-24 00:13:37 +03:00
|
|
|
|
|
|
|
|
|
|
|
//- Table rows for linguistic annotations
|
|
|
|
annots [array] - array of cell content
|
|
|
|
style [array] array of 1 (display as code) or 0 (display as text)
|
|
|
|
|
|
|
|
mixin annotation-row(annots, style)
|
|
|
|
+row
|
|
|
|
for cell, i in annots
|
|
|
|
if style && style[i]
|
|
|
|
- cell = (typeof(cell) != 'boolean') ? cell : cell ? 'True' : 'False'
|
|
|
|
+cell #[code=cell]
|
|
|
|
else
|
|
|
|
+cell=cell
|
2017-06-01 12:51:14 +03:00
|
|
|
block
|
2017-10-30 15:15:13 +03:00
|
|
|
|
|
|
|
|
|
|
|
//- spaCy logo
|
|
|
|
|
|
|
|
mixin logo()
|
|
|
|
+svg("spacy", 675, 215).o-logo&attributes(attributes)
|
|
|
|
|
|
|
|
|
|
|
|
//- Gitter chat button and widget
|
|
|
|
button - [string] text shown on button
|
|
|
|
label - [string] title of chat window (default: same as button)
|
|
|
|
|
|
|
|
mixin gitter(button, label)
|
|
|
|
aside.js-gitter.c-chat.is-collapsed(data-title=(label || button))
|
|
|
|
|
|
|
|
button.js-gitter-button.c-chat__button.u-text-tag
|
|
|
|
+icon("chat", 16).o-icon--inline
|
|
|
|
!=button
|
|
|
|
|
|
|
|
|
|
|
|
//- Badge
|
|
|
|
image - [string] path to badge image
|
|
|
|
url - [string] badge link
|
|
|
|
|
|
|
|
mixin badge(image, url)
|
|
|
|
+a(url).u-padding-small.u-hide-link&attributes(attributes)
|
|
|
|
img.o-badge(src=image alt=url height="20")
|
|
|
|
|
|
|
|
|
|
|
|
//- Quickstart widget
|
|
|
|
quickstart.js with manual markup, inspired by PyTorch's "Getting started"
|
|
|
|
groups - [object] option groups, uses global variable QUICKSTART
|
|
|
|
headline - [string] optional text to be rendered as widget headline
|
|
|
|
|
|
|
|
mixin quickstart(groups, headline, description, hide_results)
|
|
|
|
.c-quickstart.o-block-small#qs
|
|
|
|
.c-quickstart__content
|
|
|
|
if headline
|
|
|
|
+h(2)=headline
|
|
|
|
if description
|
|
|
|
p=description
|
|
|
|
for group in groups
|
|
|
|
.c-quickstart__group.u-text-small(data-qs-group=group.id)
|
|
|
|
if group.title
|
|
|
|
.c-quickstart__legend=group.title
|
|
|
|
if group.help
|
|
|
|
| #[+help(group.help)]
|
|
|
|
.c-quickstart__fields
|
|
|
|
for option in group.options
|
|
|
|
input.c-quickstart__input(class="c-quickstart__input--" + (group.input_style ? group.input_style : group.multiple ? "check" : "radio") type=group.multiple ? "checkbox" : "radio" name=group.id id="qs-#{option.id}" value=option.id checked=option.checked)
|
|
|
|
label.c-quickstart__label.u-text-tiny(for="qs-#{option.id}")!=option.title
|
|
|
|
if option.meta
|
|
|
|
| #[span.c-quickstart__label__meta (#{option.meta})]
|
|
|
|
if option.help
|
|
|
|
| #[+help(option.help)]
|
|
|
|
|
|
|
|
if hide_results
|
|
|
|
block
|
|
|
|
else
|
|
|
|
pre.c-code-block
|
|
|
|
code.c-code-block__content.c-quickstart__code(data-qs-results="")
|
|
|
|
block
|
|
|
|
|
|
|
|
|
|
|
|
//- Quickstart code item
|
|
|
|
data - [object] Rendering conditions (keyed by option group ID, value: option)
|
|
|
|
style - [string] modifier ID for line style
|
|
|
|
|
|
|
|
mixin qs(data, style)
|
|
|
|
- args = {}
|
|
|
|
for value, setting in data
|
|
|
|
- args['data-qs-' + setting] = value
|
|
|
|
span.c-quickstart__line(class="c-quickstart__line--#{style || 'bash'}")&attributes(args)
|
|
|
|
block
|
|
|
|
|
|
|
|
|
|
|
|
//- Terminal-style code window
|
|
|
|
label - [string] title displayed in top bar of terminal window
|
|
|
|
|
2018-04-29 03:06:46 +03:00
|
|
|
mixin terminal-wrapper(label, small)
|
|
|
|
.x-terminal(class=small ? "x-terminal--small" : null)
|
|
|
|
.x-terminal__icons(class=small ? "x-terminal__icons--small" : null): span
|
|
|
|
.u-padding-small.u-text-center(class=small ? "u-text-tiny" : "u-text")
|
|
|
|
strong=label
|
|
|
|
block
|
2017-10-30 15:15:13 +03:00
|
|
|
|
2018-04-29 03:06:46 +03:00
|
|
|
mixin terminal(label, button_text, button_url, exec)
|
|
|
|
+terminal-wrapper(label)
|
|
|
|
+code.x-terminal__code(data-executable=exec ? "" : null)
|
2017-10-30 15:15:13 +03:00
|
|
|
block
|
|
|
|
|
2017-11-01 21:49:27 +03:00
|
|
|
if button_text && button_url
|
|
|
|
+button(button_url, true, "primary", "small").x-terminal__button=button_text
|
|
|
|
|
2017-10-30 15:15:13 +03:00
|
|
|
|
|
|
|
//- Landing
|
|
|
|
|
|
|
|
mixin landing-header()
|
|
|
|
header.c-landing
|
|
|
|
.c-landing__wrapper
|
|
|
|
.c-landing__content
|
|
|
|
block
|
|
|
|
|
|
|
|
mixin landing-banner(headline, label)
|
|
|
|
.c-landing__banner.u-padding.o-block.u-color-light
|
|
|
|
+grid.c-landing__banner__content.o-no-block
|
|
|
|
+grid-col("third")
|
|
|
|
h3.u-heading.u-heading-1
|
|
|
|
if label
|
|
|
|
div
|
|
|
|
span.u-text-label.u-text-label--light=label
|
|
|
|
!=headline
|
|
|
|
|
|
|
|
+grid-col("two-thirds").c-landing__banner__text
|
|
|
|
block
|
|
|
|
|
|
|
|
|
|
|
|
mixin landing-logos(title, logos)
|
|
|
|
.o-content.u-text-center&attributes(attributes)
|
|
|
|
h3.u-heading.u-text-label.u-color-dark=title
|
|
|
|
|
|
|
|
each row, i in logos
|
|
|
|
- var is_last = i == logos.length - 1
|
|
|
|
+grid("center").o-inline-list.o-no-block(class=is_last ? "o-no-block" : null)
|
|
|
|
each details, name in row
|
|
|
|
+a(details[0]).u-padding-medium
|
|
|
|
+icon(name, details[1], details[2])
|
|
|
|
|
|
|
|
if is_last
|
|
|
|
block
|
|
|
|
|
|
|
|
|
|
|
|
//- Under construction (temporary)
|
|
|
|
Marks sections that still need to be completed for the v2.0 release.
|
|
|
|
|
|
|
|
mixin under-construction()
|
|
|
|
+infobox("Under construction", "🚧")
|
2017-11-07 16:48:17 +03:00
|
|
|
| This section is still being written and will be updated as soon as
|
|
|
|
| possible. Is there anything that you think should definitely
|
|
|
|
| mentioned or explained here? Any examples you'd like to see?
|
2017-11-07 02:23:00 +03:00
|
|
|
| #[strong Let us know] on the #[+a(gh("spacy") + "/issues") issue tracker]!
|
2017-11-08 03:06:30 +03:00
|
|
|
|
|
|
|
|
|
|
|
//- Legacy docs
|
|
|
|
|
|
|
|
mixin legacy()
|
|
|
|
+aside("Looking for the old docs?", "📖")
|
|
|
|
| To help you make the transition from v1.x to v2.0, we've uploaded the
|
|
|
|
| old website to #[strong #[+a("https://legacy.spacy.io/docs") legacy.spacy.io]].
|
|
|
|
| Wherever possible, the new docs also include notes on features that have
|
|
|
|
| changed in v2.0, and features that were introduced in the new version.
|