Skip to content

Commit 13a2e2d

Browse files
committed
Fix rendering of CLI help-message
Fixes #124
1 parent d79e6af commit 13a2e2d

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/.vuepress/plugins/update-handlebars-cli-help.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export function updateHandlebarsCliHelp() {
88
return {
99
name: "update the 'handlebars --help' output.",
1010
extendMarkdown(md) {
11-
md.block.ruler.before("fence", "handlebars_help_output", function(state, startLine, endLine, silent) {
11+
md.block.ruler.before("fence", "handlebars_help_output", function (state, startLine, endLine, silent) {
1212
const pos = state.bMarks[startLine] + state.tShift[startLine];
1313
const max = state.eMarks[startLine];
1414
if (state.src.slice(pos, max) !== "!HANDLEBARS_HELP!") {
@@ -29,17 +29,17 @@ export function updateHandlebarsCliHelp() {
2929
token.map = [startLine, startLine + 1];
3030
return true;
3131
});
32-
}
32+
},
3333
};
3434
}
3535

3636
function getHandlebarsHelpFromCli() {
3737
const handlebarsCli = require.resolve("handlebars/bin/handlebars");
3838
const nodeExecutable = process.argv[0];
39-
const { stderr } = cp.spawnSync(nodeExecutable, [handlebarsCli, "--help"], {
39+
const { stdout } = cp.spawnSync(nodeExecutable, [handlebarsCli, "--help"], {
4040
argv0: "handlebars",
4141
stdio: ["pipe", "pipe", "pipe"],
42-
encoding: "utf-8"
42+
encoding: "utf-8",
4343
});
44-
return stderr.replace(/^Usage: \S+ \S+/m, "handlebars");
44+
return stdout;
4545
}

src/installation/precompilation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ time, the `--knownOnly` option provides the smallest generated code that also pr
4949
If using the precompiler's normal mode, the resulting templates will be stored to the Handlebars.templates object using
5050
the relative template name sans the extension. These templates may be executed in the same manner as templates. If using
5151
the simple mode the precompiler will generate a single javascript method. To execute this method it must be passed to
52-
the Handlebars.template method and the resulting object may be used as normal.
52+
the `Handlebars.template()` method and the resulting object may be used as normal.
5353
5454
## Precompiling Templates Inside NodeJS
5555
@@ -75,7 +75,7 @@ Finally, you can reference these templates dynamically in your Javascript.
7575
7676
```js
7777
var result = Handlebars.partials["test1"]({ name: "yourname" });
78-
//do whatever you want with the result
78+
// do whatever you want with the result
7979
```
8080
8181
## Integrations

src/zh/installation/precompilation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ Handlebars 编译器将优化对这些 helper 的访问以提高性能。当所
4646
4747
如果使用预编译器的 normal 模式,则预编译结果将存储到 Handlebars.templates 对象下对应的模板名称(不带扩展名)的对象中。这
4848
些预编译模板可以以和普通模板相同的方式执行。如果使用 simple 模式,预编译器将生成一个 JavaScript 方法。要执行此方法,必须
49-
将其传递给 Handlebars.template 方法,生成的对象也可以以相同的方式使用。
49+
将其传递给 `Handlebars.template()` 方法,生成的对象也可以以相同的方式使用。
5050
5151
## 在 NodeJS 中预编译模板
5252

0 commit comments

Comments
 (0)