R/html_layout.R

Defines functions html_layout

Documented in html_layout

#' Create an html grid layout
#' @param layout list of vectors. one vector per row, the integers in the vector specifying the relative width of rach cell of this row.
#' @return Character. html grid.
#' @export


html_layout <- function(layout = list(c(1,2,1),c(3,1),c(1,1,1,1))){
  
  for (i in 1:length(layout)){
    cells <- layout[[i]]
    for (j in 1:length(cells)){
      cells[[j]] <- html_cell(cells[[j]])
    }
    layout[[i]] <- html_row(cells)
  }
  
  grid <- paste(layout, collapse = "\n")
  grid <- paste('<div>\n',grid,'\n</div>', collapse = "\n")
  
  rstudioapi::insertText(grid)
}
NicolasJBM/writer documentation built on Aug. 12, 2019, 2:36 p.m.