@tenjuu99/blog 0.2.8 → 0.2.9

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.
package/README.md CHANGED
@@ -89,7 +89,7 @@ blog.json を開いて、 `site_name` を変更します。
89
89
  "src_dir": "src",
90
90
  "dist_dir": "dist",
91
91
  "distribute_raw": "image",
92
- "helper": "helper/index.js"
92
+ "helper": "index.js"
93
93
  }
94
94
  ```
95
95
 
package/bin/dev-server CHANGED
@@ -50,6 +50,7 @@ const proceed = () => {
50
50
  })
51
51
  child.on('exit', (code, signal) => {
52
52
  console.error(`process exit: ${code}, SIGNAL: ${signal}`);
53
+ child.kill('SIGINT')
53
54
  })
54
55
 
55
56
  return child
package/lib/filter.js CHANGED
@@ -1,7 +1,4 @@
1
1
  import helper from '../lib/helper.js'
2
- import { srcDir } from './dir.js'
3
- import config from './config.js'
4
- import replaceVariablesFilter from './replaceVariablesFilter.js'
5
2
 
6
3
  /**
7
4
  * @param {string} condition
@@ -84,30 +81,6 @@ const replaceIfFilter = (text, variables) => {
84
81
  return text
85
82
  }
86
83
 
87
- /**
88
- * 配列を再帰的に順不同リストに変換する
89
- * @param {Array|string} arrayOrText
90
- * @returns {mixed}
91
- */
92
- const arrayToList = (arrayOrText) => {
93
- if (typeof arrayOrText === 'string') {
94
- return `<li>${arrayOrText}</li>`
95
- }
96
- if (Array.isArray(arrayOrText)) {
97
- let resultListText = '<ul>'
98
- for (const item of arrayOrText) {
99
- if (Array.isArray(item)) {
100
- resultListText += `<li>${arrayToList(item)}</li>`
101
- } else {
102
- resultListText += `<li>${item}</li>`
103
- }
104
- }
105
- resultListText += '</ul>'
106
- arrayOrText = resultListText
107
- }
108
- return arrayOrText
109
- }
110
-
111
84
  const replaceScriptFilter = async (text, variables) => {
112
85
  let replaced = text
113
86
  const scriptRegexp = new RegExp(/({script}|\<script\s.*type="ssg".*>)(?<script>[\s\S]*?)(\{\/script}|\<\/script>)/g)
@@ -127,9 +100,6 @@ const replaceScriptFilter = async (text, variables) => {
127
100
  case 'null':
128
101
  result = ''
129
102
  }
130
- if (Array.isArray(result)) {
131
- result = helper.arrayToList(result)
132
- }
133
103
  replaced = replaced.replace(script.replace, result)
134
104
  }
135
105
  return replaced
@@ -137,6 +107,5 @@ const replaceScriptFilter = async (text, variables) => {
137
107
 
138
108
  export {
139
109
  replaceIfFilter,
140
- replaceScriptFilter,
141
- replaceVariablesFilter
110
+ replaceScriptFilter
142
111
  }
package/lib/render.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  replaceIfFilter,
3
- replaceScriptFilter,
4
- replaceVariablesFilter
3
+ replaceScriptFilter
5
4
  } from './filter.js'
5
+ import replaceVariablesFilter from './replaceVariablesFilter.js'
6
6
  import includeFilter from './includeFilter.js'
7
7
  import { marked } from "marked";
8
8
  import { applyTemplate } from './applyTemplate.js'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenjuu99/blog",
3
- "version": "0.2.8",
3
+ "version": "0.2.9",
4
4
  "description": "blog template",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,3 @@
1
+ export function additionalHelper() {
2
+ return 'これは追加ヘルパーによって出力されているメッセージです。'
3
+ }
@@ -1,5 +1,5 @@
1
1
  import { allData } from '@tenjuu99/blog/lib/indexer.js'
2
- import { replaceVariablesFilter } from "@tenjuu99/blog/lib/filter.js";
2
+ import replaceVariablesFilter from '@tenjuu99/blog/lib/replaceVariablesFilter.js'
3
3
  import config from '@tenjuu99/blog/lib/config.js'
4
4
 
5
5
  export function readIndex (filter = null) {
@@ -115,10 +115,6 @@ export function renderIndex(pages, nodate = 'nodate', headingTag = 'h3') {
115
115
  return resultText.join('\n')
116
116
  }
117
117
 
118
- export function additionalHelper() {
119
- return 'これは追加ヘルパーによって出力されているメッセージです。'
120
- }
121
-
122
118
  export function isEditorEnabled() {
123
119
  return allData.editor && allData.editor.distribute
124
120
  }