R/ff_sup_inout.R
ff_sup_clean_rmd.Rd
knit rmd normally generates pdf and html in the same folder. This deletes those files. The file generates a new subfolder by default called htmlpdfr that stores the knit pdf and html files, along with curled R file.
The RMD files should not clear all at the top. That would lead to deleting the rest of the string paths to be searched over.
ff_sup_clean_rmd(
ar_spt_root,
ar_spn_skip,
st_file_pattern = ".Rmd",
st_git_pattern = ".Rmd",
st_folder_pdf = "/htmlpdfr/",
st_folder_html = "/htmlpdfr/",
st_folder_R = "/htmlpdfr/",
bl_gen_if_git_old = FALSE,
bl_recursive = TRUE,
bl_verbose = TRUE,
bl_test = TRUE,
it_hierachy_lower_rmd = 0,
it_hierachy_shift = 2,
it_toc_depth = 3,
ls_bool_convert = list(bl_pdf = TRUE, bl_html = TRUE, bl_R = TRUE),
ls_bool_remove = list(bl_remove_html = TRUE)
)
array of string paths of folders to search in
array a string array of names, if path found contains any of the string in the array, will skip.
string name of file suffix to search over
string name of file suffix based on which to consider if updating. If this is difference from st_file_pattern, use the file base with this suffix to detect if file has been changed. This is needed to detect if mlx files have changed for rmd files, where rmd files are not git tracked.
string subfolder where to store the pdf file, if just empty, store in rmd folder
string subfolder where to store the html file, if just empty, store in rmd folder
string subfolder where to store the R file, if just empty, store in rmd folder
boolean if true then even if RMD files do not have git status change, still update pdf and html files.
boolean if to search in folders recursively
boolean if testing, meaning do not generate pdf html, just see which files are been
integer promote saved hierrachy for rmd files and resave.
int modification level of promotion from bookdown hierachy to own file hierarchy for individual files
rmd own file outputs toc levels to show
list of booleans to generate pdf, html and or R file. Generate only HTML for example. considered included, searched and found
list of booleans contorling if removing certain files in the same directory where the rmd file is
a list of string paths of files generated
ls_spt_pdf_generated - a list of pdf file names
ls_spt_html_generated - a list of html file names
ls_spt_R_generated - a list of R file names generated
#'
https://fanwangecon.github.io/R4Econ/development/inout/fs_rmd_pdf_html.html https://github.com/FanWangEcon/REconTools/blob/master/R/ff_sup_inout.R
ar_spt_root = c('C:/Users/fan/R4Econ/amto/array/', 'C:/Users/fan/R4Econ/math/integration')
ar_spt_root = c('C:/Users/fan/R4Econ/math/integration')
ar_spt_root = c('C:/Users/fan/R4Econ/development/inout')
ar_spn_skip <- c('matrix', 'tibble', '_main', '_mod')
ff_sup_clean_rmd(ar_spt_root, ar_spn_skip)
#> Search and Check
#> NO CHNGE: C:/Users/fan/R4Econ/development/inout/fs_path.Rmd
#> NO CHNGE: C:/Users/fan/R4Econ/development/inout/fs_rmd_pdf_html.Rmd
#> NO CHNGE: C:/Users/fan/R4Econ/development/inout/fs_text_save.Rmd
#> NO CHNGE: C:/Users/fan/R4Econ/development/inout/main.Rmd
#> Generated pdf files:
#> [1] ""
#>
#> ""
#>
#> Generated html files:
#> [1] ""
#>
#> ""
#>
#> Generated R files:
#> [1] ""
#>
#> ""
#>
#> $ls_spt_pdf_generated
#> character(0)
#>
#> $ls_spt_html_generated
#> character(0)
#>
#> $ls_spt_R_generated
#> character(0)
#>
# ff_sup_clean_rmd(ar_spt_root, ar_spn_skip, bl_test = FALSE, bl_gen_if_git_old = TRUE)