Skip to content

Commit f2154a3

Browse files
committed
Enable better printing of stub cells
1 parent c2c6922 commit f2154a3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

great_tables/_utils_render_html.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,11 @@ def create_body_component_h(data: GTData) -> str:
388388

389389
stub_var = data._boxhead._get_stub_column()
390390

391+
stub_layout = _get_stub_layout(data=data)
392+
393+
has_stub_column = "rowname" in stub_layout
394+
has_two_col_stub = "group_label" in stub_layout
395+
391396
# If there is a stub, then prepend that to the `column_vars` list
392397
if stub_var is not None:
393398
column_vars = [stub_var] + column_vars
@@ -401,8 +406,11 @@ def create_body_component_h(data: GTData) -> str:
401406
cell_content: Any = _get_cell(tbl_data, i, colinfo.var)
402407
cell_str: str = str(cell_content)
403408

404-
# Determine whether this cell is a stub cell
405-
is_stub_cell = colinfo.var == stub_var
409+
# Determine whether the current cell is the stub cell
410+
if has_stub_column:
411+
is_stub_cell = colinfo.var == stub_var.var
412+
else:
413+
is_stub_cell = False
406414

407415
# Get alignment for the current column from the `col_alignment` list
408416
# by using the `name` value to obtain the index of the alignment value

0 commit comments

Comments
 (0)