| excerptr | R Documentation |
Just a wrapper to the python function excerpts.excerpts.
See https://pypi.org/project/excerpts/ for details.
excerptr(
file_name,
comment_character = "#",
magic_character = "%",
output_path = "",
allow_pep8 = TRUE,
prefix = "",
postfix = "",
run_pandoc = TRUE,
compile_latex = FALSE,
pandoc_formats = "tex"
)
file_name |
Name the file from which to excerpt. |
comment_character |
Should be "#" for R. |
magic_character |
The magic character marking the structuring comments
in |
output_path |
Name the path where to output to. |
allow_pep8 |
Don't bother. See |
prefix |
Give a prefix to use for output files. |
postfix |
Give a postfix to use for output files. |
run_pandoc |
Try to run |
compile_latex |
Try to compile LaTeX if |
pandoc_formats |
A character vector naming the output formats for
|
The status of excerpts.excerpts.
if (reticulate::py_available(initialize = TRUE)) {
root <- system.file(package = "excerptr")
test_files <- file.path(root, "excerpts", "tests", "files")
outpath <- tempdir()
python_source <- "some_code.py"
f <- normalizePath(file.path(test_files, python_source))
cat(readLines(f), sep = "\n")
tryCatch(
excerptr(file_name = file.path(test_files, python_source),
output_path = tempdir(), run_pandoc = FALSE,
compile_latex = FALSE,
pandoc_formats = c("tex", "html")),
error = identity)
f <- file.path(outpath, sub("\\.py$", ".md", python_source))
if (!fritools::is_cran()) cat(readLines(f), sep = "\n")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.