Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/userGuide/syntax/dates.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ The default output format is `"ddd D MMM"` e.g. Fri 6 Mar
{{ njcode('base1 | date(format2, 0)') }} :glyphicon-arrow-right: {{ base1 | date(format2, 0) }}<br/>
{{ njcode('base1 | date(format2, 10)') }} :glyphicon-arrow-right: {{ base1 | date(format2, 10) }}<br/>

#### Page variables
Dates can be supplied using [page variables](../reusingContents.html#variables) for convenience.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: page variables no longer supported via <variable> syntax, see #2283

#### Nunjucks variables
Dates can be supplied using [Nunjucks variables](../reusingContents.html#variables) for convenience.

Inside `variables.md` or referencing page:
Inside the `.md` file of a page:
```
{% raw %}{% set date_pagevar = "2020-03-06" %}{% endraw %}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@
<variable name="global_variable_overriding_included_variable">Global Variable Overriding Included Variable</variable>
<variable name="global_variable">Global Variable</variable>
<variable name="page_global_variable_overriding_page_variable">Global Variable Overriding Page Variable</variable>
<variable from="variable.json"></variable>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: removed as this way of importing does not work in variables.md

<variable name="base2">2019-01-01</variable>
<variable name="formatted_date">{{ base2 | date("ddd D MMM", 10) }}</variable>
4 changes: 4 additions & 0 deletions packages/cli/test/functional/test_site/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ Page Variable with {{ global_variable }}

**Test Page Variable and Included Variable Integrations**

{% set outerNunjucksVariable %}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: adding this because in testPageVariablesInInclude.md below we will test if this outer variable is leaking into the inner page.

Outer Nunjucks Variable
{% endset %}

<include src="testPageVariablesInInclude.md" />

# Heading with multiple keywords
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<variable name="example">
To inject this HTML segment in your MarkBind files, use {{ example }} where you want to place it.
More generally, surround the segment's id with double curly braces.
</variable>
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
**Outer Page Variable Should Not Leak Into Inner Pages**

{{ nested_page_variable or "Outer Page Variable Should Not Leak Into Inner Pages" }}
{{ outerNunjucksVariable or "Outer Page Variable Should Not Leak Into Inner Pages" }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: updating this because it appears to be outdated. we used to have nested_page_variable defined in index.md but that has been deleted for a long time. See yucheng11122017@2ddf00e
image

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<variable name="example">
To inject this HTML segment in your MarkBind files, use {{ example }} where you want to place it.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: for some reason there's no variables.md in this and the other site above, but we should include it to avoid unnecessary warning.

More generally, surround the segment's id with double curly braces.
</variable>
6 changes: 2 additions & 4 deletions packages/core/template/default/_markbind/variables.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<variable name="example">
To inject this HTML segment in your markbind files, use {{ example }} where you want to place it.
To inject this HTML segment in your MarkBind files, use {{ example }} where you want to place it.
More generally, surround the segment's id with double curly braces.
</variable>

<variable from="variables.json" />
</variable>
6 changes: 2 additions & 4 deletions packages/core/template/minimal/_markbind/variables.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<variable name="example">
To inject this HTML segment in your markbind files, use {{ example }} where you want to place it.
To inject this HTML segment in your MarkBind files, use {{ example }} where you want to place it.
More generally, surround the segment's id with double curly braces.
</variable>

<variable from="variables.json" />
</variable>