Commit Graph
19 Commits
Author SHA1 Message Date
Georgii Dolzhykov 8846448b85 Handlebars: fix formatting of attributes (#10145)
* Handlebars: fix formatting of attributes

* Add group only for class

* Add changelog

* Update clean.js

* Simplify ConcatStatement

* Lowercase attr name in clean

* Use text instead of n.chars
2021-01-28 23:45:08 +02:00
Cyrille David c8cbbb0a79 handlebars: Support htmlWhitespaceSensitivity=strict option (2/3) (#9885)
* hbs: Add a strict mode

* Fix lint (after concat removal)

* Another lint error
2021-01-18 15:49:39 +02:00
Cyrille David 554d45ea20 handlebars: Print final blockParam on its own line (#9978) 2021-01-13 12:02:47 +08:00
Cyrille David fbe57068e7 Handlebars: Add tests for ignore and strict modes (1/3) (#9883) 2020-12-21 17:04:18 +08:00
Juriy Zaytsevandfisker 90abbb7924 [Glimmer] Preserve tilde comments (#9082)
Co-authored-by: fisker <lionkay@gmail.com>
2020-11-24 14:45:03 +08:00
3b5f2de176 Build(deps): Bump @glimmer/syntax from 0.62.1 to 0.62.3 (#9403)
Co-authored-by: Cyrille David <dcyriller@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: fisker <lionkay@gmail.com>
2020-10-15 19:42:02 +08:00
Cyrille David 8013e510cc handlebars: Remove duplicated tests (#9020) 2020-08-22 11:35:24 +08:00
Cyrille ed9d399a47 handlebars: Do not format html element attributes but class (#8677) 2020-07-24 00:40:35 +08:00
Cyrille 2ff388f19a Add a test (#8721) 2020-07-13 18:25:52 +03:00
Michał Staśkiewicz aa1088fbd7 Handlebars: Fix incorrect classic component syntax formatting (#8593)
* Test: Add test addressing #8584

* Fix: Resolves problem with incorrect component formatting (#8584)

* Docs: Add changelog note

* Test: Add test for yield formatting case

* Fix: Fix handlebars yield opening tag break

* Test: Add case for any helper with params

* Fix: Fix opening tag for every helper with params

* Chore: Revert whitespaces

* Chore: Revert whitespaces in tests
2020-06-24 23:55:59 +03:00
Cyrille David bff049fd96 handlebars: Support escaping a mustache with a backslash (#8634)
* Add a failing test

* Support escaping a mustache with `\`

It is documented in handlebarjs documentation here:
https://handlebarsjs.com/guide/expressions.html#escaping-handlebars-expressions

* Preprocess TextNode to adjust the need of backslashes

Given that template:
```hbs
a non-escaped mustache: \\\{{helper}}
```

Glimmer parser will produce two body nodes:
- a TextNode where `node.chars === "a non-escaped mustache: \\\\"`
- a MustacheStatement for `{{helper}}`

In order to correctly print the input, we need to adjust the TextNode to
`node.chars === "a non-escaped mustache: \\\\\\"`, namely we have to add
a backslash that is removed by Glimmer parser. This is this commit
purpose.

* Add changelog note
2020-06-24 23:55:02 +03:00
Cyrille David 40ade963a8 Respect singleQuote option around attribute value more complex than a bare text (#8375)
* Apply singleQuote option to attributes

* Add changelog
2020-05-25 13:18:49 +03:00
fisker Cheung ed3eeb82f8 Test: add parser check (#8256) 2020-05-08 10:56:09 +08:00
fisker Cheung f8c5b1fd1d Categorize tests part 2 (#8248)
* Categorize tests (yaml, markdown)

* Categorize tests (handlebars)

* Categorize tests (graphql)

* Categorize tests (typescript)

* Categorize tests (json)

* Categorize tests (jsx)
2020-05-07 23:54:44 +08:00
Cyrille David dd64842375 chore(Handlebars): Refactor test suite (#6378) 2019-08-12 10:35:13 -03:00
Joffrey JAFFEUX b557dc3603 [Glimmer/Handlebars] Forces multilines print when almost at max length (#6249) 2019-07-22 10:39:18 -03:00
Gavin Joyce ff7bc1c008 [Glimmer] improve text/mustache formatting (#6186) 2019-06-14 12:11:47 -03:00
Ika 4af3dd4b07 test: improve snapshots (#5521)
- before
  ```
  ${input}${"~".repeat(printWidth)}
  ${output}
  ```
- after
  ```
  ===options===
  ${options}
  ${" ".repeat(printWidth)}| printWidth
  ====input====
  ${input}
  ===output====
  ${output}
  =============
  ```
2018-11-25 16:21:14 +08:00
Evilebot Tnawi 8b0bdf52be [WIP] feat: html support (#4753)
* feat: html support

* fix: support empty lines between children

* refactor: isScriptTagNode util

* refactor: rename `glimmer` and `handlebars` tests

* fix don't add newline after `directive` node

* fix: support `pre` tag

* fix: don't trim comments content

* fix: `script` and `style` tags output

* feat: indent `head` and `body` inside `html`

* fix: better handle quotes around attribute value

* feat: better handle embed

* tests: svg into html

* fix: better handle boolean and empty attributes

* chore(deps): update `parse5` to latest version

* fix: better handle empty attribute

* tests: fix

* fix: extra newline in multiline node

* fix: print `pre` and `textarea` in right way

* tests: xhtml doctype

* fix: use `>` instead `/>`

* tests: case

* refactor: remove `toLowerCase()`

* feat: support `prettier-ignore`

* tests: empty `script` and `style` tags

* fix: clean

* tests: refactor and more
2018-09-13 07:06:49 -06:00