Skip to content

Commit a6c9d3e

Browse files
committed
Fix caption label isolation: prevent flex layout from forcing 'Figure X.' onto its own line
The .poster-section > :last-child CSS rule applied display:flex to any element that happened to be the last child of a section, including figure/table captions. This turned <strong> tags inside captions into block-level flex items, isolating 'Figure X.' on its own line. Fix: add display:block override for .figure-caption/.table-caption in poster sections, and use &nbsp; in auto-numbered caption prefixes to prevent mid-label line breaks.
1 parent 9285bf3 commit a6c9d3e

3 files changed

Lines changed: 10 additions & 2 deletions

File tree

docs/screenshots/poster-sample.png

67 KB
Loading

src/cdl_slides/assets/themes/cdl-poster-theme.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,14 @@ p img[alt] {
554554
font-size: 24pt;
555555
}
556556

557+
/* Captions must never become flex containers (the :last-child rule above would
558+
force display:flex on them when they happen to be the last element in a
559+
poster-section, turning <strong> into a block-level flex item). */
560+
.poster-section > .figure-caption,
561+
.poster-section > .table-caption {
562+
display: block;
563+
}
564+
557565
/* SVG charts inside poster sections should not shrink with scale wrappers */
558566
.poster-section div[class*="scale-"] svg {
559567
max-width: none;

src/cdl_slides/poster_preprocessor.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def _replace_fig(m: re.Match) -> str:
202202
if not caption_text:
203203
return m.group(0)
204204
fig_count += 1
205-
return f'<{tag} class="figure-caption"><strong>Figure {fig_count}.</strong> {caption_text}</{tag}>'
205+
return f'<{tag} class="figure-caption"><strong>Figure&nbsp;{fig_count}.</strong>&nbsp;{caption_text}</{tag}>'
206206

207207
def _replace_tbl(m: re.Match) -> str:
208208
nonlocal tbl_count
@@ -211,7 +211,7 @@ def _replace_tbl(m: re.Match) -> str:
211211
if not caption_text:
212212
return m.group(0)
213213
tbl_count += 1
214-
return f'<{tag} class="table-caption"><strong>Table {tbl_count}.</strong> {caption_text}</{tag}>'
214+
return f'<{tag} class="table-caption"><strong>Table&nbsp;{tbl_count}.</strong>&nbsp;{caption_text}</{tag}>'
215215

216216
content = re.sub(r'<(div|p) class="figure-caption">(.*?)</(?:div|p)>', _replace_fig, content)
217217
content = re.sub(r'<(div|p) class="table-caption">(.*?)</(?:div|p)>', _replace_tbl, content)

0 commit comments

Comments
 (0)