@tenjuu99/blog 0.2.44 → 0.2.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/lib/pageData.js +18 -16
  2. package/package.json +1 -1
package/lib/pageData.js CHANGED
@@ -57,27 +57,29 @@ const parseMetaData = (data) => {
57
57
  let isStringContinue = false
58
58
  let key, value
59
59
  for (const line of data.split('\n')) {
60
- const match = line.match(/^([a-zA-Z_]+):/)
61
- if (match) {
62
- key = match[1]
63
- value = line.slice(line.indexOf(':') + 1).trim()
64
- if (value === 'true' || value === 'false') {
65
- value = JSON.parse(value)
66
- } else {
67
- if (value.startsWith('config.')) {
68
- const envName = value.split('.').pop()
69
- eval(`value = config.${envName}`)
60
+ if (!isStringContinue) {
61
+ const match = line.match(/^([a-zA-Z_]+):/)
62
+ if (match) {
63
+ key = match[1]
64
+ value = line.slice(line.indexOf(':') + 1).trim()
65
+ if (value === 'true' || value === 'false') {
66
+ value = JSON.parse(value)
67
+ } else {
68
+ if (value.startsWith('config.')) {
69
+ const envName = value.split('.').pop()
70
+ eval(`value = config.${envName}`)
71
+ }
72
+ }
73
+ metaData[key] = value
74
+ if (typeof value === 'string' && value.indexOf('"') === 0) {
75
+ isStringContinue = true
70
76
  }
71
77
  }
72
- metaData[key] = value
73
- if (typeof value === 'string' && value.indexOf('"') === 0) {
74
- isStringContinue = true
75
- }
76
- } else if (key && isStringContinue) {
78
+ } else if (key) {
77
79
  metaData[key] = `${metaData[key]}\n${line}`
78
80
  if (line.trim().match(/"$/)) {
79
81
  isStringContinue = false
80
- metaData[key] = metaData[key].replace('"', '')
82
+ metaData[key] = metaData[key].trim().replace(/^"([^"]+)"$/i, '$1')
81
83
  }
82
84
  }
83
85
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenjuu99/blog",
3
- "version": "0.2.44",
3
+ "version": "0.2.45",
4
4
  "description": "blog template",
5
5
  "main": "index.js",
6
6
  "scripts": {