Closed anderskaplan closed 1 year ago
Also fixed a bug in Token.repr which caused class attributes on the tokens to be included and not only instance attributes.
Good catch, although I can imagine having a separate PR for that. But I know it's tempting to avoid some bureaucracy around creating new branch and PR - I have done that recently myself on another project... ;)
Yeah the main thing I wanted to address with this PR was the HTMLBlock content move. And that cannot be done cleanly, i.e. without failing unit tests, before the Token.repr bug is fixed. So that's why they got to go together. I did put the Token.repr bug fix in a separate commit though.
Now this PR is really going out on a limb :)
Adding another small change related to the Token.repr issue, which is to unify how Token.repr and the AST renderer select the attributes to be included in their output. I think it makes sense that only "officially declared" attributes should appear in both of those cases, and I see no reason why they should differ in their selection of attributes.
Btw, I've looked into the other part of issue/question #163 about inconsistent line endings and come to the conclusion that it's best to leave them as they are. So I consider this PR finished here.
The changes not related to the HTMLBlock are now split out into a separate PR. I'll update this PR once those changes are in, because of dependencies.
Just some final tuning, I would squash-merge afterwards.
Squashed and merged. Thank you! :)
Modified the HTMLBlock to store its content in a RawText child node, like all the other block tokens, instead of a content attribute. This makes it easier to iterate over the token tree, because all block tokens can be handled the same way.
Added a convenience wrapper to preserve backward compatibility.