mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-07 09:26:06 +08:00
site: change doc support display contributor (#52409)
Some checks are pending
Publish Any Commit / build (push) Waiting to run
🔀 Sync mirror to Gitee / mirror (push) Waiting to run
✅ test / lint (push) Waiting to run
✅ test / test-react-legacy (16, 1/2) (push) Waiting to run
✅ test / test-react-legacy (16, 2/2) (push) Waiting to run
✅ test / test-react-legacy (17, 1/2) (push) Waiting to run
✅ test / test-react-legacy (17, 2/2) (push) Waiting to run
✅ test / test-node (push) Waiting to run
✅ test / test-react-latest (dom, 1/2) (push) Waiting to run
✅ test / test-react-latest (dom, 2/2) (push) Waiting to run
✅ test / test-react-latest-dist (dist, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist, 2/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 2/2) (push) Blocked by required conditions
✅ test / test-coverage (push) Blocked by required conditions
✅ test / build (push) Waiting to run
✅ test / test lib/es module (es, 1/2) (push) Waiting to run
✅ test / test lib/es module (es, 2/2) (push) Waiting to run
✅ test / test lib/es module (lib, 1/2) (push) Waiting to run
✅ test / test lib/es module (lib, 2/2) (push) Waiting to run
👁️ Visual Regression Persist Start / test image (push) Waiting to run
Some checks are pending
Publish Any Commit / build (push) Waiting to run
🔀 Sync mirror to Gitee / mirror (push) Waiting to run
✅ test / lint (push) Waiting to run
✅ test / test-react-legacy (16, 1/2) (push) Waiting to run
✅ test / test-react-legacy (16, 2/2) (push) Waiting to run
✅ test / test-react-legacy (17, 1/2) (push) Waiting to run
✅ test / test-react-legacy (17, 2/2) (push) Waiting to run
✅ test / test-node (push) Waiting to run
✅ test / test-react-latest (dom, 1/2) (push) Waiting to run
✅ test / test-react-latest (dom, 2/2) (push) Waiting to run
✅ test / test-react-latest-dist (dist, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist, 2/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 1/2) (push) Blocked by required conditions
✅ test / test-react-latest-dist (dist-min, 2/2) (push) Blocked by required conditions
✅ test / test-coverage (push) Blocked by required conditions
✅ test / build (push) Waiting to run
✅ test / test lib/es module (es, 1/2) (push) Waiting to run
✅ test / test lib/es module (es, 2/2) (push) Waiting to run
✅ test / test lib/es module (lib, 1/2) (push) Waiting to run
✅ test / test lib/es module (lib, 2/2) (push) Waiting to run
👁️ Visual Regression Persist Start / test image (push) Waiting to run
* save * save * save
This commit is contained in:
parent
35f8f89554
commit
af63c666d8
@ -20,6 +20,7 @@ interface ChangelogInfo {
|
|||||||
version: string;
|
version: string;
|
||||||
changelog: string;
|
changelog: string;
|
||||||
refs: string[];
|
refs: string[];
|
||||||
|
contributors: string[];
|
||||||
releaseDate: string;
|
releaseDate: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,14 +161,30 @@ const ParseChangelog: React.FC<{ changelog: string }> = (props) => {
|
|||||||
return <span>{parsedChangelog}</span>;
|
return <span>{parsedChangelog}</span>;
|
||||||
};
|
};
|
||||||
|
|
||||||
const RefLinks: React.FC<{ refs: string[] }> = ({ refs }) => {
|
const RefLinks: React.FC<{ refs: string[]; contributors: string[] }> = ({ refs, contributors }) => {
|
||||||
const { styles } = useStyle();
|
const { styles } = useStyle();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{refs?.map((ref) => (
|
{refs?.map((ref) => (
|
||||||
<a className={styles.linkRef} key={ref} href={ref} target="_blank" rel="noreferrer">
|
<React.Fragment key={ref}>
|
||||||
#{ref.match(/[^/]+$/)?.[0]}
|
<a className={styles.linkRef} key={ref} href={ref} target="_blank" rel="noreferrer">
|
||||||
</a>
|
#{ref.match(/[^/]+$/)?.[0]}
|
||||||
|
</a>
|
||||||
|
</React.Fragment>
|
||||||
|
))}
|
||||||
|
{contributors?.map((contributor) => (
|
||||||
|
<React.Fragment key={contributor}>
|
||||||
|
<a
|
||||||
|
className={styles.linkRef}
|
||||||
|
key={contributor}
|
||||||
|
href={`https://github.com/${contributor}`}
|
||||||
|
target="_blank"
|
||||||
|
rel="noreferrer"
|
||||||
|
>
|
||||||
|
@{contributor}
|
||||||
|
</a>
|
||||||
|
</React.Fragment>
|
||||||
))}
|
))}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
@ -178,7 +195,7 @@ const RenderChangelogList: React.FC<{ changelogList: ChangelogInfo[] }> = ({ cha
|
|||||||
const { styles } = useStyle();
|
const { styles } = useStyle();
|
||||||
const len = changelogList.length;
|
const len = changelogList.length;
|
||||||
for (let i = 0; i < len; i += 1) {
|
for (let i = 0; i < len; i += 1) {
|
||||||
const { refs, changelog } = changelogList[i];
|
const { refs, changelog, contributors } = changelogList[i];
|
||||||
// Check if the next line is an image link and append it to the current line
|
// Check if the next line is an image link and append it to the current line
|
||||||
if (i + 1 < len && changelogList[i + 1].changelog.trim().startsWith('<img')) {
|
if (i + 1 < len && changelogList[i + 1].changelog.trim().startsWith('<img')) {
|
||||||
const imgDom = new DOMParser().parseFromString(changelogList[i + 1].changelog, 'text/html');
|
const imgDom = new DOMParser().parseFromString(changelogList[i + 1].changelog, 'text/html');
|
||||||
@ -186,7 +203,7 @@ const RenderChangelogList: React.FC<{ changelogList: ChangelogInfo[] }> = ({ cha
|
|||||||
elements.push(
|
elements.push(
|
||||||
<li key={i}>
|
<li key={i}>
|
||||||
<ParseChangelog changelog={changelog} />
|
<ParseChangelog changelog={changelog} />
|
||||||
<RefLinks refs={refs} />
|
<RefLinks refs={refs} contributors={contributors} />
|
||||||
<br />
|
<br />
|
||||||
<img
|
<img
|
||||||
src={imgElement?.getAttribute('src') || ''}
|
src={imgElement?.getAttribute('src') || ''}
|
||||||
@ -200,7 +217,7 @@ const RenderChangelogList: React.FC<{ changelogList: ChangelogInfo[] }> = ({ cha
|
|||||||
elements.push(
|
elements.push(
|
||||||
<li key={i}>
|
<li key={i}>
|
||||||
<ParseChangelog changelog={changelog} />
|
<ParseChangelog changelog={changelog} />
|
||||||
<RefLinks refs={refs} />
|
<RefLinks refs={refs} contributors={contributors} />
|
||||||
</li>,
|
</li>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,13 @@ const miscKeys = [
|
|||||||
// Changelog map
|
// Changelog map
|
||||||
const componentChangelog: Record<
|
const componentChangelog: Record<
|
||||||
string,
|
string,
|
||||||
{ version: string; changelog: string; refs: string[]; releaseDate: string }[]
|
{
|
||||||
|
version: string;
|
||||||
|
changelog: string;
|
||||||
|
refs: string[];
|
||||||
|
releaseDate: string;
|
||||||
|
contributors: string[];
|
||||||
|
}[]
|
||||||
> = {};
|
> = {};
|
||||||
Object.keys(componentNameMap).forEach((name) => {
|
Object.keys(componentNameMap).forEach((name) => {
|
||||||
componentChangelog[name] = [];
|
componentChangelog[name] = [];
|
||||||
@ -127,6 +133,20 @@ const miscKeys = [
|
|||||||
lastReleaseDate = matchReleaseDate[1];
|
lastReleaseDate = matchReleaseDate[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get Contributor name
|
||||||
|
const contributors: string[] = [];
|
||||||
|
const usernameMatches = line.match(/\[@([^\]]+)\]/g);
|
||||||
|
|
||||||
|
if (usernameMatches) {
|
||||||
|
usernameMatches.forEach((match) => {
|
||||||
|
const usernameMatch = match.match(/\[@([^\]]+)\]/);
|
||||||
|
if (usernameMatch) {
|
||||||
|
const username = usernameMatch[1];
|
||||||
|
contributors.push(username);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Start when get version
|
// Start when get version
|
||||||
if (!lastVersion) {
|
if (!lastVersion) {
|
||||||
continue;
|
continue;
|
||||||
@ -184,6 +204,7 @@ const miscKeys = [
|
|||||||
changelog: changelogLine,
|
changelog: changelogLine,
|
||||||
refs,
|
refs,
|
||||||
releaseDate: lastReleaseDate,
|
releaseDate: lastReleaseDate,
|
||||||
|
contributors,
|
||||||
});
|
});
|
||||||
matched = true;
|
matched = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user