eleventy-plugin-asciidoc 4.0.2 → 4.0.3
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/lib/eleventy-asciidoc.js +17 -9
- package/package.json +11 -11
package/lib/eleventy-asciidoc.js
CHANGED
|
@@ -77,15 +77,7 @@ function eleventyAsciidoctor(convertOptions = {}) {
|
|
|
77
77
|
...convertOptions,
|
|
78
78
|
};
|
|
79
79
|
|
|
80
|
-
const compile = (
|
|
81
|
-
if (str) {
|
|
82
|
-
// So if str has a value, it's a permalink (which can be a string or a function)
|
|
83
|
-
debug(`Permalink: ${str}`);
|
|
84
|
-
return typeof str === "function"
|
|
85
|
-
? str(data)
|
|
86
|
-
: nunjucks.renderString(str, data);
|
|
87
|
-
}
|
|
88
|
-
|
|
80
|
+
const compile = (_contents, inputPath) => (data) => {
|
|
89
81
|
debug(`Reading ${inputPath}`);
|
|
90
82
|
const { content } = readFileSync(inputPath);
|
|
91
83
|
|
|
@@ -134,12 +126,28 @@ function eleventyAsciidoctor(convertOptions = {}) {
|
|
|
134
126
|
}
|
|
135
127
|
};
|
|
136
128
|
|
|
129
|
+
const permalink = function (contents, _inputPath) {
|
|
130
|
+
if (contents && typeof contents === "string") {
|
|
131
|
+
return async (data) => {
|
|
132
|
+
const permalink = nunjucks.renderString(contents, data);
|
|
133
|
+
debug("permalink: ", permalink);
|
|
134
|
+
return permalink;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Fallbacks to Eleventy default behaviour
|
|
139
|
+
return contents;
|
|
140
|
+
};
|
|
141
|
+
|
|
137
142
|
const getData = generateGetData(options);
|
|
138
143
|
|
|
139
144
|
return {
|
|
140
145
|
read: false,
|
|
141
146
|
getData,
|
|
142
147
|
compile,
|
|
148
|
+
compileOptions: {
|
|
149
|
+
permalink,
|
|
150
|
+
},
|
|
143
151
|
};
|
|
144
152
|
}
|
|
145
153
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eleventy-plugin-asciidoc",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"description": "Adds support for AsciiDoc to Eleventy",
|
|
5
5
|
"main": ".eleventy.js",
|
|
6
6
|
"funding": "https://github.com/sponsors/saneef/",
|
|
@@ -27,22 +27,22 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@asciidoctor/core": "^3.0.4",
|
|
30
|
-
"debug": "^4.
|
|
30
|
+
"debug": "^4.4.0",
|
|
31
31
|
"gray-matter": "^4.0.3",
|
|
32
32
|
"nunjucks": "^3.2.4"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@11ty/eleventy": "^
|
|
36
|
-
"ava": "^6.
|
|
35
|
+
"@11ty/eleventy": "^3.0.0",
|
|
36
|
+
"ava": "^6.2.0",
|
|
37
37
|
"eslint": "^8.56.0",
|
|
38
|
-
"eslint-config-prettier": "^
|
|
38
|
+
"eslint-config-prettier": "^10.0.1",
|
|
39
39
|
"eslint-config-xo-space": "^0.35.0",
|
|
40
|
-
"eslint-plugin-prettier": "^5.
|
|
41
|
-
"husky": "^9.
|
|
42
|
-
"lint-staged": "^15.
|
|
43
|
-
"nyc": "^
|
|
44
|
-
"prettier": "^3.2
|
|
45
|
-
"rimraf": "^
|
|
40
|
+
"eslint-plugin-prettier": "^5.2.3",
|
|
41
|
+
"husky": "^9.1.7",
|
|
42
|
+
"lint-staged": "^15.4.3",
|
|
43
|
+
"nyc": "^17.1.0",
|
|
44
|
+
"prettier": "^3.5.2",
|
|
45
|
+
"rimraf": "^6.0.1"
|
|
46
46
|
},
|
|
47
47
|
"lint-staged": {
|
|
48
48
|
"*.js": "eslint --cache --fix --ignore-pattern \"!.eleventy.js\"",
|