|
|
@@ -128,23 +128,21 @@ async function generateMarkdownIch(subDir: string, type: string) {
|
|
|
md += `# ${item.title}\n\n`;
|
|
|
if (item.desc)
|
|
|
md += `${item.desc}\n\n`;
|
|
|
- md += `类型:${type}\n\n`;
|
|
|
+ md += `${item.title}类型:${type}\n`;
|
|
|
|
|
|
function addRow(key: string, value: any) {
|
|
|
if (value)
|
|
|
md += `- ${key}: ${value}\n`;
|
|
|
}
|
|
|
-
|
|
|
- addRow('非遗级别', item.levelText);
|
|
|
- addRow('非遗类别', item.ichTypeText);
|
|
|
- addRow('地区', item.regionText);
|
|
|
- addRow('批次', item.batchText);
|
|
|
- addRow('保护单位', item.unit);
|
|
|
- addRow('地址', item.address);
|
|
|
- addRow('字号名称', item.fontName);
|
|
|
- addRow('认定类型', item.brandType);
|
|
|
-
|
|
|
- md += `数据库索引ID: 类型: intangible ID: ${item.id || '无'}\n\n`;
|
|
|
+ addRow(`${item.title}非遗级别`, item.levelText);
|
|
|
+ addRow(`${item.title}非遗类别`, item.ichTypeText);
|
|
|
+ addRow(`${item.title}地区`, item.regionText);
|
|
|
+ addRow(`${item.title}批次`, item.batchText);
|
|
|
+ addRow(`${item.title}保护单位`, item.unit);
|
|
|
+ addRow(`${item.title}地址`, item.address);
|
|
|
+ addRow(`${item.title}字号名称`, item.fontName);
|
|
|
+ addRow(`${item.title}认定类型`, item.brandType);
|
|
|
+ md += `${item.title}数据库索引ID: 类型: intangible ID: ${item.id || '无'}\n\n`;
|
|
|
|
|
|
// 详细信息
|
|
|
if (item.detail) {
|
|
|
@@ -155,26 +153,26 @@ async function generateMarkdownIch(subDir: string, type: string) {
|
|
|
// 内容
|
|
|
if (detail.content)
|
|
|
md += htmlToMarkdown(detail.content) + '\n\n';
|
|
|
- // 传承谱系
|
|
|
- if (detail.pedigree) {
|
|
|
- md += `## 传承谱系\n\n`;
|
|
|
- md += '传承谱: ' + htmlToMarkdown(detail.pedigree as string) + '\n\n';
|
|
|
- }
|
|
|
|
|
|
// 传承人
|
|
|
if (detail.inheritorsList && detail.inheritorsList.length > 0) {
|
|
|
- md += `相关非遗传承人:${detail.inheritorsList.map(inheritor => inheritor.title).join('、')}\n\n`;
|
|
|
+ md += `${item.title}相关非遗传承人:${detail.inheritorsList.map(inheritor => inheritor.title).join('、')}\n\n`;
|
|
|
if (detail.inheritor)
|
|
|
md += htmlToMarkdown(detail.inheritor) + '\n\n';
|
|
|
}
|
|
|
|
|
|
// 传习所
|
|
|
if (detail.ichSitesList && detail.ichSitesList.length > 0)
|
|
|
- md += `相关非遗传习所: ${detail.ichSitesList.map(site => site.title).join('、')}\n\n`;
|
|
|
+ md += `${item.title}相关非遗传习所: ${detail.ichSitesList.map(site => site.title).join('、')}\n\n`;
|
|
|
|
|
|
// 同级别项目
|
|
|
if (detail.otherLevel && detail.otherLevel.length > 0)
|
|
|
- md += '其他级别非遗项目: ' + detail.otherLevel.map(project => project.title).join('、') + `\n\n`;
|
|
|
+ md += `${item.title}其他级别: ` + detail.otherLevel.map(project => project.levelText).join('、') + `\n\n`;
|
|
|
+
|
|
|
+ // 传承谱系
|
|
|
+ if (detail.pedigree) {
|
|
|
+ md += `${item.title}的传承谱系: ` + htmlToMarkdown(detail.pedigree as string) + '\n\n';
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
@@ -208,8 +206,7 @@ async function generateMarkdownInheritor(subDir: string) {
|
|
|
if (item.desc)
|
|
|
md += `${item.desc}\n\n`;
|
|
|
md += `## 基本信息\n\n`;
|
|
|
- md += `类型:非遗传承人\n\n`;
|
|
|
-
|
|
|
+ md += `${item.title}类型:非遗传承人\n`;
|
|
|
function addRow(key: string, value: any) {
|
|
|
if (value)
|
|
|
md += `- ${key}: ${value}\n`;
|
|
|
@@ -223,7 +220,7 @@ async function generateMarkdownInheritor(subDir: string) {
|
|
|
addRow('传承人级别', item.detail?.batchText);
|
|
|
addRow('公布批次', item.detail?.batchText);
|
|
|
|
|
|
- md += `\n## 数据库索引ID\n\n`;
|
|
|
+ md += `\n## ${item.title}数据库索引ID\n\n`;
|
|
|
md += `- 类型: inheritor\n`;
|
|
|
md += `- ID: ${item.id || '无'}\n\n`;
|
|
|
|
|
|
@@ -232,30 +229,22 @@ async function generateMarkdownInheritor(subDir: string) {
|
|
|
const detail = item.detail as GetContentDetailItem;
|
|
|
// 简介
|
|
|
if (detail.intro) {
|
|
|
- md += `## 简介\n\n`;
|
|
|
+ md += `## ${item.title}简介\n\n`;
|
|
|
md += htmlToMarkdown(detail.intro) + '\n\n';
|
|
|
}
|
|
|
if (detail.content) {
|
|
|
- md += `## 详情\n\n`;
|
|
|
md += htmlToMarkdown(detail.content) + '\n\n';
|
|
|
}
|
|
|
// 奖项
|
|
|
if (detail.prize) {
|
|
|
- md += `## 奖项\n\n`;
|
|
|
md += htmlToMarkdown(detail.prize as string) + '\n\n';
|
|
|
}
|
|
|
// 相关项目
|
|
|
- if (detail.associationMeList && detail.associationMeList.length > 0) {
|
|
|
- md += `## 相关项目\n\n`;
|
|
|
- md += detail.associationMeList.map(project => project.title).join('、');
|
|
|
- md += `\n\n`;
|
|
|
- }
|
|
|
+ if (detail.associationMeList && detail.associationMeList.length > 0)
|
|
|
+ md += `${item.title}相关项目${detail.associationMeList.map(project => project.title).join('、')}\n\n`;
|
|
|
// 传习所
|
|
|
- if (detail.ichSitesList && detail.ichSitesList.length > 0) {
|
|
|
- md += `## 相关传习所\n\n`;
|
|
|
- md += detail.ichSitesList.map(site => site.title).join('、');
|
|
|
- md += `\n\n`;
|
|
|
- }
|
|
|
+ if (detail.ichSitesList && detail.ichSitesList.length > 0)
|
|
|
+ md += `${item.title}相关非遗传习所: ${detail.ichSitesList.map(site => site.title).join('、')}\n\n`;
|
|
|
}
|
|
|
|
|
|
await writeFile(path.join(subDir, `${sanitizeFileNameAdvanced(item.title) ||item.id}.md`), md);
|
|
|
@@ -288,7 +277,7 @@ async function generateMarkdownArtifact(subDir: string) {
|
|
|
if (item.desc)
|
|
|
md += `${item.desc}\n\n`;
|
|
|
md += `## 基本信息\n\n`;
|
|
|
- md += `类型:非遗传承人\n\n`;
|
|
|
+ md += `类型:非遗文物\n`;
|
|
|
|
|
|
function addRow(key: string, value: any) {
|
|
|
if (value)
|