Skip to content

Commit

Permalink
Fix parameter annotations <code> escaping to to Nunjucks migration
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalduez committed Jul 19, 2019
1 parent 107f5c7 commit 731e87b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [unreleased]
## Fixed
* Fix parameter annotations `<code>` escaping to to Nunjucks migration.

## [2.8.2] - 2019-05-08
### Fixed
Expand Down
5 changes: 1 addition & 4 deletions src/nunjucks.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import path from 'path'

let nunjucksEnv = nunjucks.configure(path.resolve(__dirname, '..', 'views'))

const safe = fn =>
(fn.safe = true) && fn

const isColor = value => {
try {
chroma(value)
Expand Down Expand Up @@ -63,7 +60,7 @@ const maybeYiqContrast = color =>

nunjucksEnv.addFilter('in', (key, object) => key in object)
nunjucksEnv.addFilter('is_color', isColor)
nunjucksEnv.addFilter('display_as_type', safe(displayAsType))
nunjucksEnv.addFilter('display_as_type', displayAsType)
nunjucksEnv.addFilter('yiq', maybeYiqContrast)
nunjucksEnv.addFilter('pluralize', pluralize)
nunjucksEnv.addFilter('unescape', unescape)
Expand Down
2 changes: 1 addition & 1 deletion views/includes/annotations/parameter.html.njk
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
{% if parameter.type == '*' %}
Any
{% else %}
{{ parameter.type | display_as_type }}
{{ parameter.type | display_as_type | safe }}
{% endif %}
</code>
</td>
Expand Down

0 comments on commit 731e87b

Please sign in to comment.