Skip to content

Table and Figure caption styles - #664

Open
gesa wants to merge 4 commits into
tc39:mainfrom
gesa:figure-styles
Open

gesa wants to merge 4 commits into
tc39:mainfrom
gesa:figure-styles

Conversation

@gesa

@gesa gesa commented Nov 13, 2025

Copy link
Copy Markdown
Member

Updated to Ecma house style.

  • Update css to align with template
  • Replace : with
  • Begin re-numbering figures at the beginning of each annex (as A1, A2, etc)

Comment thread src/Figure.ts Outdated

@michaelficarra michaelficarra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like it, but okay.

@gesa

gesa commented Nov 13, 2025

Copy link
Copy Markdown
Member Author

I don't like it, but okay.

@michaelficarra I would be delighted to come at the numbering with a different approach. I also don't like it, at least not the solution I'm proposing. I just couldn't think of anything better.

I found a mismatch in the layout as compared to the template reviewing this—figure captions should render below the figure, table captions should render above the table. Commit resolving this incoming.

@gesa
gesa requested a review from michaelficarra November 14, 2025 06:36
Comment thread src/Figure.ts
Comment on lines +64 to +68
if (node.nodeName.split('-')[1] === 'FIGURE') {
node.firstElementChild?.appendChild(captionElem);
} else {
node.childNodes[0].insertBefore(captionElem, node.childNodes[0].firstChild);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (node.nodeName.split('-')[1] === 'FIGURE') {
node.firstElementChild?.appendChild(captionElem);
} else {
node.childNodes[0].insertBefore(captionElem, node.childNodes[0].firstChild);
}
// Captions go below figures but above tables etc. (per Ecma house style)
if (node.nodeName === 'EMU-FIGURE') {
ele.appendChild(captionElem);
} else {
ele.insertBefore(captionElem, ele.firstChild);
}

Comment thread src/Clause.ts
Comment on lines +114 to +119
// Reset figure numbering for each Annex
if (this.isAnnex && !this.parentClause) {
spec._figureCounts.figure = 0;
spec._figureCounts.table = 0;
spec._figurePrefix = `${number}.`;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This breaks the rendering of <emu-xref>, e.g. "The entries in Table 103 are added to Table 6" at B.2.1 Additional Properties of the Global Object becomes "The entries in Table 1 are added to Table 6" rather than "The entries in Table B.1 are added to Table 6".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants