Skip to content

Commit

Permalink
Fix lstrip/rstrip configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
mxcl committed Nov 20, 2021
1 parent bc22ac5 commit 1777360
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 16 deletions.
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,12 @@ Which can be used in your template thusly:
```markdown
# Quotidian
- [ ] …
{% if env.doy % 2 == 0 -%}
{% if env.doy % 2 == 0 %}
- [ ] It’s an even-day; do sit-ups
{% else -%}
{% else %}
- [ ] It’s an odd-day; do press-ups
{% endif %}
<!--
Ending with `-%}` rather than `%}` “chomps” the extra newline
and stops your template rendering with gaps which GitHub will
interpret as a break in the list.
-->

{% if env.dow == 1 %}
# Hebdomadal
{% include "templates/mondays.md" %}
Expand Down
9 changes: 5 additions & 4 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26143,14 +26143,15 @@ __webpack_handle_async_dependencies__();
// templating code adapted from:
// https://github.com/JasonEtco/create-an-issue
function templater(template, github) {
const env = nunjucks__WEBPACK_IMPORTED_MODULE_0___default().configure({ autoescape: false });
const env = nunjucks__WEBPACK_IMPORTED_MODULE_0___default().configure({
trimBlocks: true,
lstripBlocks: true
});
env.addFilter('moment', (nunjucks_date_filter__WEBPACK_IMPORTED_MODULE_1___default()));
const templateVariables = {
github,
env: process.env,
timestamp: Date.now(),
trimBlocks: true,
lstripBlocks: true
timestamp: Date.now()
};
let { attributes, body } = front_matter__WEBPACK_IMPORTED_MODULE_2___default()(template);
body = env.renderString(body, templateVariables);
Expand Down
9 changes: 5 additions & 4 deletions src/templater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ import fm from 'front-matter'
// https://github.com/JasonEtco/create-an-issue

export function templater(template: string, github: any): {title: string, body: string} {
const env = nunjucks.configure({ autoescape: false })
const env = nunjucks.configure({
trimBlocks: true,
lstripBlocks: true
})
env.addFilter('moment', dateFilter)

const templateVariables = {
github,
env: process.env,
timestamp: Date.now(),
trimBlocks: true,
lstripBlocks: true
timestamp: Date.now()
}

interface FrontMatterAttributes {
Expand Down

0 comments on commit 1777360

Please sign in to comment.