chore: update MindSpace brand footer text
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
export const MINDSPACE_PAGE_TAG_ATTR = 'data-mindspace-page-tag';
|
export const MINDSPACE_PAGE_TAG_ATTR = 'data-mindspace-page-tag';
|
||||||
export const MINDSPACE_PAGE_TAG_PLATFORM_BRAND = 'platform-brand';
|
export const MINDSPACE_PAGE_TAG_PLATFORM_BRAND = 'platform-brand';
|
||||||
export const PLATFORM_CONTACT_EMAIL = 'contact@tkmind.cn';
|
export const PLATFORM_BRAND_TEXT = 'TKMind · 智趣';
|
||||||
|
|
||||||
const PLATFORM_BRAND_INNER_RE = /(?:contact@tkmind\.(?:ai|cn)|📧[^<]*tkmind)/i;
|
const PLATFORM_BRAND_INNER_RE = /(?:TKMind\s*·\s*智趣|contact@tkmind\.(?:ai|cn)|📧[^<]*tkmind)/i;
|
||||||
const SIMPLE_BRAND_ELEMENT_RE =
|
const SIMPLE_BRAND_ELEMENT_RE =
|
||||||
/<(p|div|span|small|footer|a)(\s[^>]*)?>([^<]*(?:contact@tkmind\.(?:ai|cn)|📧[^<]*tkmind)[^<]*)<\/\1>/gi;
|
/<(p|div|span|small|footer|a)(\s[^>]*)?>([^<]*(?:TKMind\s*·\s*智趣|contact@tkmind\.(?:ai|cn)|📧[^<]*tkmind)[^<]*)<\/\1>/gi;
|
||||||
|
|
||||||
export function normalizePlatformDomainText(text) {
|
export function normalizePlatformDomainText(text) {
|
||||||
return String(text ?? '').replace(/tkmind\.ai/gi, 'tkmind.cn');
|
return String(text ?? '').replace(/tkmind\.ai/gi, 'tkmind.cn');
|
||||||
@@ -16,6 +16,7 @@ export function normalizePlatformBrandHtml(html) {
|
|||||||
next = next.replace(/https?:\/\/([a-z0-9.-]*\.)?tkmind\.ai/gi, (match) =>
|
next = next.replace(/https?:\/\/([a-z0-9.-]*\.)?tkmind\.ai/gi, (match) =>
|
||||||
match.replace(/tkmind\.ai/gi, 'tkmind.cn'),
|
match.replace(/tkmind\.ai/gi, 'tkmind.cn'),
|
||||||
);
|
);
|
||||||
|
next = next.replace(/(?:📧\s*)?contact@tkmind\.cn/gi, PLATFORM_BRAND_TEXT);
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,19 +11,20 @@ import {
|
|||||||
test('normalizePlatformBrandHtml rewrites tkmind.ai to tkmind.cn', () => {
|
test('normalizePlatformBrandHtml rewrites tkmind.ai to tkmind.cn', () => {
|
||||||
const html = '<a href="mailto:contact@tkmind.ai">📧 contact@tkmind.ai</a>';
|
const html = '<a href="mailto:contact@tkmind.ai">📧 contact@tkmind.ai</a>';
|
||||||
const result = normalizePlatformBrandHtml(html);
|
const result = normalizePlatformBrandHtml(html);
|
||||||
assert.match(result, /contact@tkmind\.cn/);
|
assert.match(result, /TKMind · 智趣/);
|
||||||
assert.doesNotMatch(result, /tkmind\.ai/i);
|
assert.doesNotMatch(result, /tkmind\.ai/i);
|
||||||
|
assert.doesNotMatch(result, /contact@tkmind\.cn/i);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('ensurePlatformBrandPageTags adds platform-brand marker to contact line', () => {
|
test('ensurePlatformBrandPageTags adds platform-brand marker to contact line', () => {
|
||||||
const html = '<footer><p>📧 contact@tkmind.ai</p></footer>';
|
const html = '<footer><p>📧 contact@tkmind.ai</p></footer>';
|
||||||
const result = ensurePlatformBrandPageTags(html);
|
const result = ensurePlatformBrandPageTags(html);
|
||||||
assert.match(result, new RegExp(`${MINDSPACE_PAGE_TAG_ATTR}="${MINDSPACE_PAGE_TAG_PLATFORM_BRAND}"`));
|
assert.match(result, new RegExp(`${MINDSPACE_PAGE_TAG_ATTR}="${MINDSPACE_PAGE_TAG_PLATFORM_BRAND}"`));
|
||||||
assert.match(result, /contact@tkmind\.cn/);
|
assert.match(result, /TKMind · 智趣/);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('prepareHtmlPageBrandMarkers keeps existing marker', () => {
|
test('prepareHtmlPageBrandMarkers keeps existing marker', () => {
|
||||||
const html = `<p ${MINDSPACE_PAGE_TAG_ATTR}="${MINDSPACE_PAGE_TAG_PLATFORM_BRAND}">📧 contact@tkmind.cn</p>`;
|
const html = `<p ${MINDSPACE_PAGE_TAG_ATTR}="${MINDSPACE_PAGE_TAG_PLATFORM_BRAND}">TKMind · 智趣</p>`;
|
||||||
const result = prepareHtmlPageBrandMarkers(html);
|
const result = prepareHtmlPageBrandMarkers(html);
|
||||||
assert.equal(result.match(new RegExp(MINDSPACE_PAGE_TAG_ATTR, 'g'))?.length, 1);
|
assert.equal(result.match(new RegExp(MINDSPACE_PAGE_TAG_ATTR, 'g'))?.length, 1);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -95,10 +95,10 @@ description: 在专属 MindSpace 目录生成可公开访问的静态 HTML 报
|
|||||||
|
|
||||||
## 平台页脚标记(必须)
|
## 平台页脚标记(必须)
|
||||||
|
|
||||||
页脚平台联系行**必须**使用 `data-mindspace-page-tag="platform-brand"`,且邮箱/域名只用 **tkmind.cn**(如 `contact@tkmind.cn`),**禁止** `tkmind.ai`:
|
页脚平台品牌行**必须**使用 `data-mindspace-page-tag="platform-brand"`,显示为 **TKMind · 智趣**,**禁止**使用邮箱或 `tkmind.ai`:
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<p data-mindspace-page-tag="platform-brand">📧 contact@tkmind.cn</p>
|
<p data-mindspace-page-tag="platform-brand">TKMind · 智趣</p>
|
||||||
```
|
```
|
||||||
|
|
||||||
带 `data-mindspace-page-tag` 的区域为平台固定信息:用户在编辑模式中不可见、不可改;预览与发布后正常显示。
|
带 `data-mindspace-page-tag` 的区域为平台固定信息:用户在编辑模式中不可见、不可改;预览与发布后正常显示。
|
||||||
|
|||||||
+2
-2
@@ -224,10 +224,10 @@ description: 在专属 MindSpace 目录生成可公开访问的静态 HTML 报
|
|||||||
- 完整 \`<!DOCTYPE html>\`,\`lang="zh-CN"\`
|
- 完整 \`<!DOCTYPE html>\`,\`lang="zh-CN"\`
|
||||||
- 移动端友好:\`<meta name="viewport" content="width=device-width, initial-scale=1">\`
|
- 移动端友好:\`<meta name="viewport" content="width=device-width, initial-scale=1">\`
|
||||||
- 深色/浅色与内容一致;主色在 CSS 与 mindspace-cover 中保持一致
|
- 深色/浅色与内容一致;主色在 CSS 与 mindspace-cover 中保持一致
|
||||||
- 页脚平台联系行**必须**使用 \`data-mindspace-page-tag="platform-brand"\` 标记,且邮箱/域名只用 **tkmind.cn**(如 \`contact@tkmind.cn\`),**禁止** \`tkmind.ai\`
|
- 页脚平台品牌行**必须**使用 \`data-mindspace-page-tag="platform-brand"\` 标记,显示为 **TKMind · 智趣**,**禁止**使用邮箱或 \`tkmind.ai\`
|
||||||
|
|
||||||
\`\`\`html
|
\`\`\`html
|
||||||
<p data-mindspace-page-tag="platform-brand">📧 contact@tkmind.cn</p>
|
<p data-mindspace-page-tag="platform-brand">TKMind · 智趣</p>
|
||||||
\`\`\`
|
\`\`\`
|
||||||
|
|
||||||
- 带 \`data-mindspace-page-tag\` 的区域为平台固定信息:用户在编辑模式中不可见、不可改;预览与发布后正常显示
|
- 带 \`data-mindspace-page-tag\` 的区域为平台固定信息:用户在编辑模式中不可见、不可改;预览与发布后正常显示
|
||||||
|
|||||||
Reference in New Issue
Block a user