ITDP / the-online-brt-planning-guide

Online collaborative version of the BRT Planning Guide
https://brtguide.itdp.org
Other
6 stars 20 forks source link

Incorrect transformation of some ASTs #186

Closed jonasmalacofilho closed 7 years ago

jonasmalacofilho commented 7 years ago

The current implementation of transform.NewTransform vertical and consume methods can't handle hierarchical children that are not descendants on the original AST.

This can happen when \include-ing files, as we saw in #178.

Unit test:

    // in tests.Test_09_Issues.hx
    public function test_issue_0186()
    {
        var exp = transform(expand(
                VElemList([
                    Chapter(Word("cte")),
                    VElemList([
                        Section(Word("foo")),
                        SubSection(Word("bar"))
                    ])
                ])));
        var got = transform(expand(
                VElemList([
                    Chapter(Word("cte")),
                    VElemList([
                        Section(Word("foo"))
                    ]),
                    VElemList([
                        SubSection(Word("bar"))
                    ])
                ])));
        Assert.same(exp, got);
    }