Prism.languages.chaiscript = Prism.languages.extend('clike', {
string: {
pattern: /(^|[^\\])'(?:[^'\\]|\\[\s\S])*'/,
lookbehind: true,
greedy: true,
},
'class-name': [
{
// e.g. class Rectangle { ... }
pattern: /(\bclass\s+)\w+/,
lookbehind: true,
},
{
// e.g. attr Rectangle::height, def Rectangle::area() { ... }
pattern: /(\b(?:attr|def)\s+)\w+(?=\s*::)/,
lookbehind: true,
},
],
keyword:
/\b(?:attr|auto|break|case|catch|class|continue|def|default|else|finally|for|fun|global|if|return|switch|this|try|var|while)\b/,
number: [Prism.languages.cpp.number, /\b(?:Infinity|NaN)\b/],
operator:
/>>=?|<<=?|\|\||&&|:[:=]?|--|\+\+|[=!<>+\-*/%|&^]=?|[?~]|`[^`\r\n]{1,4}`/,
});
Prism.languages.insertBefore('chaiscript', 'operator', {
'parameter-type': {
// e.g. def foo(int x, Vector y) {...}
pattern: /([,(]\s*)\w+(?=\s+\w)/,
lookbehind: true,
alias: 'class-name',
},
});
Prism.languages.insertBefore('chaiscript', 'string', {
'string-interpolation': {
pattern:
/(^|[^\\])"(?:[^"$\\]|\\[\s\S]|\$(?!\{)|\$\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\})*"/,
lookbehind: true,
greedy: true,
inside: {
interpolation: {
pattern:
/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\}/,
lookbehind: true,
inside: {
'interpolation-expression': {
pattern: /(^\$\{)[\s\S]+(?=\}$)/,
lookbehind: true,
inside: Prism.languages.chaiscript,
},
'interpolation-punctuation': {
pattern: /^\$\{|\}$/,
alias: 'punctuation',
},
},
},
string: /[\s\S]+/,
},
},
});
56f55f87a88f8dbd3'>treecommitdiffstats
|
blob: 423c54fdf8925ca6280d5f4135ebfbaa9be705ef (
plain)
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
|
import Heading from '@components/atoms/headings/heading';
import Link from 'next/link';
import { FC } from 'react';
import { useIntl } from 'react-intl';
import FlippingLogo, { type FlippingLogoProps } from '../images/flipping-logo';
import styles from './branding.module.scss';
export type BrandingProps = Pick<FlippingLogoProps, 'photo'> & {
/**
* The Branding baseline.
*/
baseline?: string;
/**
* Use H1 if the current page is homepage. Default: false.
*/
isHome?: boolean;
/**
* The Branding title;
*/
title: string;
/**
* Wraps the title with a link to homepage. Default: false.
*/
withLink?: boolean;
};
/**
* Branding component
*
* Render the branding logo, title and optional baseline.
*/
const Branding: FC<BrandingProps> = ({
baseline,
isHome = false,
photo,
title,
withLink = false,
...props
}) => {
const intl = useIntl();
const altText = intl.formatMessage(
{
defaultMessage: '{website} picture',
description: 'Branding: photo alternative text',
id: 'dDK5oc',
},
{ website: title }
);
const logoTitle = intl.formatMessage(
{
defaultMessage: '{website} logo',
description: 'Branding: logo title',
id: 'x55qsD',
},
{ website: title }
);
return (
<div className={styles.wrapper}>
<FlippingLogo
className={styles.logo}
altText={altText}
logoTitle={logoTitle}
photo={photo}
{...props}
/>
<Heading
isFake={!isHome}
level={1}
withMargin={false}
className={styles.title}
>
{withLink ? (
<Link href="/">
<a className={styles.link}>{title}</a>
</Link>
) : (
title
)}
</Heading>
{baseline && (
<Heading
isFake={true}
level={4}
withMargin={false}
className={styles.baseline}
>
{baseline}
</Heading>
)}
</div>
);
};
export default Branding;
|