| Title: | Create Reports Using R and 'asciidoc' | 
| Version: | 4.1.1 | 
| Description: | Inspired by Karl Broman‘s reader on using ’knitr' with 'asciidoc' (https://kbroman.org/knitr_knutshell/pages/asciidoc.html), this is merely a wrapper to 'knitr' and 'asciidoc'. | 
| License: | BSD_2_clause + file LICENSE | 
| URL: | https://gitlab.com/fvafrcu/rasciidoc | 
| Depends: | R (≥ 3.3.0) | 
| Imports: | checkmate, fritools (≥ 3.7.1), gert, highr, knitr, reticulate, tools | 
| Suggests: | devtools, pkgload, rmarkdown, rprojroot, RUnit, testthat, withr | 
| Encoding: | UTF-8 | 
| RoxygenNote: | 7.2.3 | 
| SystemRequirements: | python >= 2.6, by default rasciidoc uses a system installation of asciidoc. If a system installation of asciidoc is not available, it downloads the sources from (<http://gitlab.com/asciidoc>). GNU source-highlight is recommended. | 
| VignetteBuilder: | rasciidoc | 
| NeedsCompilation: | no | 
| Packaged: | 2023-08-15 21:58:49 UTC; qwer | 
| Author: | Andreas Dominik Cullmann [aut, cre] | 
| Maintainer: | Andreas Dominik Cullmann <fvafrcu@mailbox.org> | 
| Repository: | CRAN | 
| Date/Publication: | 2023-08-15 22:20:02 UTC | 
Create Reports Using R and asciidoc
Description
Inspired by Karl Broman's reader on using knitr with
asciidoc
(https://kbroman.org/knitr_knutshell/pages/asciidoc.html), this is
merely a wrapper to knitr and asciidoc.
Arguments
| write_to_disk | Write to disk? See Warning. | 
Details
You will find the details in
vignette("An_Introduction_to_rasciidoc", package = "rasciidoc").
Warning
Due to the CRAN policy of not writing "anywhere else on the
file system apart from the R session's temporary directory",
we work on a temporary copy of file_name.
Thus all internal sourcing and internal links will be
broken and any output is written to tempdir().
Set the option "write_to_disk" to TRUE (using 
options(write_to_disk = TRUE)
to bypass this. You may want to include the above line into your
‘~/.Rprofile’.
Adjust knitr's Hooks for asciidoc
Description
By default, knitr renders messages, warnings and errors to
[NOTE|WARNING|ERROR]-blocks in asciidoc, which is ... not my
choice.
To restore knitr's behaviour, set hooks or replacement to
NULL.
Usage
adjust_asciidoc_hooks(
  hooks = c("message", "error", "warning"),
  replacement = "source"
)
Arguments
| hooks | Character vector naming the output hooks to be replaced by
the  | 
| replacement | The hook with which to replace the hooks given by
 | 
Details
This is a modified version of
render_asciidoc of knitr
version 1.18.7.
Value
The return value of
knit_hooks$set,
invisibly NULL, currently.
Is a Version Requirement Met?
Description
Just a wrapper to compareVersion, I regularly forget how to use
it.
Usage
is_version_sufficient(installed, required)
Arguments
| installed | The version installed. | 
| required | The version required. | 
Value
Examples
is_version_sufficient(installed = "1.0.0", required = "2.0.0")
is_version_sufficient(installed = "1.0.0", required = "1.0.0")
Is the System Running a Windows Machine?
Description
Is the System Running a Windows Machine?
Usage
is_windows()
Value
Render an asciidoc File
Description
This is the basic interface to asciidoc. Not more than a call to
system2 and checks on asciidoc and
source-highlight.
You should usually not call it directly, see
render for a wrapper.
Usage
rasciidoc(
  file_name,
  ...,
  write_to_disk = getOption("write_to_disk"),
  enforce_requirements = getOption("enforce_requirements"),
  git_checkout_asciidoc_tag = NA
)
Arguments
| file_name | The file to run  | 
| ... | arguments passed to  | 
| write_to_disk | Write to disk? See Warning. | 
| enforce_requirements | Should system requirements be enforced (CRAN
requires packages to pass checks if system requirements (external commands)
are not met)? Set to  | 
| git_checkout_asciidoc_tag | If  Don't mind, just stick with the default. You would have to know which python version will be used. | 
Value
Invisibly TRUE or
FALSE, depending on success.
Warning
Due to the CRAN policy of not writing "anywhere else on the
file system apart from the R session's temporary directory",
we work on a temporary copy of file_name.
Thus all internal sourcing and internal links will be
broken and any output is written to tempdir().
Set the option "write_to_disk" to TRUE (using 
options(write_to_disk = TRUE)
to bypass this. You may want to include the above line into your
‘~/.Rprofile’.
See Also
Examples
# CRAN complains about elapsed times
if (fritools::is_running_on_fvafrcu_machines()) {
    wd <- file.path(tempdir(), "rasciidoc")
    dir.create(wd)
    file  <- system.file("files", "minimal", "knit.asciidoc",
                         package = "rasciidoc")
    file.copy(file, wd)
    r <- rasciidoc(file_name = file.path(wd, basename(file)),
                   write_to_disk = getOption("write_to_disk"), "-b html")
    if (interactive()) browseURL(attr(r, "info")[["output"]])
    if (isTRUE(getOption("write_to_disk"))) {
        dir(wd, full.names = TRUE)
    } else {
        dir(tempdir(), full.names = TRUE)
    }
    unlink(wd, recursive = TRUE)
}
Spin or Knit and Render a 'Rasciidoc' File
Description
Spin or Knit (if required) and render an 'Rasciidoc' file.
Usage
render(
  file_name,
  knit = NA,
  write_to_disk = getOption("write_to_disk"),
  envir = parent.frame(),
  hooks = c("message", "error", "warning"),
  replacement = "source",
  asciidoc_args = "-b html",
  what = c("auto", "all", "no_slides", "slides"),
  git_checkout_asciidoc_tag = NA,
  clean = FALSE,
  ...
)
Arguments
| file_name | The file to render. | 
| knit | Knit the file first using  | 
| write_to_disk | Write to disk? See Warning. | 
| envir | The frame in which to render. | 
| hooks | Character vector naming the output hooks to be replaced by
the  | 
| replacement | The hook with which to replace the hooks given by
 | 
| asciidoc_args | arguments passed to  | 
| what | What is to be rendered?  | 
| git_checkout_asciidoc_tag | If  Don't mind, just stick with the default. You would have to know which python version will be used. | 
| clean | Remove temporary file(s)? | 
| ... | Only there to register as vignette engine. Do not use! | 
Value
The return value of rasciidoc.
Warning
Due to the CRAN policy of not writing "anywhere else on the
file system apart from the R session's temporary directory",
we work on a temporary copy of file_name.
Thus all internal sourcing and internal links will be
broken and any output is written to tempdir().
Set the option "write_to_disk" to TRUE (using 
options(write_to_disk = TRUE)
to bypass this. You may want to include the above line into your
‘~/.Rprofile’.
See Also
Examples
# CRAN complains about elapsed times
if (fritools::is_running_on_fvafrcu_machines()) {
    wd <- file.path(tempdir(), "rasciidoc")
    dir.create(wd)
    file  <- system.file("files", "minimal", "knit.Rasciidoc",
                         package = "rasciidoc")
    file.copy(file, wd)
    r <- rasciidoc::render(file.path(wd, basename(file)),
                           write_to_disk = getOption("write_to_disk"),
                           asciidoc_args = "-b slidy")
    if (isTRUE(getOption("write_to_disk"))) {
        dir(wd, full.names = TRUE)
    } else {
        dir(tempdir(), full.names = TRUE)
    }
    unlink(wd, recursive = TRUE)
}
Throw a Condition
Description
Throws a condition of class c("error", "rasciidoc", "condition").
Usage
throw(message_string, system_call = sys.call(-1), ...)
Arguments
| message_string | The message to be thrown. | 
| system_call | The call to be thrown. | 
| ... | Arguments to be passed to
 | 
Details
We use this condition as an error dedicated to rasciidoc.
Value
The function does never return anything, it stops with a condition of class c("error", "rasciidoc", "condition").