Remove no-use code

This commit is contained in:
chris
2022-05-24 11:02:44 +08:00
parent add4313284
commit b365af80be
2 changed files with 38 additions and 87 deletions

View File

@@ -58,12 +58,15 @@ export class Upload2Notion {
async updateYamlInfo(yamlContent: string, fullPath: string, res: any) {
const yamlObj:any = yamlFrontMatter.loadFront(yamlContent);
const {url} = res.json
yamlObj.shareUrl = url;
yamlObj.link = url;
const __content = yamlObj.__content;
delete yamlObj.__content
const yamlhead = yaml.stringify(yamlObj)
const content = '---\n' +yamlhead +'\n---\n' + __content;
// if yamlhead hava last \n remove it
const yamlhead_remove_n = yamlhead.replace(/\n$/, '')
// if __content have start \n remove it
const __content_remove_n = __content.replace(/^\n/, '')
const content = '---\n' +yamlhead_remove_n +'\n---\n' + __content_remove_n;
//write content fo file
fs.writeFileSync(fullPath, content);