fix #519, change from 'class' comparison to 'inherits'
diff --git a/R/column_spec.R b/R/column_spec.R
index 77f0c69..25d1289 100644
--- a/R/column_spec.R
+++ b/R/column_spec.R
@@ -266,7 +266,7 @@
if (!is.null(image)) {
image <- image[[1]]
- if (class(image) == "kableExtraInlinePlots") {
+ if (inherits(image, "kableExtraInlinePlots")) {
if (!is.null(image$svg_text)) {
xml_add_child(target_cell, xml2::read_xml(image$svg_text))
} else {
@@ -284,13 +284,13 @@
# favor popover over tooltip
if (!is.null(popover)) {
- if (class(popover) != "ke_popover") popover <- spec_popover(popover)
+ if (!inherits(popover, "ke_popover")) popover <- spec_popover(popover)
popover_list <- attr(popover, 'list')
for (p in names(popover_list)) {
xml_attr(target_cell, p) <- popover_list[p]
}
} else if (!is.null(tooltip)) {
- if (class(tooltip) != "ke_tooltip") tooltip <- spec_tooltip(tooltip)
+ if (!inherits(tooltip, "ke_tooltip")) tooltip <- spec_tooltip(tooltip)
tooltip_list <- attr(tooltip, 'list')
for (t in names(tooltip_list)) {
xml_attr(target_cell, t) <- tooltip_list[t]
@@ -541,7 +541,7 @@
if (!is.null(image)) {
image <- image[[1]]
- if (class(image) == "kableExtraInlinePlots") {
+ if (inherits(image, "kableExtraInlinePlots")) {
new_row[column] <- paste0(
new_row[column],
'\\\\includegraphics\\[width=',