Skip to content

tag release #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 74 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
419727a
ERB: Managed to format first example
davidwessman May 14, 2023
2cc26ac
Format all ruby files
davidwessman May 14, 2023
45d7f45
First implementation of blocks
davidwessman May 18, 2023
0877f91
Merge pull request #1 from davidwessman/blocks
davidwessman May 18, 2023
a51e673
Handles basic vue-components (#2)
davidwessman May 19, 2023
4deaeb1
Changes register_handler
davidwessman May 19, 2023
7320b93
Handles empty and invalid files (#3)
davidwessman May 19, 2023
c87ffc4
Handles attribute names like vue events `@click` (#4)
davidwessman May 19, 2023
e2f8307
Adds ErbUnless to handle `unless` syntax (#5)
davidwessman May 20, 2023
c26791e
Handles more formats for ERB syntax (#6)
davidwessman May 20, 2023
6d31d98
Keep blank lines (#7)
davidwessman May 20, 2023
d56cf87
Support full layouts and doctype (#8)
davidwessman May 20, 2023
995ed0f
Changes error handling (#9)
davidwessman May 21, 2023
ac9b4d3
Handles edge cases where blocks failed to parse (#10)
davidwessman May 21, 2023
e4d42a1
Adds test for parsing unmatched quotes (#11)
davidwessman May 21, 2023
23a3056
Doctype: Handles casing (#12)
davidwessman May 21, 2023
b8e0e0c
ERB: Consider newlines before parsing the code (#13)
davidwessman May 21, 2023
10c73d0
Handles HTML-comments (#14)
davidwessman May 21, 2023
dc3ab8d
Handles non-ascii ERB-code (#15)
davidwessman May 25, 2023
df4acbf
Support quotes in HTML-text (#16)
davidwessman May 26, 2023
526b80a
Allow html attribute to start with @:# (#17)
davidwessman May 26, 2023
1894714
Handles dot, dash and underscore in attribute names (#18)
davidwessman May 26, 2023
ad3647e
HTML: Handles attribute values without quotes (#19)
davidwessman May 26, 2023
412b54f
Adds script for parsing all .html.erb and output (#20)
davidwessman May 28, 2023
357e8e5
Failing to format long if-statements multiple times (#21)
davidwessman May 28, 2023
b366e80
Changed how blocks are formatted (#22)
davidwessman May 28, 2023
9c929ab
Changes print width if erb tag has IfNode (#23)
davidwessman May 28, 2023
3be3202
Fixes handling of comments in ERB (#24)
davidwessman Jun 1, 2023
12b5e01
Handles formatting of IfOp (#25)
davidwessman Jun 3, 2023
f310a7b
Updates README (#26)
davidwessman Jun 4, 2023
743db1e
Update issue templates (#27)
davidwessman Jun 4, 2023
4cad3d7
Updates README and gemspec (#29)
davidwessman Jun 4, 2023
b18b871
Update issue templates
davidwessman Jun 4, 2023
8028145
Handles Alpine.js syntax (#31)
davidwessman Jun 6, 2023
b67eb2b
Github Actions: Adds ruby matrix (#33)
davidwessman Jun 18, 2023
15b11a5
Adds support for case-when-statements (#32)
davidwessman Jun 18, 2023
927f3c4
Github Actions: Fixes triggers (#34)
davidwessman Jun 18, 2023
1c2f658
Handles ternaries as arguments (#36)
davidwessman Jun 22, 2023
36da1d2
Bump minitest from 5.18.0 to 5.18.1 (#35)
dependabot[bot] Jun 22, 2023
582e694
Setup gem and tag v0.9.0 (#37)
davidwessman Jun 22, 2023
8b5aca9
Handles ERB-tags with multiple statements (#38)
davidwessman Jun 28, 2023
b43c4d6
v0.9.1 (#39)
davidwessman Jun 28, 2023
7a4c3bd
Handle whitespace in HTML-strings with ERB (#40)
davidwessman Jun 30, 2023
3dbc3d9
v0.9.2 2023-06-30 (#41)
davidwessman Jun 30, 2023
98227e3
Format empty html-tags on one line if possible (#42)
davidwessman Jun 30, 2023
bf18cbe
0.9.4: Format empty HTML-tags as a group (#43)
davidwessman Jul 1, 2023
aa97395
Fixes bundle warnings (#44)
davidwessman Jul 2, 2023
f89f7a0
v0.9.5 - Fixes formatting of ruby comment in ERB-tag (#45)
davidwessman Jul 2, 2023
bec4339
Adds pre-commit hooks using Husky (#46)
davidwessman Jul 2, 2023
20e4ec4
Removes unused breakable(force: true) (#49)
davidwessman Jul 21, 2023
4ac2a14
Adds handler for .html.erb (#52)
davidwessman Aug 12, 2023
71f6d23
Bump minitest from 5.18.1 to 5.19.0 (#50)
dependabot[bot] Aug 12, 2023
c311c54
Refactor line breaks and whitespace (#51)
davidwessman Aug 19, 2023
0a513a5
Tests: Refactors test cases and namings (#53)
davidwessman Aug 20, 2023
7679304
Handles self-closing new lines (#54)
davidwessman Aug 20, 2023
375d720
Release v0.10.0 (#55)
davidwessman Aug 20, 2023
cf23af0
Handles doctype more freely (#56)
davidwessman Aug 20, 2023
0cd3195
Handles empty documents and leading new lines (#57)
davidwessman Aug 22, 2023
67cc3e9
Handles trailing whitespace in char data (#58)
davidwessman Aug 22, 2023
f24718a
Release v0.10.2 (#59)
davidwessman Aug 22, 2023
f8559fe
Supports ERB-tags with if-else-end in same tag (#61)
davidwessman Aug 27, 2023
605300d
Avoid grouping single ERB-tags and handle ERB-comments with newlines …
davidwessman Aug 27, 2023
d2b7eea
Release v0.10.4 (#63)
davidwessman Aug 28, 2023
56470a8
Handles ERB-tag inside HTML tags (#64)
davidwessman Aug 30, 2023
c2f2a05
Handles indentation for multiline ERB-comments (#65)
davidwessman Aug 30, 2023
bad2142
Handle do-arguments in ERB-tags and release 0.10.5 (#67)
davidwessman Sep 3, 2023
9e55b88
Update formatting-report.md
davidwessman Sep 3, 2023
a348c86
ErbContent: Adds value to elements (#69)
davidwessman Sep 18, 2023
e386ec5
Bump minitest from 5.19.0 to 5.20.0 (#68)
dependabot[bot] Sep 18, 2023
f2269fd
Removes auto-merge workflow (#70)
davidwessman Sep 18, 2023
9ad25b5
Bump syntax_tree from 6.1.1 to 6.2.0 (#71)
dependabot[bot] Apr 23, 2024
f0e51e5
Bump rake from 13.0.6 to 13.1.0 (#72)
dependabot[bot] Apr 23, 2024
b91d2b8
Allow html void tags (#73)
rdimartino Apr 23, 2024
edc8267
Release v0.11.0
davidwessman Apr 23, 2024
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
37 changes: 37 additions & 0 deletions .github/ISSUE_TEMPLATE/formatting-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
name: Formatting report
about: Create a report to help us improve
title: "[Formatting] "
labels: bug
assignees: davidwessman

---

<details>
<summary>ERB-snippet</summary>

```html
<% code %>
```
</details>

<details>
<summary>Expected formatting</summary>

```html
<% code %>
```
</details>
<details>
<summary>Actual formatting</summary>

```html
<% code %>
```
</details>

## Comment

## Versions
syntax_tree:
syntax_tree-erb:
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/general.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: General
about: General issues
title: ''
labels: ''
assignees: ''

---


22 changes: 0 additions & 22 deletions .github/workflows/auto-merge.yml

This file was deleted.

35 changes: 24 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,33 @@
name: Main
on:
- push
- pull_request_target
workflow_dispatch:
push:
branches:
- main

pull_request:
types: [opened, synchronize, reopened]
jobs:
ci:
strategy:
fail-fast: false
matrix:
ruby:
- "3.0"
- "3.1"
- "3.2"
- "3.3"
name: CI
runs-on: ubuntu-latest
env:
CI: true
steps:
- uses: actions/checkout@master
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: '3.1'
- name: Test
run: |
bundle exec rake test
bundle exec rake stree:check
- uses: actions/checkout@master
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
ruby-version: ${{ matrix.ruby }}
- name: Test
run: |
bundle exec rake test
bundle exec rake stree:check
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
/spec/reports/
/tmp/

test.xml
test.erb
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ruby 3.2.3
25 changes: 25 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "ruby_lsp",
"name": "Debug file",
"request": "launch",
"program": "ruby ${file}"
},
{
"type": "ruby_lsp",
"name": "Debug test",
"request": "launch",
"program": "ruby -Itest ${relativeFile}"
},
{
"type": "ruby_lsp",
"name": "Debug attach",
"request": "attach"
}
]
}
121 changes: 117 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,124 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a

## [Unreleased]

## [0.1.0] - 2022-05-25
## [0.11.0] - 2024-04-23

- ErbContent now has its value as child_nodes instead of empty array.
- Allow html void tags and format self-closing tags

## [0.10.5] - 2023-09-03

- Handle ERB-tags inside HTML-tags, like `<div <%= "class='foo'" %>>`
- Handles indentation for multiline ERB-comment
- Handles spaces between do-arguments and ERB-tags

## [0.10.4] - 2023-08-28

- Avoid grouping single tags
- Handle multiline ERB-comments

## [0.10.3] - 2023-08-27

## Fixes

- Allows parsing ERB-tags with if, else and end in the same tag

```erb
<%= if true
what
end %>
```

This opens the possibility for formatting all if-statements with SyntaxTree properly
and removes the fix where any if-statement was force to one line.

## [0.10.2] - 2023-08-22

### Fixes

- Handles formatting empty documents and removing leading new-linews in files with content.
- Removes trailing whitespace from char data if it is the last element in a document, block or group.

## [0.10.1] - 2023-08-20

### Added

- Allow `DOCTYPE` to be after other tags, to work with e.g. ERB-tags on first line.

## [0.10.0] - 2023-08-20

- Changes how whitespace and newlines are handled.
- Supports syntax like:

```erb
<%= part %> / <%= total %> (<%= percentage %>%)
```

## [0.9.5] - 2023-07-02

- Fixes ruby comment in ERB-tag included VoidStatement
Example:

```erb
<% # this is a comment %>
```

Output:

```diff
-<%
-
- # this is a comment
-%>
+<% # this is a comment %>
```

- Updates versions in Bundler

## [0.9.4] - 2023-07-01

- Inline even more empty HTML-tags

```diff
<three-word-component
:attribute1
:attribute2
:attribute3="value"
->
-</three-word-component>
+></three-word-component>
```

## [0.9.3] - 2023-06-30

- Print empty html-tags on one line if possible

## [0.9.2] - 2023-06-30

- Handle whitespace in HTML-strings using ERB-tags

## [0.9.1] - 2023-06-28

- Handle formatting of multi-line ERB-tags with more than one statement.

## [0.9.0] - 2023-06-22

### Added

- 🎉 Initial release! 🎉
- 🎉 First version based on syntax_tree-xml 🎉.
- Can format a lot of .html.erb-syntax and works as a plugin to syntax_tree.
- This is still early and there are a lot of different weird syntaxes out there.

[unreleased]: https://github.com/ruby-syntax-tree/syntax_tree-xml/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/ruby-syntax-tree/syntax_tree-xml/compare/c34baa...v0.1.0
[unreleased]: https://github.com/davidwessman/syntax_tree-erb/compare/v0.10.5...HEAD
[0.10.5]: https://github.com/davidwessman/syntax_tree-erb/compare/v0.10.4...v0.10.5
[0.10.4]: https://github.com/davidwessman/syntax_tree-erb/compare/v0.10.3...v0.10.4
[0.10.3]: https://github.com/davidwessman/syntax_tree-erb/compare/v0.10.2...v0.10.3
[0.10.2]: https://github.com/davidwessman/syntax_tree-erb/compare/v0.10.1...v0.10.2
[0.10.1]: https://github.com/davidwessman/syntax_tree-erb/compare/v0.10.0...v0.10.1
[0.10.0]: https://github.com/davidwessman/syntax_tree-erb/compare/v0.9.5...v0.10.0
[0.9.5]: https://github.com/davidwessman/syntax_tree-erb/compare/v0.9.4...v0.9.5
[0.9.4]: https://github.com/davidwessman/syntax_tree-erb/compare/v0.9.3...v0.9.4
[0.9.3]: https://github.com/davidwessman/syntax_tree-erb/compare/v0.9.2...v0.9.3
[0.9.2]: https://github.com/davidwessman/syntax_tree-erb/compare/v0.9.1...v0.9.2
[0.9.1]: https://github.com/davidwessman/syntax_tree-erb/compare/v0.9.0...v0.9.1
[0.9.0]: https://github.com/davidwessman/syntax_tree-erb/compare/419727a73af94057ca0980733e69ac8b4d52fdf4...v0.9.0
26 changes: 14 additions & 12 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
PATH
remote: .
specs:
syntax_tree-xml (0.1.0)
prettier_print (>= 1.0.2)
syntax_tree (>= 4.0.1)
w_syntax_tree-erb (0.11.0)
prettier_print (~> 1.2, >= 1.2.0)
syntax_tree (~> 6.1, >= 6.1.1)

GEM
remote: https://rubygems.org/
specs:
docile (1.4.0)
minitest (5.18.0)
minitest (5.20.0)
prettier_print (1.2.1)
rake (13.0.6)
rake (13.1.0)
simplecov (0.22.0)
docile (~> 1.1)
simplecov-html (~> 0.11)
simplecov_json_formatter (~> 0.1)
simplecov-html (0.12.3)
simplecov_json_formatter (0.1.4)
syntax_tree (6.1.1)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)

PLATFORMS
arm64-darwin-21
arm64-darwin-23
x86_64-darwin-21
x86_64-darwin-22
x86_64-linux

DEPENDENCIES
bundler
minitest
rake
simplecov
syntax_tree-xml!
bundler (~> 2)
minitest (~> 5)
rake (~> 13)
simplecov (~> 0.22)
w_syntax_tree-erb!

BUNDLED WITH
2.3.6
2.4.1
Loading