Add htmlTable_styling; Improve old functions
diff --git a/R/footnote.R b/R/footnote.R
index 73d18f5..eeb55e6 100644
--- a/R/footnote.R
+++ b/R/footnote.R
@@ -15,54 +15,18 @@
 #' @param threeparttable Boolean value indicating if a \href{https://www.ctan.org/pkg/threeparttable}{threeparttable} scheme should be used.
 #'
 #' @export
-add_footnote <- function(input, label = NULL, notation = "number",
+add_footnote <- function(input, label = NULL,
+                         notation = c("alphabet", "number", "symbol"),
                          threeparttable = FALSE) {
-  if (is.null(label)){return(input)}
+  if (is.null(label)) return(input)
 
-  # Define available id list
-  if (!notation %in% c("number", "alphabet", "symbol")){
-    warning('Please select your notation within "number", "alphabet" and ',
-            '"symbol". Now add_footnote is using "alphabet" as default.')
+  notation <- match.arg(notation)
+  if (notation == "symbol") {
+    notation <- paste0(notation, ".", attr(input, "format"))
   }
-  if (notation == "symbol") {notation = paste0(notation, ".", attr(input, "format"))}
-  ids.ops <- data.frame(
-    number = as.character(1:20),
-    alphabet = letters[1:20],
-    symbol.latex = c(
-      "*", "\\\\dag", "\\\\ddag", "\\\\S", "\\\\P",
-      "**", "\\\\dag\\\\dag", "\\\\ddag\\\\ddag", "\\\\S\\\\S", "\\\\P\\\\P",
-      "***", "\\\\dag\\\\dag\\\\dag", "\\\\ddag\\\\ddag\\\\ddag",
-      "\\\\S\\\\S\\\\S", "\\\\P\\\\P\\\\P",
-      "****", "\\\\dag\\\\dag\\\\dag\\\\dag", "\\\\ddag\\\\ddag\\\\ddag\\\\ddag",
-      "\\\\S\\\\S\\\\S\\\\S", "\\\\P\\\\P\\\\P\\\\P"
-    ),
-    symbol.html = c(
-      "*", "&dagger;", "&Dagger;", "&sect;", "&para;",
-      "**", "&dagger;&dagger;", "&Dagger;&Dagger;", "&sect;&sect;", "&para;&para;",
-      "***", "&dagger;&dagger;&dagger;", "&Dagger;&Dagger;&Dagger;",
-      "&sect;&sect;&sect;", "&para;&para;&para;",
-      "****", "&dagger;&dagger;&dagger;&dagger;", "&Dagger;&Dagger;&Dagger;&Dagger;",
-      "&sect;&sect;&sect;&sect;", "&para;&para;&para;&para;"
-    ),
-    symbol.markdown = c(
-      "\\*", "\u2020", "\u2021", "\u00A7", "\u00B6",
-      "\\*\\*", "\u2020\u2020", "\u2021\u2021", "\u00A7\u00A7", "\u00B6\u00B6",
-      "\\*\\*\\*", "\u2020\u2020\u2020", "\u2021\u2021\u2021",
-      "\u00A7\u00A7\u00A7", "\u00B6\u00B6\u00B6",
-      "\\*\\*\\*\\*", "\u2020\u2020\u2020\u2020", "\u2021\u2021\u2021\u2021",
-      "\u00A7\u00A7\u00A7\u00A7", "\u00B6\u00B6\u00B6\u00B6"
-    ),
-    symbol.pandoc = c(
-      "\\*", "\u2020", "\u2021", "\u00A7", "\u00B6",
-      "\\*\\*", "\u2020\u2020", "\u2021\u2021", "\u00A7\u00A7", "\u00B6\u00B6",
-      "\\*\\*\\*", "\u2020\u2020\u2020", "\u2021\u2021\u2021",
-      "\u00A7\u00A7\u00A7", "\u00B6\u00B6\u00B6",
-      "\\*\\*\\*\\*", "\u2020\u2020\u2020\u2020", "\u2021\u2021\u2021\u2021",
-      "\u00A7\u00A7\u00A7\u00A7", "\u00B6\u00B6\u00B6\u00B6"
-    )
-  )
-  ids <- ids.ops[,notation]
-  # pandoc cannot recognize ^*^ as * is a special character. We have to use ^\*^
+
+  ids.ops <- read.csv(system.file("symbol_index.csv", package = "kableExtra"))
+  ids <- ids.ops[, notation]
   ids.intable <- gsub("\\*", "\\\\*", ids)
   ids.simple <- c(
     "*", "\u2020", "\u2021", "\u00A7", "\u00B6",
@@ -74,11 +38,11 @@
   )
 
   #count the number of items in label and intable notation
-  count.label = length(label)
-  count.intablenoot = sum(str_count(input, "\\[note\\]"))
-  if (count.intablenoot != 0 & count.label != count.intablenoot){
+  count.label <- length(label)
+  count.intablenote <- sum(str_count(input, "\\[note\\]"))
+  if (count.intablenote != 0 & count.label != count.intablenote){
     warning(paste("You entered", count.label, "labels but you put",
-                  count.intablenoot, "[note] in your table."))
+                  count.intablenote, "[note] in your table."))
   }
 
   export <- input
@@ -96,15 +60,17 @@
   # Footnote solution for markdown and pandoc. It is not perfect as
   # markdown doesn't support complex table formats but this solution
   # should be able to satisfy people who don't want to spend extra
-  # time to define their `kable` output.
-  if(!attr(input, "format") %in% c("html", "latex")){
+  # time to define their `kable` format.
+  if (!attr(input, "format") %in% c("html", "latex")) {
     # In table notation
-    if(count.intablenoot != 0){
-      for(i in 1:count.intablenoot){
+    if (count.intablenote != 0) {
+      for (i in 1:count.intablenote) {
+        replace_note <- paste0("^", ids.intable[i], "^",
+          paste0(rep(" ", 4 - ceiling(i/5)), collapse = ""))
+
         export[which(str_detect(export, "\\[note\\]"))[1]] <-
-          sub("\\[note\\]", paste0("^", ids.intable[i], "^",
-            paste0(rep(" ", 4 - ceiling(i/5)),
-              collapse = "")), export[which(str_detect(export, "\\[note\\]"))[1]])
+          sub("\\[note\\]", replace_note,
+              export[which(str_detect(export, "\\[note\\]"))[1]])
       }
     }
     # Fix extra in table notation
@@ -163,7 +129,7 @@
                         paste0("\\\\hline\n", caption.footnote), export)
         }
       }
-      for(i in (count.in.caption.note + 1):count.intablenoot){
+      for(i in (count.in.caption.note + 1):count.intablenote){
         export <- sub("\\[note\\]",
                       paste0("\\\\footnote[", i, "]{", label[i], "}"), export)
       }
@@ -174,7 +140,7 @@
       }
     }else{
       # Replace in-table notation with appropriate symbol
-      for(i in 1:count.intablenoot){
+      for(i in 1:count.intablenote){
         export <- sub("\\[note\\]", paste0("\\\\textsuperscript{", ids.intable[i], "}"), export)
       }
 
@@ -232,7 +198,7 @@
     label <- knitr:::escape_html(label)
 
     # Replace in-table notation with appropriate symbol
-    for(i in 1:count.intablenoot){
+    for(i in 1:count.intablenote){
       export <- sub("\\[note\\]", paste0("<sup>", ids.intable[i], "</sup>"), export)
     }
 
diff --git a/R/htmlTable_styling.R b/R/htmlTable_styling.R
new file mode 100644
index 0000000..da43ab1
--- /dev/null
+++ b/R/htmlTable_styling.R
@@ -0,0 +1,41 @@
+#' HTML table attributes
+#'
+#' @description This function provides a set of shortcuts to common HTML table
+#' formats
+#'
+#' @param bootstrap_options Common HTML table formats
+#' @param font_size
+#'
+#' @export
+htmlTable_styling <- function(bootstrap_options = "bs-table",
+                             font_size = NULL, full_width = T) {
+  bootstrap_options <- match.arg(
+    bootstrap_options,
+    c("bs-table", "striped", "bordered", "hover", "condensed", "responsive"),
+    several.ok = T
+  )
+
+  table_attr_class <- character()
+  if (length(bootstrap_options) == 1 && bootstrap_options == "bs-table") {
+    table_attr_class <- "class='table'"
+  } else {
+    bootstrap_options <- bootstrap_options[bootstrap_options != "bs-table"]
+    bootstrap_options <- paste0("table-", bootstrap_options)
+    table_attr_class <- paste0("class='table ",
+                               paste0(bootstrap_options, collapse = " "), "'")
+  }
+
+  table_attr_style <- c()
+  if (!is.null(font_size)) {
+    table_attr_style <- c(table_attr_style,
+                          paste0("font-size: ", font_size, "px;"))
+  }
+  if (!full_width) {
+    table_attr_style <- c(table_attr_style, "width: auto !important;")
+  }
+  if (length(table_attr_style) != 0) {
+    table_attr_style <- paste0("style = '",
+                               paste0(table_attr_style, collapse = " "), "'")
+  }
+  return(paste(table_attr_class, table_attr_style))
+}
diff --git a/R/kableExtra-package.R b/R/kableExtra-package.R
new file mode 100644
index 0000000..b87d0cc
--- /dev/null
+++ b/R/kableExtra-package.R
@@ -0,0 +1,8 @@
+#' kableExtra
+#'
+#' @importFrom stringr str_count
+#' @name kableExtra-package
+#' @aliases kableExtra
+#' @docType package
+#' @keywords package
+NULL