forked from explosion/spaCy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_mixins.jade
329 lines (228 loc) · 9.06 KB
/
_mixins.jade
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
//- 💫 INCLUDES > MIXINS
include _functions
include _mixins-base
//- Headlines
level - [integer] headline level, corresponds to h1, h2, h3 etc.
id - [string] unique identifier, creates permalink (optional)
mixin h(level, id)
+headline(level).u-heading&attributes(attributes)
+permalink(id)
block
//- 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)
- external = url.includes("http")
a(href=url target=external ? "_blank" : null rel=external && !trusted ? "noopener nofollow" : null)&attributes(attributes)
block
//- 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)
span.u-inline-block.u-nowrap
+a(url)
block
| #[+icon("code", 16).o-icon--inline.u-color-subtle]
//- API link (with added tag and automatically generated path)
path - [string] path to API docs page relative to /docs/api/
mixin api(path)
+a("/docs/api/" + path, true)(target="_self").u-no-border.u-inline-block
block
| #[+icon("book", 18).o-icon--inline.u-color-subtle]
//- Help icon with tooltip
tooltip - [string] Tooltip text
mixin help(tooltip)
span(data-tooltip=tooltip)&attributes(attributes)
+icon("help", 16).i-icon--inline
//- Aside for text
label - [string] aside title (optional)
mixin aside(label)
+aside-wrapper(label)
.c-aside__text.u-text-small
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
mixin aside-code(label, language)
+aside-wrapper(label)
+code(false, language).o-no-block
block
//- Infobox
label - [string] infobox title (optional or false for no title)
mixin infobox(label)
aside.o-box.o-block.u-text-small
if label
h3.u-text-label.u-color-theme=label
block
//- 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)
- external = url.includes("http")
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)
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
mixin code(label, language)
pre.c-code-block.o-block(class="lang-#{(language || DEFAULT_SYNTAX)}")&attributes(attributes)
if label
h4.u-text-label.u-text-label--dark=label
code.c-code-block__content
block
//- 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)
.codepen(data-height=height data-theme-id="26467" data-slug-hash=slug data-default-tab=(default_tab || "result") data-embed-version="2" data-user=SOCIAL.codepen)
+a("https://codepen.io/" + SOCIAL.codepen + "/" + slug) View on CodePen
script(async src="https://assets.codepen.io/assets/embed/ei.js")
//- 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)
img(src=url alt=(alt || caption) width="#{width || 500}")
if caption
+image-caption=caption
else
block
//- Image caption
mixin image-caption()
figcaption.u-text-small.u-color-subtle.u-padding-small&attributes(attributes)
block
//- Label
mixin label()
.u-text-label.u-color-subtle&attributes(attributes)
block
//- Tag
mixin tag()
span.u-text-tag.u-text-tag--spaced(aria-hidden="true")
block
//- List
type - [string] "numbers", "letters", "roman" (bulleted list if none set)
start - [integer] start number
mixin list(type, start)
if type
ol.c-list.o-block.u-text(class="c-list--#{type}" style=(start === 0 || start) ? "counter-reset: li #{(start - 1)}" : null)&attributes(attributes)
block
else
ul.c-list.c-list--bullets.o-block.u-text&attributes(attributes)
block
//- List item (only used within +list)
mixin item(procon)
if procon
li&attributes(attributes)
+procon(procon).c-list__icon
block
else
li.c-list__item&attributes(attributes)
block
//- Table
head - [array] table headings (should match number of columns)
mixin table(head)
table.c-table.o-block&attributes(attributes)
if head
+row
each column in head
th.c-table__head-cell.u-text-label=column
block
//- Table row (only used within +table)
mixin row(...style)
tr.c-table__row(class=prefixArgs(style, "c-table__row"))&attributes(attributes)
block
//- Footer table row (only ued within +table)
mixin footrow()
tr.c-table__row.c-table__row--foot&attributes(attributes)
block
//- Table cell (only used within +row in +table)
mixin cell()
td.c-table__cell.u-text&attributes(attributes)
block
//- Grid Container
...style - all arguments are added as class names o-grid--argument
see assets/css/_base/_grid.sass
mixin grid(...style)
.o-grid.o-block(class=prefixArgs(style, "o-grid"))&attributes(attributes)
block
//- Grid Column (only used within +grid)
width - [string] "quarter", "third", "half", "two-thirds", "three-quarters"
see $grid in assets/css/_variables.sass
mixin grid-col(width)
.o-grid__col(class="o-grid__col--#{width}")&attributes(attributes)
block
//- Card (only used within +grid)
title - [string] card title
details - [object] url, image, author, description, tags etc.
(see /docs/usage/_data.json)
mixin card(title, details)
+grid-col("half").o-card.u-text&attributes(attributes)
if details.image
+a(details.url).o-block-small
img(src=details.image alt=title width="300" role="presentation")
if title
+a(details.url)
+h(3)=title
if details.author
.u-text-small.u-color-subtle by #{details.author}
if details.description || details.tags
ul
if details.description
li=details.description
if details.tags
li
each tag in details.tags
span.u-text-tag #{tag}
|
block
//- Simpler card list item (only used within +list)
title - [string] card title
details - [object] url, image, author, description, tags etc.
(see /docs/usage/_data.json)
mixin card-item(title, details)
+item&attributes(attributes)
+a(details.url)=title
if details.description
br
span=details.description
if details.author
br
span.u-text-small.u-color-subtle by #{details.author}
//- Table row for models table
mixin model-row(name, lang, procon, size, license, default_model, divider)
- var licenses = { "CC BY-SA": "https://creativecommons.org/licenses/by-sa/3.0/", "CC BY-NC": "https://creativecommons.org/licenses/by-nc/3.0/" }
+row(divider ? "divider": null)
+cell #[code=name]
if default_model
| #[span.u-color-theme(title="default model") #[+icon("star", 16)]]
+cell=lang
each icon in procon
+cell.u-text-center #[+procon(icon ? "pro" : "con")]
+cell.u-text-right=size
+cell
if license in licenses
+a(licenses[license])=license
//- Table rows for annotation specs
mixin pos-row(tag, pos, morph, desc)
+row
+cell #[code=tag]
+cell #[code=pos]
+cell
each m in morph.split(" ")
if m
| #[code=m]
+cell.u-text-small=desc
mixin dep-row(label, desc)
+row
+cell #[code=label]
+cell=desc