From 782c38e0d7bcde74187c57ffe7c5cff10432ea1a Mon Sep 17 00:00:00 2001 From: David Gohel Date: Fri, 24 May 2024 12:37:15 +0200 Subject: [PATCH] internal: elete unused mathjax-npm related tools --- DESCRIPTION | 6 ++--- NAMESPACE | 3 --- NEWS.md | 3 ++- R/mathjax_node_setup.R | 52 ---------------------------------------- README.Rmd | 9 ++++--- README.md | 33 +++++++++++++------------ man/mathjax_available.Rd | 26 -------------------- man/mathjax_uninstall.Rd | 32 ------------------------- 8 files changed, 25 insertions(+), 139 deletions(-) delete mode 100644 R/mathjax_node_setup.R delete mode 100644 man/mathjax_available.Rd delete mode 100644 man/mathjax_uninstall.Rd diff --git a/DESCRIPTION b/DESCRIPTION index e13bc69..89dfa11 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: equatags Type: Package Title: Equations to 'XML' -Version: 0.2.1 +Version: 0.2.1.002 Authors@R: c( person("David", "Gohel", role = c("aut", "cre"), email = "david.gohel@ardata.fr"), @@ -16,6 +16,6 @@ BugReports: https://github.com/ardata-fr/equatags/issues License: MIT + file LICENSE Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.2.3 +RoxygenNote: 7.3.1 Depends: R (>= 4.0.0) -Imports: xml2, xslt, tools, katex +Imports: xml2, xslt, katex diff --git a/NAMESPACE b/NAMESPACE index 79b9da3..93f6b7e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,11 +1,8 @@ # Generated by roxygen2: do not edit by hand -export(mathjax_available) -export(mathjax_uninstall) export(transform_mathjax) importFrom(katex,katex_html) importFrom(katex,katex_mathml) -importFrom(tools,R_user_dir) importFrom(xml2,read_xml) importFrom(xml2,xml_children) importFrom(xslt,xml_xslt) diff --git a/NEWS.md b/NEWS.md index de3e669..8ad029e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,7 @@ # equatags 0.2.1 -\*.add a display= argument to transform_mathjax() to allow generating display or inline equations. It is set to FALSE by default (inline equation). This changes the behaviour that was previously to generate display equations only. +- add a `display` argument to transform_mathjax() to allow generating display or inline equations. It is set to FALSE by default (inline equation). This changes the behaviour that was previously to generate display equations only. +- delete unused mathjax-npm related tools. # equatags 0.2.0 diff --git a/R/mathjax_node_setup.R b/R/mathjax_node_setup.R deleted file mode 100644 index cc63046..0000000 --- a/R/mathjax_node_setup.R +++ /dev/null @@ -1,52 +0,0 @@ -#' @importFrom tools R_user_dir -mathjax_npm_root <- function(){ - dir <- R_user_dir(package = "equatags", which = "data") - dir -} - -#' @title Is 'mathjax-node' available -#' @description Checks if 'mathjax-node' is available. -#' -#' 'mathjax-node' should be removed with -#' command [mathjax_uninstall()] because it is not used -#' anymore thanks to package 'katex'. -#' @return a single logical value. -#' @export -#' @examples -#' mathjax_available() -#' @family tools for 'mathjax-node' -mathjax_available <- function(){ - dir.exists(mathjax_npm_root()) -} - -#' @export -#' @title Uninstall 'mathjax-node' -#' @description Removes 'mathjax-node'. -#' -#' 'mathjax-node' should be removed with -#' command [mathjax_uninstall()] because it is not used -#' anymore thanks to package 'katex'. -#' @return a single logical value, FALSE if the operation -#' failed, TRUE otherwise. -#' @family tools for 'mathjax-node' -#' @examples -#' if(mathjax_available()) { -#' mathjax_uninstall() -#' } -#' @family tools for 'mathjax-node' -mathjax_uninstall <- function(){ - app_dir <- mathjax_npm_root() - unlink(app_dir, recursive = TRUE, force = TRUE) %in% 0 -} - - -.onAttach <- function(libname, pkgname) { - if(mathjax_available()) { - warning("'mathjax' distribution installed by a previous version of 'equatags'", - " is on your machine. It should be removed.", - " You can remove it by running the following command:\nmathjax_uninstall()", - call. = FALSE) - } - invisible() -} - diff --git a/README.Rmd b/README.Rmd index ea6ecd9..62a04b9 100644 --- a/README.Rmd +++ b/README.Rmd @@ -60,18 +60,17 @@ ft ## Related work -* Packages [texPreview](https://CRAN.R-project.org/package=texPreview) written by +- Packages [texPreview](https://CRAN.R-project.org/package=texPreview) written by Jonathan Sidi, "compile snippets of 'LaTeX' directly into images from the R console to view in the 'RStudio' viewer pane, Shiny apps and 'RMarkdown' documents". With this package, you can get images from your 'latex' code. The tool offers a wider functional spectrum than just equation processing and focuses on 'latex' instead of only 'MathJax' equations. -* Package [mathjaxr](https://cran.r-project.org/package=mathjaxr) written by +- Package [mathjaxr](https://cran.r-project.org/package=mathjaxr) written by Wolfgang Viechtbauer, "Using 'Mathjax' in Rd Files". This package let you add equations in the manual pages of your package in a very convenient way. -* Package [katex](https://cran.r-project.org/package=katex) written by +- Package [katex](https://cran.r-project.org/package=katex) written by Jeroen Ooms, "Rendering Math to HTML, 'MathML', or R-Documentation Format". -'equatags' mainly uses its functions since the release of 'katex' that made -possible to get rid of node.js dependency. +'equatags' mainly uses its functions. diff --git a/README.md b/README.md index 56b53d3..ae58ab8 100644 --- a/README.md +++ b/README.md @@ -46,20 +46,19 @@ ft ## Related work -- Packages [texPreview](https://CRAN.R-project.org/package=texPreview) - written by Jonathan Sidi, “compile snippets of ‘LaTeX’ directly into - images from the R console to view in the ‘RStudio’ viewer pane, - Shiny apps and ‘RMarkdown’ documents”. With this package, you can - get images from your ‘latex’ code. The tool offers a wider - functional spectrum than just equation processing and focuses on - ‘latex’ instead of only ‘MathJax’ equations. - -- Package [mathjaxr](https://cran.r-project.org/package=mathjaxr) - written by Wolfgang Viechtbauer, “Using ‘Mathjax’ in Rd Files”. This - package let you add equations in the manual pages of your package in - a very convenient way. - -- Package [katex](https://cran.r-project.org/package=katex) written by - Jeroen Ooms, “Rendering Math to HTML, ‘MathML’, or R-Documentation - Format”. ‘equatags’ mainly uses its functions since the release of - ‘katex’ that made possible to get rid of node.js dependency. +- Packages [texPreview](https://CRAN.R-project.org/package=texPreview) + written by Jonathan Sidi, “compile snippets of ‘LaTeX’ directly into + images from the R console to view in the ‘RStudio’ viewer pane, Shiny + apps and ‘RMarkdown’ documents”. With this package, you can get images + from your ‘latex’ code. The tool offers a wider functional spectrum + than just equation processing and focuses on ‘latex’ instead of only + ‘MathJax’ equations. + +- Package [mathjaxr](https://cran.r-project.org/package=mathjaxr) + written by Wolfgang Viechtbauer, “Using ‘Mathjax’ in Rd Files”. This + package let you add equations in the manual pages of your package in a + very convenient way. + +- Package [katex](https://cran.r-project.org/package=katex) written by + Jeroen Ooms, “Rendering Math to HTML, ‘MathML’, or R-Documentation + Format”. ‘equatags’ mainly uses its functions. diff --git a/man/mathjax_available.Rd b/man/mathjax_available.Rd deleted file mode 100644 index ee4014b..0000000 --- a/man/mathjax_available.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/mathjax_node_setup.R -\name{mathjax_available} -\alias{mathjax_available} -\title{Is 'mathjax-node' available} -\usage{ -mathjax_available() -} -\value{ -a single logical value. -} -\description{ -Checks if 'mathjax-node' is available. - -'mathjax-node' should be removed with -command \code{\link[=mathjax_uninstall]{mathjax_uninstall()}} because it is not used -anymore thanks to package 'katex'. -} -\examples{ -mathjax_available() -} -\seealso{ -Other tools for 'mathjax-node': -\code{\link{mathjax_uninstall}()} -} -\concept{tools for 'mathjax-node'} diff --git a/man/mathjax_uninstall.Rd b/man/mathjax_uninstall.Rd deleted file mode 100644 index 9ba8baf..0000000 --- a/man/mathjax_uninstall.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/mathjax_node_setup.R -\name{mathjax_uninstall} -\alias{mathjax_uninstall} -\title{Uninstall 'mathjax-node'} -\usage{ -mathjax_uninstall() -} -\value{ -a single logical value, FALSE if the operation -failed, TRUE otherwise. -} -\description{ -Removes 'mathjax-node'. - -'mathjax-node' should be removed with -command \code{\link[=mathjax_uninstall]{mathjax_uninstall()}} because it is not used -anymore thanks to package 'katex'. -} -\examples{ -if(mathjax_available()) { - mathjax_uninstall() -} -} -\seealso{ -Other tools for 'mathjax-node': -\code{\link{mathjax_available}()} - -Other tools for 'mathjax-node': -\code{\link{mathjax_available}()} -} -\concept{tools for 'mathjax-node'}