Title: | ~!gurí_: Unified Format Manager for Research Journals |
---|---|
Description: | ~gurí_ (Gestor Unificado de formatos para Revistas de Investigación / Unified Format Manager for Research Journals) facilitates the generation of final documents for scientific journals from documents obtained in the 'proofreading' stage. The proposal seeks to solve the difficulties of some academic journals in generating final documents in different formats in a consistent way and without generating duplicated processes. It also takes into account that many scientific journals use docx documents as the basis of their workflows. |
Authors: | Pablo Santiago Serrati [aut, cre, cph] |
Maintainer: | Pablo Santiago Serrati <[email protected]> |
License: | CC BY-NC-SA 4.0 + file LICENSE |
Version: | 0.1.0.9002 |
Built: | 2024-10-24 13:26:26 UTC |
Source: | https://github.com/estedeahora/guri |
Convert the 'xlsx' file with the credit information to csv format.
CREDIT_to_CSV(art_path, art_id, verbose)
CREDIT_to_CSV(art_path, art_id, verbose)
art_path |
A string with the path to the article folder. |
art_id |
A string with the article id. |
verbose |
Logical. Specifies whether to display verbose output (default
|
Invisible TRUE.
Make markdown appendix from docx documents
guri_appendix(art_path, art_id)
guri_appendix(art_path, art_id)
art_path |
A string with the path to the article folder, where the appendix files are located. |
art_id |
A string with the article id, used to identify the appendix files. The appendix files should be named as "art_app1.docx", "art_app2.docx", etc. |
A character vector containing the names of the converted Markdown files.
Generate the output files for individual article.
guri_article(art_path, art_dir, art_id, verbose = TRUE, clean_files = TRUE)
guri_article(art_path, art_dir, art_id, verbose = TRUE, clean_files = TRUE)
art_path |
A string with the path to the article folder. |
art_dir |
A string with the article folder name. |
art_id |
A string with the article id. |
verbose |
Logical. Specifies whether to display verbose output (default
|
clean_files |
Logical. Should the temporary files be deleted and
reordered in folders after the creation of the final files?. Primarily for
debugging purposes (default is |
Invisible TRUE.
Clean and reorganize article folder, moving temporary (auxiliary), log and output files.
guri_clean_files(art_path, art_id, verbose)
guri_clean_files(art_path, art_id, verbose)
art_path |
A string with the path to the article folder. |
art_id |
A string with the article id. |
verbose |
Logical. Specifies whether to display verbose output (default
|
Invisible TRUE.
Create the journal configuration files in _config
. If csl_name
is given,
it also places the corresponding csl in the configuration folder.
guri_config_journal(journal_folder = NULL, csl_name = NULL, force = FALSE)
guri_config_journal(journal_folder = NULL, csl_name = NULL, force = FALSE)
journal_folder |
A string with the path to the journal. If |
csl_name |
A string with the CSL's name (without its extension). See: https://github.com/citation-style-language/styles |
force |
Logical. Should it be overwritten if a configuration folder already exists (Default: FALSE)? |
Invisible TRUE
.
~!guri_
.This function converts a document using ~!guri_
. It takes the path to the
article, the article id, the desired output format, and an optional verbose
flag. It performs the conversion by calling the rmarkdown::pandoc_convert
function.
guri_convert(art_path, art_id, output, verbose = TRUE)
guri_convert(art_path, art_id, output, verbose = TRUE)
art_path |
A string with the path to the article folder. |
art_id |
A string with the article id. |
output |
A string. The desired output format (see ). |
verbose |
Logical. Specifies whether to display verbose output (default
|
Invisible TRUE
doi_batch
xml file for Crossref depositGenerate a doi_batch
xml file for Crossref deposit
guri_doi_batch(list_art, path_issue)
guri_doi_batch(list_art, path_issue)
list_art |
A data.frame with the article information as returned by
guri_list_articles. It must contain the following columns: |
path_issue |
A string with the path to the issue folder. |
The doi_batch
xml file is saved in the doi_register
folder,
inside the issue folder.
The doi_batch
xml file searches each of the article folders for the
art[id]_crossref.xml
file (inside the '_temp' folder), and uses the
information in these files to create a unified doi_batch
xml file (each
article is saved as a <journal_article>
element in the xml file).
In adition to the doi_batch
xml file, this function also creates a text
file with the information of the articles that will be deposited in Crossref.
The text file is saved in the same folder as the doi_batch
xml file.
A string with the path to the doi_batch
xml file.
~!guri_
.Upgrade or install (as necessary) pandoc, as well as the latex distribution (tinytex) and latex packages.
guri_install(pandoc = T, tinytex = T, force = F)
guri_install(pandoc = T, tinytex = T, force = F)
pandoc |
Logical. Should pandoc be installed/updated? (default 'TRUE') |
tinytex |
Logical. Should tinytex be installed/updated? (default 'TRUE') |
force |
Logical. Should pandoc and tinytex be forced to reinstall? (default 'FALSE') |
Invisible. A list with a logical vector indicating whether tinytex and pandoc are available and two items with the installed versions of Tinitex and Pandoc.
Lists the articles in a journal issue
guri_list_articles(path_issue)
guri_list_articles(path_issue)
path_issue |
String with the path to the issue folder to list the articles in the issue. |
A tibble with two columns: articles path (art_path) and articles id (art_id).
Create the basic file structure for a new journal or journal repository (to manage multiple journals).
guri_make_journal( journal = NULL, repository = FALSE, config_options = FALSE, example = FALSE, force = FALSE )
guri_make_journal( journal = NULL, repository = FALSE, config_options = FALSE, example = FALSE, force = FALSE )
journal |
A string with the short name of the journal. This 'short name' can contain only letters, numbers or a low dash (_) and must begin with a letter. Use only if you will work with the journal repository model (for single journal use NULL, default value). The journal name 'example' is not allowed. |
repository |
Logical. Will it work with the journal repository model
(Default: |
config_options |
Options to generate the configuration files in '_config'. If FALSE (default), configuration files are not generated in the '_config' folder. If "default" or TRUE, the template and metadata files used by default are copied to the '_config' folder (so that they can be later modified to customise the journal). If it is a named list with the parameters from guri_config_journal, they will be passed to this function (e.g. customized = list(csl_name = "chicago-author-date-16th-edition"). |
example |
Logical. Do you want to create the journal provided as an example? (Default = FALSE) |
force |
Logical. Should the journal be generated even if it already exists in the folder? This will ignore the '.guri' file if present. (Default: FALSE) |
Create the journal folder (if repository TRUE
). The journal
directory includes a configuration folder with the files used to configure
the journal output (_config
) and a folder with the basic files you will
use for the production process (default-files
). In addition, the
_journal.yaml
file will be generated, which you will have to edit
manually with the basic journal data.
The folder structure can contain one journal (repository = TRUE) or multiple journals (repository = TRUE). Journal repositories allow to manage multiple journals in a single working environment. The internal structure of the journals within a repository is identical to that of a single journal.
The configuration file features (in _config
) can be defined with this
function during journal creation or independently using (see
guri_config_journal).
If 'example = TRUE' a directory of the journal 'example' (.\example
) is
created with the necessary file structure to generate the final output
files.
Invisible returns the journal folder.
# Create a folder structure for a new journal. guri_make_journal(journal = "new_journal", repository = TRUE) fs::dir_tree("new_journal") unlink("new_journal", recursive = TRUE) unlink(".guri") # Create a folder structure for the 'example journal'. guri_make_journal(example = TRUE, repository = TRUE) fs::dir_tree("example", type = "directory") unlink("example/", recursive = TRUE) unlink(".guri")
# Create a folder structure for a new journal. guri_make_journal(journal = "new_journal", repository = TRUE) fs::dir_tree("new_journal") unlink("new_journal", recursive = TRUE) unlink(".guri") # Create a folder structure for the 'example journal'. guri_make_journal(example = TRUE, repository = TRUE) fs::dir_tree("example", type = "directory") unlink("example/", recursive = TRUE) unlink(".guri")
For selected articles in an issue, generates output files in
pdf, xml-jats and html format. In addition, it generates auxiliary and log
files (see below for details). If doi_batch = TRUE
is set, it also
generates a single xml file to do the DOI deposit in Crossref for the
selected articles.
guri_outputs( art_id, issue, journal = NULL, doi_batch = FALSE, verbose = TRUE, clean_files = TRUE )
guri_outputs( art_id, issue, journal = NULL, doi_batch = FALSE, verbose = TRUE, clean_files = TRUE )
art_id |
String or vector of strings with the article id to be processed in the issue. If "all" all articles are processed. |
issue |
String. The issue folder. |
journal |
String (optional, mandatory if repository is |
doi_batch |
Logical. If |
verbose |
Logical. Specifies whether to display verbose output (default
|
clean_files |
Logical. Should the temporary files be deleted and
reordered in folders after the creation of the final files?. Primarily for
debugging purposes (default is |
The function generates the output files for each (selected) article
in the issue folder. If art_id is "all", all articles in the issue folder
are processed. The journal
parameter is mandatory if it is a repository
of journals, otherwise it will be NULL
.
The function generates the following final files for each article:
art[id].xml
: a xml-jats file. See: https://jats.nlm.nih.gov/publishing/
art[id].html
: a html file with the article content.
art[id].pdf
: a pdf file with the article content.
Also, the following auxiliary files are created:
art[id].md
: a markdown file with the article content, used as an intermediate
common format for the conversion to other formats.
art[id].tex
: a tex (latex) file used to generate the pdf.
art[id]_crossref.xml
: a xml file with the single article metadata for Crossref
deposit. See:
https://data.crossref.org/reports/help/schema_doc/5.3.1/index.html
art[id]_biblio.json
: a json file with the article references.
Primarily useful for debugging purposes.
art[id]_AST.native
: the 'abstract syntax tree' used for Pandoc conversion.
In addition, if clean_files is TRUE
, the function will create following
folders in the article directory:
_output: with the final files generated (xml-jats, html and pdf).
_temp: with the temporary and auxiliary files generated during the process.
_log: with the log files generated during the process (only present if verbose is TRUE
).
If doi_batch = TRUE
, the function makes a single xml file (in
'journal/issue/doi_register') with the metadata of all selected articles to
do the DOI deposit in Crossref. An inform file is also created with the
information present in the xml file.
Invisible, a logical vector with the success of the process for each article.
They convert between the different formats required for the
~!guri_
workflow, applying the appropriate lua filters at each stage and
using the appropriate templates and metadata. The ~!guri_to_md
function
converts between the revised (and formatted) manuscript in docx
format to
markdown format. The guri_to_html
, guri_to_jats
and guri_to_pdf
functions convert from the markdown file to html
, xml
(xml-jats) and
pdf
(tex
) formats, respectively. Last, guri_to_AST
and guri_biblio
are auxiliary functions that generate a file with the Abstract Syntax Tree
(mostly for debugging purposes) and a file with the references used by the
article, respectively.
guri_to_md(art_path, art_id, verbose = TRUE) guri_to_html(art_path, art_id, verbose = TRUE) guri_to_jats(art_path, art_id, verbose = TRUE) guri_to_pdf(art_path, art_id, verbose = TRUE, pdf = TRUE) guri_to_crossref(art_path, art_id, verbose = TRUE) guri_to_AST(art_path, art_id, verbose = TRUE) guri_biblio(art_path, art_id, bib_type = "csljson")
guri_to_md(art_path, art_id, verbose = TRUE) guri_to_html(art_path, art_id, verbose = TRUE) guri_to_jats(art_path, art_id, verbose = TRUE) guri_to_pdf(art_path, art_id, verbose = TRUE, pdf = TRUE) guri_to_crossref(art_path, art_id, verbose = TRUE) guri_to_AST(art_path, art_id, verbose = TRUE) guri_biblio(art_path, art_id, bib_type = "csljson")
art_path |
A string with the path to the article folder. |
art_id |
A string with the article id. |
verbose |
Logical. Specifies whether to display verbose output (default
|
pdf |
Logical. Should the pdf be generated? (default = TRUE) |
bib_type |
description |
These functions are, mostly, a wrapper of the internal function guri_convert. The functions are exported primarily for debugging and error detection purposes. For day-to-day work it is advisable to use the guri function directly, which coordinates the generation of all these formats and ensures the correct definition of the parameters.
For the generation of pdf files, LuaTex (tinytex::lualatex) is used internally.
Invisible TRUE