[Glimmer] preserve html entities (#6234)

master
Gavin Joyce 2019-07-08 10:07:41 +01:00 committed by Simon Lydell
parent da0c6faeda
commit 12b8176d5d
6 changed files with 70 additions and 16 deletions

View File

@ -146,8 +146,31 @@ Previously, Prettier would sometimes ignore whitespace when formatting comments.
</div>
```
### Handlebars: Improve comment formatting ([#6234] by [@gavinjoyce])
Previously, Prettier would incorrectly decode HTML entiites.
<!-- prettier-ignore -->
```hbs
// Input
<p>
Some escaped characters: &lt; &gt; &amp;
</p>
// Output (Prettier stable)
<p>
Some escaped characters: < > &
</p>
// Output (Prettier master)
<p>
Some escaped characters: &lt; &gt; &amp;
</p>
```
[#6209]: https://github.com/prettier/prettier/pull/6209
[#6186]: https://github.com/prettier/prettier/pull/6186
[#6186]: https://github.com/prettier/prettier/pull/6206
[#6234]: https://github.com/prettier/prettier/pull/6234
[@duailibe]: https://github.com/duailibe
[@gavinjoyce]: https://github.com/gavinjoyce

View File

@ -17,7 +17,7 @@
"@angular/compiler": "7.2.9",
"@babel/code-frame": "7.0.0",
"@babel/parser": "7.2.0",
"@glimmer/syntax": "0.39.3",
"@glimmer/syntax": "0.41.0",
"@iarna/toml": "2.2.3",
"@typescript-eslint/typescript-estree": "1.10.2",
"angular-estree-parser": "1.1.5",

View File

@ -8,7 +8,8 @@ function parse(text) {
return glimmer(text, {
plugins: {
ast: []
}
},
mode: "codemod"
});
/* istanbul ignore next */
} catch (error) {

View File

@ -1290,6 +1290,35 @@ singleQuote: true
================================================================================
`;
exports[`html-entities.hbs 1`] = `
====================================options=====================================
parsers: ["glimmer"]
printWidth: 80
| printWidth
=====================================input======================================
<p>Some escaped characters: &lt; &gt; &amp;</p>
=====================================output=====================================
<p>
Some escaped characters: &lt; &gt; &amp;
</p>
================================================================================
`;
exports[`html-entities.hbs 2`] = `
====================================options=====================================
parsers: ["glimmer"]
printWidth: 80
singleQuote: true
| printWidth
=====================================input======================================
<p>Some escaped characters: &lt; &gt; &amp;</p>
=====================================output=====================================
<p>
Some escaped characters: &lt; &gt; &amp;
</p>
================================================================================
`;
exports[`literals.hbs 1`] = `
====================================options=====================================
parsers: ["glimmer"]

View File

@ -0,0 +1 @@
<p>Some escaped characters: &lt; &gt; &amp;</p>

View File

@ -718,25 +718,25 @@
lodash "^4.17.11"
to-fast-properties "^2.0.0"
"@glimmer/interfaces@^0.39.3":
version "0.39.3"
resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.39.3.tgz#1d46e1056c9ff3ce6174b82320893c027772e5f4"
integrity sha512-tmuZAUau8UbyGh4gLkpC6Vjdm0JP2dibAMMaU/yZG+SGSsQeT+bo+0XcEezscQDPihfXsBX4Z6yq98o15beYEA==
"@glimmer/interfaces@^0.41.0":
version "0.41.0"
resolved "https://registry.yarnpkg.com/@glimmer/interfaces/-/interfaces-0.41.0.tgz#3f571a181025406f29faed9006d0a914afb577b1"
integrity sha512-d0Ryj8iV3FiyMyT4QpwHNg2QFFEmdzI5cJFcbmC+OmuTe6eOQ52mLDlw1+D+a3ZDv8Jfj3l0QkEcEugCxDY+1Q==
"@glimmer/syntax@0.39.3":
version "0.39.3"
resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.39.3.tgz#a5220151b00c69fbd728e120dffc7f90fa5b4f24"
integrity sha512-Mb/d1hyWKZYANRPKoEGQ4wTc0kkcsjtxyN+J4ps2F1LQ5UKqJxDlgA/Tf9zXNHsd+A8dn25t5NIjQl7KIdsqOg==
"@glimmer/syntax@0.41.0":
version "0.41.0"
resolved "https://registry.yarnpkg.com/@glimmer/syntax/-/syntax-0.41.0.tgz#af033e48475e29a4784900c13695925d752f462d"
integrity sha512-sYmgUMdK0jX+3ZNX9C2TKvL1YZGsKIcXRicwnzoTC7F56z29CbSCc7o6Zf0CI4L2Q7FSnHDxldlSe48wBAr6vQ==
dependencies:
"@glimmer/interfaces" "^0.39.3"
"@glimmer/util" "^0.39.3"
"@glimmer/interfaces" "^0.41.0"
"@glimmer/util" "^0.41.0"
handlebars "^4.0.13"
simple-html-tokenizer "^0.5.7"
"@glimmer/util@^0.39.3":
version "0.39.3"
resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.39.3.tgz#f6b0417c4b0a30f4ea693990f466e3d1eb442d37"
integrity sha512-2tzpxdgaQxMu9bHFqTpGDBYDtSWJWQZkBCFfkzCmPrJuCis3YK7m9hzYIaow7CsVLnO44Xmur+Bpq6IM9gVFXw==
"@glimmer/util@^0.41.0":
version "0.41.0"
resolved "https://registry.yarnpkg.com/@glimmer/util/-/util-0.41.0.tgz#743fa455d1d7fa0ce29688e932c231a99c0752cf"
integrity sha512-aKmQy62eRFhOZET9XmTB8MOA32G1FmD4d9HWL21OfdcGM4IbguRrWLMQc2DRh1YOE2AaT0PBrFrPmpNwFp5tpQ==
"@iarna/toml@2.2.3":
version "2.2.3"