From 1d8c2d4b7dcbd973fc3420631ae39b3dd1bf3fb8 Mon Sep 17 00:00:00 2001 From: Diego H Date: Mon, 18 Mar 2024 12:40:49 +0100 Subject: [PATCH] =?UTF-8?q?Actualiza=20art=C3=ADculo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inst/pkgdown/assets/BS5/rostemplate.css | 13 ++- inst/pkgdown/assets/BS5/rostemplate.min.css | 2 +- vignettes/articles/descargas.Rmd | 102 +++++++++++++++++--- 3 files changed, 100 insertions(+), 17 deletions(-) diff --git a/inst/pkgdown/assets/BS5/rostemplate.css b/inst/pkgdown/assets/BS5/rostemplate.css index 363cfe0..7271bcf 100644 --- a/inst/pkgdown/assets/BS5/rostemplate.css +++ b/inst/pkgdown/assets/BS5/rostemplate.css @@ -22,6 +22,17 @@ code a { font-weight: bold; } +.template-reference-topic dt code { + font-weight: 700; + font-family: var(--bs-body-font-family); + font-size: var(--bs-body-font-size); + color: var(--bs-body-color); + text-align: var(--bs-body-text-align); + background-color: var(--bs-body-bg); + padding: 0; + border-radius: 0; +} + /* Section: Syntax highlighter emacs (como en la web de rOpenSpain) */ pre { display: block; @@ -443,4 +454,4 @@ blockquote { padding: 10px 20px; margin: 0 0 20px; border-left: 5px solid #986dbd; -} +} \ No newline at end of file diff --git a/inst/pkgdown/assets/BS5/rostemplate.min.css b/inst/pkgdown/assets/BS5/rostemplate.min.css index 938241e..8aff875 100644 --- a/inst/pkgdown/assets/BS5/rostemplate.min.css +++ b/inst/pkgdown/assets/BS5/rostemplate.min.css @@ -1 +1 @@ -h1 code,h2 code,h3 code,h4 code,h5 code,h6 code{background-color:transparent}pre a{color:inherit;font-weight:inherit;text-decoration:underline}code a{text-decoration:underline}.pkg{font-weight:bold}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{color:#333}pre code span.al{border:1px solid red}pre code span.an{color:#080;font-style:italic}pre code span.at{color:#b44}pre code span.bn{color:#800}pre code span.bu{color:#b44}pre code span.cf{color:#b44}pre code span.ch{color:#b44}pre code span.cn{color:#800}pre code span.co{color:#080;font-style:italic}pre code span.cv{color:#080;font-style:italic}pre code span.do{color:#080;font-style:italic}pre code span.dt{color:#b44}pre code span.dv{color:#666}pre code span.er{border:1px solid red}pre code span.ex{color:#b44;font-weight:bold}pre code span.fl{color:#666}pre code span.fu{color:#00a000}pre code span.im{color:#b44}pre code span.in{color:#080;font-style:italic}pre code span.kw{color:#a2f;font-weight:bold}pre code span.op{color:#666}pre code span.ot{color:#008000}pre code span.pp{color:#080}pre code span.re{color:#080;font-style:italic}pre code span.sc{color:#666}pre code span.ss{color:#008000}pre code span.st{color:#b44}pre code span.va{color:#b8860b}pre code span.vs{color:#b44}pre code span.wa{border:1px solid red}.navbar-light .navbar-brand{font-weight:300}.navbar-light .navbar-brand:hover,.navbar-light .navbar-brand:focus{color:#555}.navbar-light .nav-item{text-transform:uppercase;text-decoration:underline;font-weight:bold;letter-spacing:.04em}.navbar-light .navbar-nav .active>.nav-link{background-color:#986dbd;color:white}.navbar-light .navbar-nav .active>.nav-link:hover,.navbar-light .navbar-nav .active>.nav-link:focus{background-color:#cab3dd}.navbar-light .navbar-nav .nav-item>.nav-link:hover,.navbar-light .navbar-nav .nav-item>.nav-link:focus{background-color:#cab3dd}.navbar small{font-size:.75rem;padding-top:.65rem;padding-right:1rem}.navbar small.text-muted{color:#986dbd !important}.navbar-nav .active.nav-item{text-decoration:none}@media((min-width:992px)){.navbar-nav .nav-item>.nav-link{border-top:solid 5px transparent}}@media((min-width:992px)){.navbar-light .navbar-nav .active>.nav-link{border-top:solid 5px #653d87}}@media((min-width:992px)){.navbar-light .navbar-nav .nav-item>.nav-link:hover,.navbar-light .navbar-nav .nav-item>.nav-link:focus{border-top:solid 5px #986dbd}}@media((max-width:992px)){#navbar{padding-top:.75rem}}@media((max-width:992px)){#navbar ul:first-of-type{border-top:solid 1px #ccc}}.navbar-toggler:focus{box-shadow:0 0 0 .25rem rgba(152,109,189,0.3)}#toc>.nav a.nav-link.active{color:white;background-color:#986dbd}.logo{display:none}.ROSh1{background:url('texture-bw.png') center center repeat;padding:20px 0;color:#333;text-transform:uppercase;font-size:30px;font-weight:700;letter-spacing:.08em;text-align:center}.ROSh1 img{display:none}#homelogoxs{height:24px;display:inline}#ROS-heading-breadcrumbs{padding-top:10px;padding-bottom:1px;font-size:14px;text-decoration:none;text-transform:none;letter-spacing:0}#ROS-partof{font-weight:300;color:black}.ROS-light{font-weight:300}#footer{background:#555;padding:50px 0;color:#999;margin-top:1rem;margin-bottom:0}#footer h1,#footer h2,#footer h3,#footer h4,#footer h5,#footer h6{color:#eee}#footer h4{font-size:14px;font-weight:800;text-transform:uppercase;letter-spacing:.08em}#copyright{margin:0;background:#333;color:#ccc;padding:50px 0;font-size:12px;line-height:28px}.caption,.figure{color:#6c757d;margin-left:auto;margin-right:auto;margin-top:.5rem;font-size:85%;width:100%}blockquote{padding:10px 20px;margin:0 0 20px;border-left:5px solid #986dbd} +h1 code,h2 code,h3 code,h4 code,h5 code,h6 code{background-color:transparent}pre a{color:inherit;font-weight:inherit;text-decoration:underline}code a{text-decoration:underline}.pkg{font-weight:bold}.template-reference-topic dt code{font-weight:700;font-family:var(--bs-body-font-family);font-size:var(--bs-body-font-size);color:var(--bs-body-color);text-align:var(--bs-body-text-align);background-color:var(--bs-body-bg);padding:0;border-radius:0}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.42857143;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{color:#333}pre code span.al{border:1px solid red}pre code span.an{color:#080;font-style:italic}pre code span.at{color:#b44}pre code span.bn{color:#800}pre code span.bu{color:#b44}pre code span.cf{color:#b44}pre code span.ch{color:#b44}pre code span.cn{color:#800}pre code span.co{color:#080;font-style:italic}pre code span.cv{color:#080;font-style:italic}pre code span.do{color:#080;font-style:italic}pre code span.dt{color:#b44}pre code span.dv{color:#666}pre code span.er{border:1px solid red}pre code span.ex{color:#b44;font-weight:bold}pre code span.fl{color:#666}pre code span.fu{color:#00a000}pre code span.im{color:#b44}pre code span.in{color:#080;font-style:italic}pre code span.kw{color:#a2f;font-weight:bold}pre code span.op{color:#666}pre code span.ot{color:#008000}pre code span.pp{color:#080}pre code span.re{color:#080;font-style:italic}pre code span.sc{color:#666}pre code span.ss{color:#008000}pre code span.st{color:#b44}pre code span.va{color:#b8860b}pre code span.vs{color:#b44}pre code span.wa{border:1px solid red}.navbar-light .navbar-brand{font-weight:300}.navbar-light .navbar-brand:hover,.navbar-light .navbar-brand:focus{color:#555}.navbar-light .nav-item{text-transform:uppercase;text-decoration:underline;font-weight:bold;letter-spacing:.04em}.navbar-light .navbar-nav .active>.nav-link{background-color:#986dbd;color:white}.navbar-light .navbar-nav .active>.nav-link:hover,.navbar-light .navbar-nav .active>.nav-link:focus{background-color:#cab3dd}.navbar-light .navbar-nav .nav-item>.nav-link:hover,.navbar-light .navbar-nav .nav-item>.nav-link:focus{background-color:#cab3dd}.navbar small{font-size:.75rem;padding-top:.65rem;padding-right:1rem}.navbar small.text-muted{color:#986dbd !important}.navbar-nav .active.nav-item{text-decoration:none}@media((min-width:992px)){.navbar-nav .nav-item>.nav-link{border-top:solid 5px transparent}}@media((min-width:992px)){.navbar-light .navbar-nav .active>.nav-link{border-top:solid 5px #653d87}}@media((min-width:992px)){.navbar-light .navbar-nav .nav-item>.nav-link:hover,.navbar-light .navbar-nav .nav-item>.nav-link:focus{border-top:solid 5px #986dbd}}@media((max-width:992px)){#navbar{padding-top:.75rem}}@media((max-width:992px)){#navbar ul:first-of-type{border-top:solid 1px #ccc}}.navbar-toggler:focus{box-shadow:0 0 0 .25rem rgba(152,109,189,0.3)}#toc>.nav a.nav-link.active{color:white;background-color:#986dbd}.logo{display:none}.ROSh1{background:url('texture-bw.png') center center repeat;padding:20px 0;color:#333;text-transform:uppercase;font-size:30px;font-weight:700;letter-spacing:.08em;text-align:center}.ROSh1 img{display:none}#homelogoxs{height:24px;display:inline}#ROS-heading-breadcrumbs{padding-top:10px;padding-bottom:1px;font-size:14px;text-decoration:none;text-transform:none;letter-spacing:0}#ROS-partof{font-weight:300;color:black}.ROS-light{font-weight:300}#footer{background:#555;padding:50px 0;color:#999;margin-top:1rem;margin-bottom:0}#footer h1,#footer h2,#footer h3,#footer h4,#footer h5,#footer h6{color:#eee}#footer h4{font-size:14px;font-weight:800;text-transform:uppercase;letter-spacing:.08em}#copyright{margin:0;background:#333;color:#ccc;padding:50px 0;font-size:12px;line-height:28px}.caption,.figure{color:#6c757d;margin-left:auto;margin-right:auto;margin-top:.5rem;font-size:85%;width:100%}blockquote{padding:10px 20px;margin:0 0 20px;border-left:5px solid #986dbd} \ No newline at end of file diff --git a/vignettes/articles/descargas.Rmd b/vignettes/articles/descargas.Rmd index 31263b8..a41a789 100644 --- a/vignettes/articles/descargas.Rmd +++ b/vignettes/articles/descargas.Rmd @@ -159,6 +159,7 @@ dwn_w %>% ```{r datos, echo=FALSE} library(reactable) +library(htmltools) lastyear <- dwn %>% filter(date >= (Sys.Date() - 365)) %>% @@ -198,25 +199,79 @@ end <- names(end) <- c( "paquete", "en CRAN desde", - "última version en CRAN", - "media descargas diarias", "ultimo dia", - "ultima semana", "ultimo mes", "ultimo año" + "Versión en CRAN", + "media diaria", "último dia", + "última semana", "último mes", "último año" ) +react_es <- reactableLang( + sortLabel = "Ordena {name}", + filterPlaceholder = "", + filterLabel = "Filtro {name}", + searchPlaceholder = "Búsqueda", + searchLabel = "Búsqueda", + noData = "Sin resultados", + pageNext = "Siguiente", + pagePrevious = "Anterior", + pageNumbers = "{page} de {pages}", + pageInfo = "{rowStart}\u2013{rowEnd} de {rows} registros", + pageSizeOptions = "Mostrando {rows}", + pageNextLabel = "Siguiente página", + pagePreviousLabel = "Página anterior", + pageNumberLabel = "Página {page}", + pageJumpLabel = "Ir a página", + pageSizeOptionsLabel = "Registros por página" +) + +options(reactable.language = react_es) + reactable( end, filterable = TRUE, searchable = TRUE, showPageSizeOptions = TRUE, striped = TRUE, + defaultColDef = colDef( + minWidth = 150, vAlign = "center", footerStyle = list(fontWeight = "bold"), + footer = function(values) { + if (!is.numeric(values)) { + return() + } + prettyNum(sum(values), big.mark = ".", decimal.mark = ",") + } + ), paginationType = "jump", elementId = "cran-dwn", - defaultPageSize = 25, - columns = list(paquete = colDef(cell = function(value) { - # Render as a link - url <- paste0("https://CRAN.R-project.org/package=", value) - htmltools::tags$a(href = url, target = "_blank", as.character(value)) - })) + columns <- list( + paquete = colDef( + cell = function(value) { + # Render as a link + url <- paste0("https://CRAN.R-project.org/package=", value) + badge <- paste0("https://badges.cranchecks.info/worst/", value, ".svg") + link <- htmltools::a(href = url, target = "_blank", as.character(value)) + div( + div(link, style = list(fontWeight = "bold")), + div(htmltools::img(src = badge, alt = as.character(value)), + style = list(fontSize = "75%") + ) + ) + }, + align = "left", + sticky = "left", + rowHeader = TRUE + ), + "media diaria" = colDef( + format = colFormat(separators = TRUE), + footer = function(values) { + p <- round(mean(values), 2) + prettyNum(p, big.mark = ".", decimal.mark = ",") + } + ), + "último dia" = colDef(format = colFormat(separators = TRUE)), + "última semana" = colDef(format = colFormat(separators = TRUE)), + "último mes" = colDef(format = colFormat(separators = TRUE)), + "último año" = colDef(format = colFormat(separators = TRUE)) + ) ) ``` @@ -277,13 +332,30 @@ reactable( searchable = TRUE, showPageSizeOptions = TRUE, striped = TRUE, + defaultColDef = colDef( + minWidth = 150, vAlign = "center", footerStyle = list(fontWeight = "bold"), + footer = function(values) { + if (!is.numeric(values)) { + return() + } + prettyNum(sum(values), big.mark = ".", decimal.mark = ",") + } + ), paginationType = "jump", elementId = "posit-dwn", - defaultPageSize = 25, - columns = list(paquete = colDef(cell = function(value) { - # Render as a link - url <- paste0("https://CRAN.R-project.org/package=", value) - htmltools::tags$a(href = url, target = "_blank", as.character(value)) - })) + columns = list( + paquete = colDef( + cell = function(value) { + # Render as a link + url <- paste0("https://CRAN.R-project.org/package=", value) + link <- htmltools::a(href = url, target = "_blank", as.character(value)) + div(link, style = list(fontWeight = "bold")) + }, + align = "left", + sticky = "left", + rowHeader = TRUE + ), + "Descargas (último mes)" = colDef(format = colFormat(separators = TRUE)) + ) ) ```