Browse Source

import tags fix

pull/1273/head
codecalm 2 years ago
parent
commit
28acdaff7f
  1. 6
      .build/import-tags.mjs

6
.build/import-tags.mjs

@ -8,7 +8,7 @@ const data = JSON.parse(fs.readFileSync(join(HOME_DIR, 'new/tags.json'), 'utf-8'
for (const [key, tags] of Object.entries(data)) {
const filename = join(HOME_DIR, `src/_icons/${key}.svg`), tagsInline = tags
const filename = join(HOME_DIR, `icons/outline/${key}.svg`), tagsInline = tags
.join(' ')
.toLowerCase()
.split(' ')
@ -17,10 +17,10 @@ for (const [key, tags] of Object.entries(data)) {
if (key && tags.length) {
let data = fs.readFileSync(filename).toString()
data = data.replace(/(---[\s\S]+?---)/, function (m, headerContent) {
data = data.replace(/(\<\!--[\s\S]+?-->)/, function (m, headerContent) {
headerContent = headerContent.replace(/tags: .*\n/, '')
headerContent = headerContent.replace(/---/, `---\ntags: [${tagsInline}]`)
headerContent = headerContent.replace(/\<\!--/, `<!--\ntags: [${tagsInline}]`)
return headerContent
})

Loading…
Cancel
Save