Skip to content

Commit

Permalink
tags and packages attached
Browse files Browse the repository at this point in the history
  • Loading branch information
jrosell committed Aug 4, 2024
1 parent 601ecd0 commit 1a05d63
Show file tree
Hide file tree
Showing 14 changed files with 364 additions and 22 deletions.
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Generated by roxygen2: do not edit by hand

export(ambhtmx_app)
export(button)
export(input)
export(label)
export(process_error_get)
export(process_error_post)
export(process_loggedin_middleware)
Expand All @@ -10,3 +13,5 @@ export(process_logout_get)
export(render_page)
export(render_plot)
export(render_tags)
export(send_page)
export(textarea)
3 changes: 1 addition & 2 deletions R/ambhtmx.R
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,7 @@ render_page <- \(main = NULL, page_title = NULL) {
#'
#' @param res response object
#' @param main htmltools object of the body of the html page
#' @param page_title the title tag contents of the page
#' @returns the response page
#' @param ... other paramters to the render page function
#' @export
send_page <- \(main, res, ...) {
html <- render_page(main = main, ...)
Expand Down
2 changes: 1 addition & 1 deletion R/dev.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ rebuild_docs_and_check <- function() {
"pkgdown",
"devtools",
"usethis",
"zeallot",
"ggplot2",
"zeallot",
"uwu"
)
suggests_packages |> purrr::map(
Expand Down
36 changes: 32 additions & 4 deletions R/extra-tags.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,44 @@

#' @rdname tags
#' Create HTML tags
#'
#' Create an R object that represents an HTML tag. For convenience, common HTML
#' tags (e.g., `<div>`) can be created by calling for their tag name directly
#' (e.g., `div()`). To create less common HTML5 (or SVG) tags (e.g.,
#' `<article>`), use the `tags` list collection (e.g., `tags$article()`). To
#' create other non HTML/SVG tags, use the lower-level `tag()` constructor.
#'
#' @name builder
#' @param ... Tag attributes (named arguments) and children (unnamed arguments).
#' A named argument with an `NA` value is rendered as a boolean attributes
#' (see example). Children may include any combination of:
#' * Other tags objects
#' * [HTML()] strings
#' * [htmlDependency()]s
#' * Single-element atomic vectors
#' * `list()`s containing any combination of the above
#' @param .noWS Character vector used to omit some of the whitespace that would
#' normally be written around this tag. Valid options include `before`,
#' `after`, `outside`, `after-begin`, and `before-end`.
#' Any number of these options can be specified.
#' @param .renderHook A function (or list of functions) to call when the `tag` is rendered. This
#' function should have at least one argument (the `tag`) and return anything
#' that can be converted into tags via [as.tags()]. Additional hooks may also be
#' added to a particular `tag` via [tagAddRenderHook()].
#' @return A `list()` with a `shiny.tag` class that can be converted into an
#' HTML string via `as.character()` and saved to a file with `save_html()`.
#'
#' @rdname builder
#' @export
button <- htmltools::tags$button

#' @rdname tags
#' @rdname builder
#' @export
textarea <- htmltools::tags$textarea

#' @rdname tags
#' @rdname builder
#' @export
input <- htmltools::tags$input

#' @rdname tags
#' @rdname builder
#' @export
label <- htmltools::tags$label
5 changes: 3 additions & 2 deletions R/zzz.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ attach_library <- function(pkg) {
}

.onAttach <- function(...) {
ambhtmx_core <- c("ambiorix", "htmltools", "tibble", "dplyr", "purrr", "stringr", "glue", "zeallot")

ambhtmx_core <- c("ambiorix", "htmltools", "tibble", "dplyr", "purrr", "stringr", "glue")
if(rlang::is_installed("zeallot")) ambhtmx_core <- c(ambhtmx_core, "zeallot")

invisible(suppressPackageStartupMessages(
lapply(ambhtmx_core, attach_library)
))
Expand Down
8 changes: 7 additions & 1 deletion docs/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ pandoc: 3.1.12.3
pkgdown: 2.0.9
pkgdown_sha: ~
articles: {}
last_built: 2024-08-03T22:28Z
last_built: 2024-08-04T01:08Z

122 changes: 122 additions & 0 deletions docs/reference/builder.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions docs/reference/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1a05d63

Please sign in to comment.