| Title: | Excerpt Structuring Comments from Your Code File and Set a Table of Contents |
|---|---|
| Description: | Ever read or wrote source files containing sectioning comments? If these comments are markdown style section comments, you can excerpt them and set a table of contents using the 'python' package 'excerpts' (<https://pypi.org/project/excerpts/>). |
| Authors: | Andreas Dominik Cullmann [aut, cre] |
| Maintainer: | Andreas Dominik Cullmann <[email protected]> |
| License: | BSD_2_clause + file LICENSE |
| Version: | 2.1.0.9000 |
| Built: | 2026-06-06 07:05:36 UTC |
| Source: | https://gitlab.com/fvafrcu/excerptr |
This is just an R interface to the python package excerpts (https://pypi.org/project/excerpts/).
Maintainer: Andreas Dominik Cullmann [email protected]
Useful links:
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" )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") }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") }