mrombout / asciihero

An AsciiDoc.js extension to help authoring Fighting Fantasy style (and more) gamebooks.
https://mrombout.github.io/asciihero/
MIT License
0 stars 0 forks source link

Cannot read properties of undefined #121

Open mrombout opened 4 months ago

mrombout commented 4 months ago

While I was preparing a new example document to test out the different tables styles I ran into the following error:

> An uncaught exception happened within the HTML page: Error: TypeError: Cannot read properties of undefined (reading 'children')
    at file:///home/mrombout/Projects/mrombout/asciihero/examples/tables/tables.html:33156:49
    at NodeList.forEach (<anonymous>)
    at RepeatingTableElements.afterPageLayout (file:///home/mrombout/Projects/mrombout/asciihero/examples/tables/tables.html:33155:16)
    at file:///home/mrombout/Projects/mrombout/asciihero/examples/tables/tables.html:622:26
    at Array.forEach (<anonymous>)
    at Hook.trigger (file:///home/mrombout/Projects/mrombout/asciihero/examples/tables/tables.html:621:15)
    at Chunker.layout (file:///home/mrombout/Projects/mrombout/asciihero/examples/tables/tables.html:3143:38)
    at async Chunker.renderAsync (file:///home/mrombout/Projects/mrombout/asciihero/examples/tables/tables.html:3032:17)

I was trying to run asciihero on the following content:

= Tables
:doctype: book
:asciihero-combat-attributes: strength, dexterity

== Introduction

AsciiHero supports tables of the tabular variety (sorry knights).
They work the same as they do in any AsciiDoc document.

The following table is defined without any options:

=== Default

[cols="1,1"]
|===
|Cell in column 1, row 1 
|Cell in column 2, row 1 

|Cell in column 1, row 2
|Cell in column 2, row 2

|Cell in column 1, row 3
|Cell in column 2, row 3 
|=== 

=== Frame

The following table is defined with `frame=ends`:

[frame=ends]
|===
|Column 1, header row |Column 2, header row |Column 3, header row

|Cell in column 1, row 2
|Cell in column 2, row 2
|Cell in column 3, row 2

|Cell in column 1, row 3
|Cell in column 2, row 3
|Cell in column 3, row 3
|===

The following table is defined with `frame=sides`:

[frame=sides]
|===
|Column 1, header row |Column 2, header row |Column 3, header row

|Cell in column 1, row 2
|Cell in column 2, row 2
|Cell in column 3, row 2

|Cell in column 1, row 3
|Cell in column 2, row 3
|Cell in column 3, row 3
|===

The following table is defined with `frame=none`:

[frame=none]
|===
|Column 1, header row |Column 2, header row |Column 3, header row

|Cell in column 1, row 2
|Cell in column 2, row 2
|Cell in column 3, row 2

|Cell in column 1, row 3
|Cell in column 2, row 3
|Cell in column 3, row 3
|===

=== Grid

The following table is defined with `grid=rows`:

[grid=rows]
|===
|Column 1, header row |Column 2, header row |Column 3, header row

|Cell in column 1, row 2
|Cell in column 2, row 2
|Cell in column 3, row 2

|Cell in column 1, row 3
|Cell in column 2, row 3
|Cell in column 3, row 3
|===

The following table is defined with `grid=cols`:

[grid=cols]
|===
|Column 1, header row |Column 2, header row |Column 3, header row

|Cell in column 1, row 2
|Cell in column 2, row 2
|Cell in column 3, row 2

|Cell in column 1, row 3
|Cell in column 2, row 3
|Cell in column 3, row 3
|===

The following table is defined with `grid=none`:

[grid=none]
|===
|Column 1, header row |Column 2, header row |Column 3, header row

|Cell in column 1, row 2
|Cell in column 2, row 2
|Cell in column 3, row 2

|Cell in column 1, row 3
|Cell in column 2, row 3
|Cell in column 3, row 3
|===

Adding some characters just before the problematic table makes the error go away. I suspect it might have something to do with the part of the table content being moved over to the next page.