Skip to content

Commit d996c56

Browse files
committed
fix bug with extra line being added in gt_captions
1 parent c6be346 commit d996c56

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

R/ojo_gt.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,13 @@ gt_okpi <- function(data,
150150
)
151151
# # Format spanner headers
152152
# gt::tab_style(
153-
# style = list(
154-
# gt::cell_text(
155-
# font = chosen_font,
156-
# weight = "bold",
157-
# size = "larger"
158-
# )
159-
# ),
153+
# style = list(
154+
# gt::cell_text(
155+
# font = chosen_font,
156+
# weight = "bold",
157+
# size = "larger"
158+
# )
159+
# ),
160160
# locations = gt::cells_column_spanners()
161161
# )
162162

R/ojo_labs.R

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,13 +101,21 @@ ojo_gt_captions <- function (x,
101101
# Do we want to build any more QOL stuff into this? Like we could set it up
102102
# so that it automatically decides when to display an axis label, formats
103103
# those to be title case, etc.
104-
x <- x |>
105-
gt::tab_footnote(
106-
ojo_source_text(source = source)
107-
) |>
108-
gt::tab_footnote(
109-
ojo_analyst_name_text(analyst_name = analyst_name)
110-
) |>
104+
if(!is.na(source)){
105+
x <- x |>
106+
gt::tab_footnote(
107+
ojo_source_text(source = source)
108+
)
109+
}
110+
111+
if(!is.na(analyst_name)){
112+
x <- x |>
113+
gt::tab_footnote(
114+
ojo_analyst_name_text(analyst_name = analyst_name)
115+
)
116+
}
117+
118+
x <- x |>
111119
gt::tab_style(
112120
style = gt::cell_text(align = "right"),
113121
locations = list(gt::cells_source_notes(), gt::cells_footnotes())

0 commit comments

Comments
 (0)