File tree Expand file tree Collapse file tree 8 files changed +61
-16
lines changed
test/baselines/generated-reference Expand file tree Collapse file tree 8 files changed +61
-16
lines changed Original file line number Diff line number Diff line change @@ -252,7 +252,7 @@ emu-table td,
252252pre ,
253253h1 ,
254254emu-production ,
255- emu-figure : has ( > figure > img ) figure ,
255+ emu-figure ,
256256# metadata-block {
257257 break-inside : avoid;
258258 border : unset;
@@ -429,7 +429,7 @@ caption, table > figcaption {
429429 caption-side : top;
430430 color : # 000 ;
431431 font-weight : bold;
432- margin-bottom : 1 rem ;
432+ margin-bottom : 0.5 lh ;
433433 text-align : center;
434434}
435435
@@ -442,6 +442,14 @@ table:not(:has(tr:nth-of-type(5))) {
442442 break-inside : avoid-page;
443443}
444444
445+ table tr : first-of-type , table tr : nth-of-type (2 ) {
446+ break-after : avoid;
447+ }
448+
449+ table tr : last-of-type {
450+ break-before : avoid;
451+ }
452+
445453/* This inheritance looks weird—it's due to how Prince manages continuity in tables across pages */
446454table > figcaption {
447455 display : table-caption;
@@ -476,6 +484,16 @@ emu-figure img {
476484 height : auto;
477485}
478486
487+ figure figcaption {
488+ color : var (--black );
489+ text-align : center;
490+ }
491+
492+ emu-figure figcaption ,
493+ emu-table figcaption {
494+ margin-bottom : 0.5lh ;
495+ }
496+
479497.attributes-tag {
480498 break-before : avoid-page;
481499 break-after : avoid-page;
Original file line number Diff line number Diff line change @@ -82,6 +82,13 @@ export default class Clause extends Builder {
8282 parentNamespace = parent . namespace ;
8383 }
8484
85+ // Reset figure numbering for each Annex
86+ if ( this . isAnnex && ! this . parentClause ) {
87+ spec . _figureCounts . figure = 0 ;
88+ spec . _figureCounts . table = 0 ;
89+ spec . _figurePrefix = `${ number } .` ;
90+ }
91+
8592 if ( node . hasAttribute ( 'namespace' ) ) {
8693 this . namespace = node . getAttribute ( 'namespace' ) ! ;
8794 spec . biblio . createNamespace ( this . namespace , parentNamespace ) ;
Original file line number Diff line number Diff line change @@ -21,16 +21,16 @@ export default class Figure extends Builder {
2121
2222 this . isInformative = node . hasAttribute ( 'informative' ) ;
2323 this . captionElem = node . querySelector ( 'emu-caption' ) ;
24- this . caption = this . type . charAt ( 0 ) . toUpperCase ( ) + this . type . slice ( 1 ) + ' ' + this . number ;
24+ this . caption = ` ${ this . type . charAt ( 0 ) . toUpperCase ( ) } ${ this . type . slice ( 1 ) } ${ spec . _figurePrefix } ${ this . number } ` ;
2525
2626 if ( this . isInformative ) {
2727 this . caption += ' (Informative)' ;
2828 }
2929
3030 if ( this . captionElem ) {
31- this . caption += ': ' + this . captionElem . innerHTML ;
31+ this . caption += ' — ' + this . captionElem . innerHTML ;
3232 } else if ( node . getAttribute ( 'caption' ) ) {
33- this . caption += ': ' + node . getAttribute ( 'caption' ) ;
33+ this . caption += ' — ' + node . getAttribute ( 'caption' ) ;
3434 }
3535
3636 if ( this . id ) {
Original file line number Diff line number Diff line change @@ -319,6 +319,7 @@ export default class Spec {
319319 readonly log : ( msg : string ) => void ;
320320 readonly warn : ( err : Warning ) => void | undefined ;
321321
322+ /** @internal */ _figurePrefix : string ;
322323 /** @internal */ _figureCounts : { [ type : string ] : number } ;
323324 /** @internal */ _xrefs : Xref [ ] ;
324325 /** @internal */ _ntRefs : NonTerminal [ ] ;
@@ -371,6 +372,7 @@ export default class Spec {
371372 table : 0 ,
372373 figure : 0 ,
373374 } ;
375+ this . _figurePrefix = '' ;
374376 this . _xrefs = [ ] ;
375377 this . _ntRefs = [ ] ;
376378 this . _ntStringRefs = [ ] ;
Original file line number Diff line number Diff line change 35043504pre,
35053505h1,
35063506emu- production,
3507- emu- figure: has ( > figure > img) figure ,
3507+ emu- figure,
35083508#metadata- block {
35093509 break - inside: avoid;
35103510 border: unset;
36813681 caption- side: top;
36823682 color: #000 ;
36833683 font- weight: bold;
3684- margin- bottom: 1rem ;
3684+ margin- bottom: 0 . 5lh ;
36853685 text- align: center;
36863686}
36873687
36943694 break - inside: avoid- page;
36953695}
36963696
3697+ table tr: first- of - type, table tr: nth- of - type (2 ) {
3698+ break - after: avoid;
3699+ }
3700+
3701+ table tr: last- of - type {
3702+ break - before: avoid;
3703+ }
3704+
36973705/* This inheritance looks weird—it's due to how Prince manages continuity in tables across pages */
36983706table > figcaption {
36993707 display: table- caption;
37283736 height: auto;
37293737}
37303738
3739+ figure figcaption {
3740+ color: var (-- black);
3741+ text- align: center;
3742+ }
3743+
3744+ emu- figure figcaption,
3745+ emu- table figcaption {
3746+ margin- bottom: 0 .5lh ;
3747+ }
3748+
37313749.attributes - tag {
37323750 break - before: avoid- page;
37333751 break - after: avoid- page;
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ <h1><span class="secnum">1.1</span> Sub A</h1>
2424<!-- EXPECT_WARNING { "ruleId": "duplicate-id", "message": "<emu-clause> has duplicate id \"sec-a\"" } -->
2525<emu-clause id =" sec-a" >
2626 <h1 ><span class =" secnum" >2</span > Section A: Extras</h1 >
27- <emu-table id =" table-of-stuff" caption =" A Table Of Stuff" informative =" " ><figure ><figcaption >Table 1 (Informative): A Table Of Stuff</figcaption >
27+ <emu-table id =" table-of-stuff" caption =" A Table Of Stuff" informative =" " ><figure ><figcaption >Table 1 (Informative) — A Table Of Stuff</figcaption >
2828 <table >
2929 <tbody ><tr ><th >Column 1</th ><th >Column 2</th ></tr >
3030 <tr ><td >Value</td ><td >Value 2</td ></tr >
@@ -35,7 +35,7 @@ <h1><span class="secnum">2</span> Section A: Extras</h1>
3535<emu-clause id =" sec-a" >
3636 <h1 ><span class =" secnum" >3</span > Section A: Extras</h1 >
3737 <!-- EXPECT_WARNING { "ruleId": "duplicate-id", "message": "<emu-table> has duplicate id \"table-of-stuff\"" } -->
38- <emu-table id =" table-of-stuff" caption =" A Table Of Stuff" informative =" " ><figure ><figcaption >Table 2 (Informative): A Table Of Stuff</figcaption >
38+ <emu-table id =" table-of-stuff" caption =" A Table Of Stuff" informative =" " ><figure ><figcaption >Table 2 (Informative) — A Table Of Stuff</figcaption >
3939 <table >
4040 <tbody ><tr ><th >Column 1</th ><th >Column 2</th ></tr >
4141 <tr ><td >Value</td ><td >Value 2</td ></tr >
Original file line number Diff line number Diff line change 1616</figure ></emu-figure >
1717
1818<!-- deprecated: caption element -->
19- <emu-figure id =" figure-2" informative =" " caption =" Informative figure" ><figure ><figcaption >Figure 2 (Informative): Informative figure</figcaption >
19+ <emu-figure id =" figure-2" informative =" " caption =" Informative figure" ><figure ><figcaption >Figure 2 (Informative) — Informative figure</figcaption >
2020 this is a figure!
2121</figure ></emu-figure >
2222
23- <emu-table id =" table-1" caption =" An example table" ><figure ><figcaption >Table 1: An example table</figcaption >
23+ <emu-table id =" table-1" caption =" An example table" ><figure ><figcaption >Table 1 — An example table</figcaption >
2424 <table >
2525 <thead >
2626 <tr ><td >Column 1</td ><td >Column 2</td ></tr >
3232 </tbody ></table >
3333</figure ></emu-table >
3434
35- <emu-table id =" table-2" caption =" An example table 2" informative =" " ><figure ><figcaption >Table 2 (Informative): An example table 2</figcaption >
35+ <emu-table id =" table-2" caption =" An example table 2" informative =" " ><figure ><figcaption >Table 2 (Informative) — An example table 2</figcaption >
3636 <table >
3737 <tbody ><tr ><th >Column 1</th ><th >Column 2</th ></tr >
3838 <tr ><td >Value</td ><td >Value 2</td ></tr >
4242 </tbody ></table >
4343</figure ></emu-table >
4444
45- <emu-figure id =" figure-3" informative =" " ><figure ><figcaption >Figure 3 (Informative): This is the caption</figcaption >
45+ <emu-figure id =" figure-3" informative =" " ><figure ><figcaption >Figure 3 (Informative) — This is the caption</figcaption >
4646
4747 this is a figure!
4848</figure ></emu-figure >
4949
50- <emu-table id =" table-3" ><figure ><figcaption >Table 3: This is a table</figcaption >
50+ <emu-table id =" table-3" ><figure ><figcaption >Table 3 — This is a table</figcaption >
5151
5252 <table >
5353 <thead >
6060 </tbody ></table >
6161</figure ></emu-table >
6262
63- <emu-table id =" table-4" informative =" " ><figure ><figcaption >Table 4 (Informative): This is a <b >second</b > table</figcaption >
63+ <emu-table id =" table-4" informative =" " ><figure ><figcaption >Table 4 (Informative) — This is a <b >second</b > table</figcaption >
6464
6565 <table >
6666 <tbody ><tr ><th >Column 1</th ><th >Column 2</th ></tr >
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ <h1><span class="secnum">1.1</span> AbstractOp</h1>
9898 this is a figure!
9999 </figure ></emu-figure >
100100
101- <emu-table id =" table-1" caption =" An example table" ><figure ><figcaption >Table 1: An example table</figcaption >
101+ <emu-table id =" table-1" caption =" An example table" ><figure ><figcaption >Table 1 — An example table</figcaption >
102102 <table >
103103 <thead >
104104 <tr ><td >Column 1</td ><td >Column 2</td ></tr >
You can’t perform that action at this time.
0 commit comments