Skip to content

Commit b9b4160

Browse files
authored
Merge branch 'main' into add-donate-page-zh
2 parents edb2bbe + 24675bb commit b9b4160

File tree

11 files changed

+70
-7
lines changed

11 files changed

+70
-7
lines changed

src/components/ReferenceDirectoryWithFilter/index.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { useMemo, useRef, useState } from "preact/hooks";
33
import { type JSX } from "preact";
44
import { Icon } from "../Icon";
55
import flask from "@src/content/ui/images/icons/flask.svg?raw";
6+
import warning from "@src/content/ui/images/icons/warning.svg?raw";
67

78
type ReferenceDirectoryEntry = ReferenceDocContentItem & {
89
data: {
@@ -43,6 +44,10 @@ const getOneLineDescription = (description: string): string => {
4344
let [oneLineDescription] = description.replace(/\n/g, " ").trim()
4445
.match(firstParagraphRegex) ?? [];
4546

47+
if (!oneLineDescription && description) {
48+
oneLineDescription = description;
49+
}
50+
4651
if(oneLineDescription){
4752
oneLineDescription = oneLineDescription
4853
.replace(/^<p>|<\/p>$/g, "")
@@ -108,6 +113,12 @@ export const ReferenceDirectoryWithFilter = ({
108113
dangerouslySetInnerHTML={{ __html: flask }}
109114
/>
110115
)}
116+
{entry.data.deprecated && (
117+
<div
118+
className="inline-block mr-2 w-[16px] h-[16px] mb-[-2px]"
119+
dangerouslySetInnerHTML={{ __html: warning }}
120+
/>
121+
)}
111122
<span dangerouslySetInnerHTML={{ __html: entry.data.title }} />
112123
</span>
113124
<p

src/content/reference/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ export const referenceSchema = z.object({
6464
submodule: z.string().optional(),
6565
file: z.string(),
6666
description: z.string().optional(),
67+
deprecated: z.string().optional(),
6768
line: z.number().or(z.string().transform((v) => parseInt(v, 10))),
6869
params: z.array(paramSchema).optional(),
6970
overloads: z.array(z.object({ params: z.array(paramSchema) })).optional(),
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: "आचार संहिता"
3+
---
4+
5+
- **अपनी भाषा का ध्यान रखें.** निम्नलिखित में से कोई भी व्यवहार अस्वीकार्य है:
6+
7+
- लिंग, पहचान, यौन पसंद, रंग, जाति, भाषा, सोचने का तरीका, शरीर का आकार, क्षमता, वर्ग, धर्म, संस्कृति, समूह, राजनीति, उम्र, हुनर, काम या पृष्ठभूमि के बारे में बुरे कमेंट न करें।
8+
- हिंसा की धमकी न दें।
9+
- किसी को जानबूझकर न डराएं।
10+
- बिना मतलब के या बिना चेतावनी के यौन या हिंसा वाली चीज़ें न दिखाएं।
11+
- किसी पर बिना चाहे यौन ध्यान न दें।
12+
- किसी का पीछा न करें।
13+
- या किसी भी तरह से परेशान न करें।
14+
15+
सोच-समझकर काम करें। अगर कुछ ऐसा है जिससे दूसरे शायद परेशान हों, तो उसे न डालें।
16+
17+
- **सम्मान करें।** जब राय अलग हो, तो दूसरों के विचारों पर गुस्सा न करें। याद रखें, हर बात को शांति और ध्यान से समझें।
18+
- **ध्यान रखें।** सोचें कि आपकी बात से समुदाय के लोगों पर क्या असर होगा।
19+
- **खुले विचारों वाले बनें। ** नए लोगों और नए विचारों का स्वागत करें। हमारा ग्रुप हमेशा बदल रहा है, और हम अच्छे बदलावों का स्वागत करते हैं।
20+
21+
अगर आपको लगे कि कोई नियम तोड़ रहा है, तो [[email protected]](mailto:[email protected]) पर ईमेल करके बताएं। अपना नाम और घटना के बारे में लिखें, हम जल्दी ही आपसे संपर्क करेंगे।
22+
23+
कभी-कभी, नियम तोड़ने वालों को पता नहीं होता कि उनकी हरकत गलत है, और बात करने से मामला ठीक हो जाता है। लेकिन, अगर कोई बार-बार ऐसा करे, तो p5.js टीम जो ठीक लगे वो कर सकती है, जैसे कि उसे p5.js से हटाना और दूसरों को बताना कि वो परेशान करने वाला है।
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: "संपर्क करें"
3+
---
4+
5+
आप हमसे [[email protected]](mailto:[email protected]) पर संपर्क कर सकते हैं।

src/content/ui/en.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ calloutTitles:
186186
"Try this!": "Try this!"
187187
Tip: Tip
188188
Note: Note
189+
Warning: Warning
189190
LibrariesLayout:
190191
View All: View All
191192
Featured: Featured
Lines changed: 5 additions & 0 deletions
Loading

src/layouts/ReferenceItemLayout.astro

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import type {
2020
import { setJumpToState } from "../globals/state";
2121
import { p5Version } from "../globals/p5-version";
2222
import flask from "@src/content/ui/images/icons/flask.svg?raw";
23+
import warning from "@src/content/ui/images/icons/warning.svg?raw";
2324
2425
const { entry, relatedEntries } = Astro.props;
2526
const currentLocale = getCurrentLocale(Astro.url.pathname);
@@ -106,6 +107,18 @@ const descriptionParts = description.split(
106107
<p>{t('experimentalApi', 'description')}</p>
107108
</div>
108109
)}
110+
{entry.data.deprecated && (
111+
<div class="deprecated">
112+
<h5>
113+
<div
114+
class="inline-block mr-2 w-[20px] h-[20px] mb-[-2px]"
115+
set:html={warning}
116+
/>
117+
{t('calloutTitles', 'Warning')}
118+
</h5>
119+
<p set:html={entry.data.deprecated} />
120+
</div>
121+
)}
109122
{descriptionParts.map((part) => {
110123
if (part.startsWith('<pre')) {
111124
const exampleCode = part

src/scripts/builders/reference.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ const convertToMDX = async (
255255
file: doc.file.replace(/.*p5\.js\/(.*)/, "$1"),
256256
description: doc.description ?? "",
257257
line: doc.line,
258+
deprecated: doc.deprecated,
258259
} as Record<string, unknown>;
259260

260261
// Add specific frontmatter based on the type of doc

src/scripts/parsers/reference.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,7 @@ export const saveYuidocOutput = async (
128128
const inPath = path.join(__dirname, "in", inDirName);
129129
console.log(inPath)
130130
await new Promise((resolve, reject) => {
131-
exec(`yuidoc -p --outdir ${outputFilePath} ${flags} ${inputPath}`, { cwd: inPath }, (error, stdout) => {
132-
if (error) {
131+
exec(`yuidoc -p --outdir "${outputFilePath.replace(/"/g, '\\"')}" ${flags} ${inputPath}`, { cwd: inPath }, (error, stdout) => { if (error) {
133132
console.error(`Error running YUIDoc command: ${error}`);
134133
reject(error);
135134
} else {

styles/global.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ pre.code-box,
291291
white-space: break-spaces;
292292
}
293293

294-
.callout, .experimental {
294+
.callout, .experimental, .deprecated {
295295
padding: var(--spacing-sm);
296296
border-radius: 20px;
297297
background-color: var(--bg-magenta-20);
@@ -308,7 +308,7 @@ pre.code-box,
308308
}
309309
}
310310

311-
.experimental {
311+
.experimental, .deprecated {
312312
background-color: var(--bg-yellow);
313313
}
314314

0 commit comments

Comments
 (0)