Closed csillikd closed 4 months ago
Agreed. Empty lines should be considered leading/trailing trivia instead of unrecognized nodes. [^1]
I don't plan on working on this soon, but I'm open to PRs :)
A couple of pointers towards a PR:
LeadingTrivia
and TrailingTrivia
properties are on individual nodes. I think it would make sense to move that to the abstract SectionChildIniNode
or even IniNode
.LeadingTrivia
and TrailingTrivia
properties are a single WhiteSpace
token. I would change that to an IImmutableList<IniToken>
.
GetHashCode
and Equals
impls.IniNode.NewLine
should still hold the last newline before the next node.=
or [
) should still result in UnrecognizedIniNode
s.UnrecognizedIniNode
has an internal IsBlank()
method. That probably isn't needed anymore after your change.[^1]: The third blank line in your example is not ignored. The final newline is included in the NewLine
property of your key-value node (I made the line endings explicit using ␊
):
```
␊
[section]␊
␊
key=value␊
```
If there were two line feeds at the end of the document I would agree with you :)
Tank you for the infos, I may try it! Footnote: Yes, you are right! :D
Do you plan a new release? We need that fix :)
Yes, I'm currently working on this issue :) See #17
I noticed that what we discussed needs some tweaking though:
Empty lines at the end of a section should count as trailing trivia for that section and not the last node in that section. This will make inserting a new node at the end of the section much easier.
This is how I plan to categorize leading/trailing trivia:
Does this look good to you?
Looks good :)
Tau Gärtli @.***> ezt írta (időpont: 2024. jún. 24., H, 18:08):
This is how I plan to categorize leading/trailing trivia:
trivia-explainer.svg (view on web) https://github.com/bash/broccolini/assets/4602612/103bca75-15dc-4e34-83fc-79501009b709
Does this look good to you?
— Reply to this email directly, view it on GitHub https://github.com/bash/broccolini/issues/13#issuecomment-2186925202, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADYO5VHE5QXTRRMD4KU45KLZJBAAPAVCNFSM6AAAAABJGFPWPWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBWHEZDKMRQGI . You are receiving this because you authored the thread.Message ID: @.***>
2.0.0-rc.1 is published 🎉 (still indexing atm)
I'd be grateful if you could run your internal test suite against the new version and let me know if I broke anything. If everything is good and my changes are useful I'll release 2.0.0.
It works!
Tau Gärtli @.***> ezt írta (időpont: 2024. jún. 25., K, 11:39):
2.0.0-rc.1 https://www.nuget.org/packages/Broccolini/2.0.0-rc.1 is published 🎉
I'd be grateful if you could run your internal test suite against the new version and let me know if I broke anything. If everything is good and my changes are useful I'll release 2.0.0.
— Reply to this email directly, view it on GitHub https://github.com/bash/broccolini/issues/13#issuecomment-2188443293, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADYO5VAYW6YMRJP2E4QYVP3ZJE3GZAVCNFSM6AAAAABJGFPWPWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBYGQ2DGMRZGM . You are receiving this because you authored the thread.Message ID: @.***>
Great! 2.0.0 is uploaded to nuget.org: https://www.nuget.org/packages/Broccolini/2.0.0
🥳 Great! I have tested it only with the new tool that we develop, I trust your tests :)
Tau Gärtli @.***> ezt írta (időpont: 2024. jún. 25., K, 16:37):
Great! 2.0.0 is uploaded to nuget.org: https://www.nuget.org/packages/Broccolini/2.0.0
— Reply to this email directly, view it on GitHub https://github.com/bash/broccolini/issues/13#issuecomment-2189140335, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADYO5VCKC7ICDSCLUNZALBDZJF6BBAVCNFSM6AAAAABJGFPWPWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBZGE2DAMZTGU . You are receiving this because you authored the thread.Message ID: @.***>
Here
the first two empty lines are recognized as
UnrecognizedIniNodes
, and the third one is ignored.I think the first belongs to the section node as leading trivia, the second as trailing trivia, and the third empty line belongs to the
KeyValueIniNode
as trailing trivia.It would also help to decide whether the document is well-formatted.