-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
40 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Package: goxygen | ||
Type: Package | ||
Title: Documentation package for modular GAMS code | ||
Version: 0.11.0 | ||
Version: 0.11.1 | ||
Date: 2018-09-07 | ||
Authors@R: c(person("Jan Philipp", "Dietrich", email = "[email protected]", role = c("aut","cre"))) | ||
Description: A collection of tools which allow to manipulate and analyze code. | ||
|
@@ -12,4 +12,4 @@ License: BSD_2_clause + file LICENSE | |
Encoding: UTF-8 | ||
LazyData: no | ||
RoxygenNote: 6.1.0 | ||
ValidationKey: 1955910 | ||
ValidationKey: 1973691 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,37 @@ | ||
#' buildPDF | ||
#' | ||
#' Converts a folder with markdown files and a corresponding literature library | ||
#' (if available) to a single PDF and creates page breaks and cross-links between | ||
#' topics. | ||
#' | ||
#' Pandoc (https://pandoc.org/) together with pandoc-citeproc need to be installed | ||
#' on the system. | ||
#' | ||
#' @param file name of the PDF to be written | ||
#' @param mdfolder path to the markdown folder to be used as source | ||
#' @param literature path to a bibliography, if available (will be ignored | ||
#' if file does not exist) | ||
#' @param supplementary a vector of files and/or folders required for the conversion | ||
#' (e.g. an images subdirectory with figures to be shown in the documents) | ||
#' @author Jan Philipp Dietrich | ||
#' @seealso \code{\link{goxygen}}, \code{\link{buildHTML}} | ||
#' @export | ||
|
||
buildPDF <- function(file="documentation.pdf", mdfolder="markdown", literature="literature.bib", supplementary=NULL) { | ||
message("Start PDF creation...") | ||
check_pandoc() | ||
for(elem in supplementary) file.copy(elem,".",recursive = TRUE, overwrite = TRUE) | ||
sep <- tempfile() | ||
writeLines("\\pagebreak",sep) | ||
ref <- tempfile() | ||
files <- list.files(mdfolder,pattern="*.md",full.names = TRUE) | ||
moduleNames <- sub("\\.[^.]*$","",basename(files)) | ||
returnReferences(moduleNames,paste0("#id-",moduleNames),ref,level=1) | ||
files <- paste(paste(files,collapse=paste0(" ",sep," ")),ref) | ||
if(is.null(literature)) bib <- "" | ||
else bib <- ifelse(file.exists(literature),paste0(" --metadata link-citations --bibliography=",literature),"") | ||
system(paste0("pandoc ",files," -o ",file," --template ", | ||
system.file("templates","template.latex",package="goxygen"), | ||
" -V colorlinks --listings",bib)) | ||
message("...finished PDF creation!") | ||
} | ||
#' buildPDF | ||
#' | ||
#' Converts a folder with markdown files and a corresponding literature library | ||
#' (if available) to a single PDF and creates page breaks and cross-links between | ||
#' topics. | ||
#' | ||
#' Pandoc (https://pandoc.org/) together with pandoc-citeproc need to be installed | ||
#' on the system. | ||
#' | ||
#' @param file name of the PDF to be written | ||
#' @param mdfolder path to the markdown folder to be used as source | ||
#' @param literature path to a bibliography, if available (will be ignored | ||
#' if file does not exist) | ||
#' @param supplementary a vector of files and/or folders required for the conversion | ||
#' (e.g. an images subdirectory with figures to be shown in the documents) | ||
#' @author Jan Philipp Dietrich | ||
#' @seealso \code{\link{goxygen}}, \code{\link{buildHTML}} | ||
#' @export | ||
|
||
buildPDF <- function(file="documentation.pdf", mdfolder="markdown", literature="literature.bib", supplementary=NULL) { | ||
message("Start PDF creation...") | ||
check_pandoc() | ||
for(elem in supplementary) file.copy(elem,".",recursive = TRUE, overwrite = TRUE) | ||
sep <- tempfile() | ||
writeLines("\\pagebreak",sep) | ||
ref <- tempfile() | ||
files <- list.files(mdfolder,pattern="*.md",full.names = TRUE) | ||
moduleNames <- sub("\\.[^.]*$","",basename(files)) | ||
returnReferences(moduleNames,paste0("#id-",moduleNames),ref,level=1) | ||
files <- paste(paste(files,collapse=paste0(" ",sep," ")),ref) | ||
if(is.null(literature)) bib <- "" | ||
else bib <- ifelse(file.exists(literature),paste0(" --metadata link-citations --bibliography=",literature),"") | ||
system(paste0("pandoc ",files," -o ",file," --toc --template ", | ||
system.file("templates","template.latex",package="goxygen"), | ||
" -V colorlinks --listings",bib)) | ||
message("...finished PDF creation!") | ||
} |