Skip to content

Commit

Permalink
Merge pull request #1520 from rstudio/raw-html-col-labels-email-fix
Browse files Browse the repository at this point in the history
Ensure that HTML table head doesn't have unnecessary newlines (breaks integration with blastula emailing)
  • Loading branch information
rich-iannone authored Jan 3, 2024
2 parents 49d8a21 + 7897840 commit cdcd706
Show file tree
Hide file tree
Showing 18 changed files with 402 additions and 402 deletions.
4 changes: 2 additions & 2 deletions R/render_as_html.R
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ prepare_table_head <- function(
} else {
table_head <-
htmltools::tags$thead(
heading_component,
columns_component
if (!is.list(heading_component) && heading_component == "") NULL else heading_component,
if (!is.list(columns_component) && columns_component == "") NULL else columns_component,
)
}
table_head
Expand Down
24 changes: 12 additions & 12 deletions tests/testthat/_snaps/cols_align_decimal.md

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions tests/testthat/_snaps/cols_merge.md

Large diffs are not rendered by default.

72 changes: 36 additions & 36 deletions tests/testthat/_snaps/data_color.md

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions tests/testthat/_snaps/fmt_auto.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions tests/testthat/_snaps/fmt_duration.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions tests/testthat/_snaps/fmt_fraction.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions tests/testthat/_snaps/footer.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/testthat/_snaps/removal_functions.md

Large diffs are not rendered by default.

398 changes: 199 additions & 199 deletions tests/testthat/_snaps/rows_add.md

Large diffs are not rendered by default.

58 changes: 29 additions & 29 deletions tests/testthat/_snaps/summary_rows.md

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions tests/testthat/_snaps/tab_footnote.md

Large diffs are not rendered by default.

44 changes: 22 additions & 22 deletions tests/testthat/_snaps/tab_remove.md

Large diffs are not rendered by default.

