boxwood 0.62.0 → 0.63.0
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/index.js +14 -0
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -176,6 +176,9 @@ const render = (input, escape = true) => {
|
|
|
176
176
|
if (input.name === 'fragment') {
|
|
177
177
|
return render(input.children)
|
|
178
178
|
}
|
|
179
|
+
if (input.name === 'raw') {
|
|
180
|
+
return render(input.children, false)
|
|
181
|
+
}
|
|
179
182
|
if (SELF_CLOSING_TAGS.includes(input.name)) {
|
|
180
183
|
if (input.attributes) {
|
|
181
184
|
return `<${input.name} ` + attributes(input.attributes) + '>'
|
|
@@ -206,6 +209,16 @@ const fragment = (children) => {
|
|
|
206
209
|
return { name: 'fragment', children }
|
|
207
210
|
}
|
|
208
211
|
|
|
212
|
+
const raw = (children) => {
|
|
213
|
+
return { name: 'raw', children }
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
raw.load = function () {
|
|
217
|
+
const path = join(...arguments)
|
|
218
|
+
const content = readFileSync(path, 'utf8')
|
|
219
|
+
return raw(content)
|
|
220
|
+
}
|
|
221
|
+
|
|
209
222
|
const tag = (a, b, c) => {
|
|
210
223
|
if (a && b && c) {
|
|
211
224
|
const name = a
|
|
@@ -434,6 +447,7 @@ module.exports = {
|
|
|
434
447
|
doctype,
|
|
435
448
|
escape: escapeHTML,
|
|
436
449
|
fragment,
|
|
450
|
+
raw,
|
|
437
451
|
css,
|
|
438
452
|
js,
|
|
439
453
|
...nodes,
|