74 changes: 37 additions & 37 deletions tests/testthat/_snaps/tab_spanner_delim.md

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions tests/testthat/_snaps/tab_stub_indent.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tests/testthat/_snaps/tab_style.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
Code
.
Output
[1] "<table class=\"gt_table\" data-quarto-disable-processing=\"false\" data-quarto-bootstrap=\"false\">\n <thead>\n \n <tr class=\"gt_col_headings\">\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"num\">num</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"bkg_color\">bkg_color</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"txt_color\">txt_color</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"size\">size</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"align\">align</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"v_align\">v_align</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"style\">style</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"weight\">weight</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"stretch\">stretch</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"decorate\">decorate</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"transform\">transform</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"whitespace\">whitespace</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_right\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"indent\">indent</th>\n </tr>\n </thead>\n <tbody class=\"gt_table_body\">\n <tr><td headers=\"num\" class=\"gt_row gt_left\" style=\"background-color: #0000FF; color: #FFFFFF; font-size: 14px; text-align: left; vertical-align: middle; font-style: normal; font-weight: normal; font-stretch: normal; text-decoration: overline; text-transform: uppercase; white-space: normal; text-indent: 0;\">one</td>\n<td headers=\"bkg_color\" class=\"gt_row gt_left\">blue</td>\n<td headers=\"txt_color\" class=\"gt_row gt_left\">white</td>\n<td headers=\"size\" class=\"gt_row gt_left\">14px</td>\n<td headers=\"align\" class=\"gt_row gt_left\">left</td>\n<td headers=\"v_align\" class=\"gt_row gt_left\">middle</td>\n<td headers=\"style\" class=\"gt_row gt_left\">normal</td>\n<td headers=\"weight\" class=\"gt_row gt_left\">normal</td>\n<td headers=\"stretch\" class=\"gt_row gt_left\">normal</td>\n<td headers=\"decorate\" class=\"gt_row gt_left\">overline</td>\n<td headers=\"transform\" class=\"gt_row gt_left\">uppercase</td>\n<td headers=\"whitespace\" class=\"gt_row gt_left\">normal</td>\n<td headers=\"indent\" class=\"gt_row gt_right\">0</td></tr>\n <tr><td headers=\"num\" class=\"gt_row gt_left\" style=\"background-color: #FF0000; color: #FFFFFF; font-size: 20px; text-align: right; vertical-align: top; font-style: italic; font-weight: bold; font-stretch: semi-expanded; text-decoration: line-through; text-transform: lowercase; white-space: nowrap; text-indent: 4;\">two</td>\n<td headers=\"bkg_color\" class=\"gt_row gt_left\">red</td>\n<td headers=\"txt_color\" class=\"gt_row gt_left\">#FFF</td>\n<td headers=\"size\" class=\"gt_row gt_left\">20px</td>\n<td headers=\"align\" class=\"gt_row gt_left\">right</td>\n<td headers=\"v_align\" class=\"gt_row gt_left\">top</td>\n<td headers=\"style\" class=\"gt_row gt_left\">italic</td>\n<td headers=\"weight\" class=\"gt_row gt_left\">bold</td>\n<td headers=\"stretch\" class=\"gt_row gt_left\">semi-expanded</td>\n<td headers=\"decorate\" class=\"gt_row gt_left\">line-through</td>\n<td headers=\"transform\" class=\"gt_row gt_left\">lowercase</td>\n<td headers=\"whitespace\" class=\"gt_row gt_left\">nowrap</td>\n<td headers=\"indent\" class=\"gt_row gt_right\">4</td></tr>\n <tr><td headers=\"num\" class=\"gt_row gt_left\" style=\"background-color: #FFFF00; color: #1A1A1A; font-size: 24px; text-align: center; vertical-align: bottom; font-style: oblique; font-weight: lighter; font-stretch: expanded; text-decoration: underline; text-transform: capitalize; white-space: pre; text-indent: 8;\">three</td>\n<td headers=\"bkg_color\" class=\"gt_row gt_left\">yellow</td>\n<td headers=\"txt_color\" class=\"gt_row gt_left\">gray10</td>\n<td headers=\"size\" class=\"gt_row gt_left\">24px</td>\n<td headers=\"align\" class=\"gt_row gt_left\">center</td>\n<td headers=\"v_align\" class=\"gt_row gt_left\">bottom</td>\n<td headers=\"style\" class=\"gt_row gt_left\">oblique</td>\n<td headers=\"weight\" class=\"gt_row gt_left\">lighter</td>\n<td headers=\"stretch\" class=\"gt_row gt_left\">expanded</td>\n<td headers=\"decorate\" class=\"gt_row gt_left\">underline</td>\n<td headers=\"transform\" class=\"gt_row gt_left\">capitalize</td>\n<td headers=\"whitespace\" class=\"gt_row gt_left\">pre</td>\n<td headers=\"indent\" class=\"gt_row gt_right\">8</td></tr>\n <tr><td headers=\"num\" class=\"gt_row gt_left\" style=\"background-color: #663399; color: rgba(255,255,255,0.93); font-size: 30px; text-align: right; vertical-align: middle; font-style: normal; font-weight: bolder; font-stretch: extra-expanded; text-decoration: underline overline; text-transform: lowercase; white-space: pre-wrap; text-indent: 10;\">four</td>\n<td headers=\"bkg_color\" class=\"gt_row gt_left\">rebeccapurple</td>\n<td headers=\"txt_color\" class=\"gt_row gt_left\">#FFFFFFEE</td>\n<td headers=\"size\" class=\"gt_row gt_left\">30px</td>\n<td headers=\"align\" class=\"gt_row gt_left\">right</td>\n<td headers=\"v_align\" class=\"gt_row gt_left\">middle</td>\n<td headers=\"style\" class=\"gt_row gt_left\">normal</td>\n<td headers=\"weight\" class=\"gt_row gt_left\">bolder</td>\n<td headers=\"stretch\" class=\"gt_row gt_left\">extra-expanded</td>\n<td headers=\"decorate\" class=\"gt_row gt_left\">underline overline</td>\n<td headers=\"transform\" class=\"gt_row gt_left\">lowercase</td>\n<td headers=\"whitespace\" class=\"gt_row gt_left\">pre-wrap</td>\n<td headers=\"indent\" class=\"gt_row gt_right\">10</td></tr>\n </tbody>\n \n \n</table>"
[1] "<table class=\"gt_table\" data-quarto-disable-processing=\"false\" data-quarto-bootstrap=\"false\">\n <thead>\n <tr class=\"gt_col_headings\">\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"num\">num</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"bkg_color\">bkg_color</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"txt_color\">txt_color</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"size\">size</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"align\">align</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"v_align\">v_align</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"style\">style</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"weight\">weight</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"stretch\">stretch</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"decorate\">decorate</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"transform\">transform</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_left\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"whitespace\">whitespace</th>\n <th class=\"gt_col_heading gt_columns_bottom_border gt_right\" rowspan=\"1\" colspan=\"1\" scope=\"col\" id=\"indent\">indent</th>\n </tr>\n </thead>\n <tbody class=\"gt_table_body\">\n <tr><td headers=\"num\" class=\"gt_row gt_left\" style=\"background-color: #0000FF; color: #FFFFFF; font-size: 14px; text-align: left; vertical-align: middle; font-style: normal; font-weight: normal; font-stretch: normal; text-decoration: overline; text-transform: uppercase; white-space: normal; text-indent: 0;\">one</td>\n<td headers=\"bkg_color\" class=\"gt_row gt_left\">blue</td>\n<td headers=\"txt_color\" class=\"gt_row gt_left\">white</td>\n<td headers=\"size\" class=\"gt_row gt_left\">14px</td>\n<td headers=\"align\" class=\"gt_row gt_left\">left</td>\n<td headers=\"v_align\" class=\"gt_row gt_left\">middle</td>\n<td headers=\"style\" class=\"gt_row gt_left\">normal</td>\n<td headers=\"weight\" class=\"gt_row gt_left\">normal</td>\n<td headers=\"stretch\" class=\"gt_row gt_left\">normal</td>\n<td headers=\"decorate\" class=\"gt_row gt_left\">overline</td>\n<td headers=\"transform\" class=\"gt_row gt_left\">uppercase</td>\n<td headers=\"whitespace\" class=\"gt_row gt_left\">normal</td>\n<td headers=\"indent\" class=\"gt_row gt_right\">0</td></tr>\n <tr><td headers=\"num\" class=\"gt_row gt_left\" style=\"background-color: #FF0000; color: #FFFFFF; font-size: 20px; text-align: right; vertical-align: top; font-style: italic; font-weight: bold; font-stretch: semi-expanded; text-decoration: line-through; text-transform: lowercase; white-space: nowrap; text-indent: 4;\">two</td>\n<td headers=\"bkg_color\" class=\"gt_row gt_left\">red</td>\n<td headers=\"txt_color\" class=\"gt_row gt_left\">#FFF</td>\n<td headers=\"size\" class=\"gt_row gt_left\">20px</td>\n<td headers=\"align\" class=\"gt_row gt_left\">right</td>\n<td headers=\"v_align\" class=\"gt_row gt_left\">top</td>\n<td headers=\"style\" class=\"gt_row gt_left\">italic</td>\n<td headers=\"weight\" class=\"gt_row gt_left\">bold</td>\n<td headers=\"stretch\" class=\"gt_row gt_left\">semi-expanded</td>\n<td headers=\"decorate\" class=\"gt_row gt_left\">line-through</td>\n<td headers=\"transform\" class=\"gt_row gt_left\">lowercase</td>\n<td headers=\"whitespace\" class=\"gt_row gt_left\">nowrap</td>\n<td headers=\"indent\" class=\"gt_row gt_right\">4</td></tr>\n <tr><td headers=\"num\" class=\"gt_row gt_left\" style=\"background-color: #FFFF00; color: #1A1A1A; font-size: 24px; text-align: center; vertical-align: bottom; font-style: oblique; font-weight: lighter; font-stretch: expanded; text-decoration: underline; text-transform: capitalize; white-space: pre; text-indent: 8;\">three</td>\n<td headers=\"bkg_color\" class=\"gt_row gt_left\">yellow</td>\n<td headers=\"txt_color\" class=\"gt_row gt_left\">gray10</td>\n<td headers=\"size\" class=\"gt_row gt_left\">24px</td>\n<td headers=\"align\" class=\"gt_row gt_left\">center</td>\n<td headers=\"v_align\" class=\"gt_row gt_left\">bottom</td>\n<td headers=\"style\" class=\"gt_row gt_left\">oblique</td>\n<td headers=\"weight\" class=\"gt_row gt_left\">lighter</td>\n<td headers=\"stretch\" class=\"gt_row gt_left\">expanded</td>\n<td headers=\"decorate\" class=\"gt_row gt_left\">underline</td>\n<td headers=\"transform\" class=\"gt_row gt_left\">capitalize</td>\n<td headers=\"whitespace\" class=\"gt_row gt_left\">pre</td>\n<td headers=\"indent\" class=\"gt_row gt_right\">8</td></tr>\n <tr><td headers=\"num\" class=\"gt_row gt_left\" style=\"background-color: #663399; color: rgba(255,255,255,0.93); font-size: 30px; text-align: right; vertical-align: middle; font-style: normal; font-weight: bolder; font-stretch: extra-expanded; text-decoration: underline overline; text-transform: lowercase; white-space: pre-wrap; text-indent: 10;\">four</td>\n<td headers=\"bkg_color\" class=\"gt_row gt_left\">rebeccapurple</td>\n<td headers=\"txt_color\" class=\"gt_row gt_left\">#FFFFFFEE</td>\n<td headers=\"size\" class=\"gt_row gt_left\">30px</td>\n<td headers=\"align\" class=\"gt_row gt_left\">right</td>\n<td headers=\"v_align\" class=\"gt_row gt_left\">middle</td>\n<td headers=\"style\" class=\"gt_row gt_left\">normal</td>\n<td headers=\"weight\" class=\"gt_row gt_left\">bolder</td>\n<td headers=\"stretch\" class=\"gt_row gt_left\">extra-expanded</td>\n<td headers=\"decorate\" class=\"gt_row gt_left\">underline overline</td>\n<td headers=\"transform\" class=\"gt_row gt_left\">lowercase</td>\n<td headers=\"whitespace\" class=\"gt_row gt_left\">pre-wrap</td>\n<td headers=\"indent\" class=\"gt_row gt_right\">10</td></tr>\n </tbody>\n \n \n</table>"

Loading

3 comments on commit cdcd706

@github-actions
Copy link

Choose a reason for hiding this comment

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

@github-actions
Copy link

Choose a reason for hiding this comment

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

@github-actions
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.