MendeleyExportToolR6: R6 Class For A Mendeley Exporter Tool

MendeleyExportToolR6R Documentation

R6 Class For A Mendeley Exporter Tool

Description

Rmarkdown documents use BibTeX files to include literature references. BibTeX files are ordinary text files conaining the literature reference records in a pre-defined format. BibTeX files can either be created manually, but for larger documents the manual creation and maintenance of BibTeX files becomes untractable. This can be remedied by using a reference manager such as Mendeley. Literature references can be exported automatically from Mendeley into BibTeX files. The exported BibTeX records go either to a given directory or to a specified file. The main purpose of this tool is to read the exported BibTeX file from Mendeley and collect them into a local BibTeX file.

Usage

MendeleyExportToolR6$new()

Value

Object of R6Class to bridge the exported BibTeX references exported by Mendeley to be used in a RMarkdown document

Public Methods

new(ps_men_export_dir, ps_local_bib_dir)

Instantiation-Constructor method

add(ps_new_ref, pb_is_rstudio_available)

Add a new reference with the key ps_new_ref

set_mendeley_export_dir(ps_men_export_dir)

Setter for s_men_export_dir

get_mendeley_export_dir()

Getter for s_men_export_dir

set_local_bib_file(ps_local_bib_file)

Setter for s_local_bib_file

get_local_bib_file()

Getter for s_local_bib_file

set_this_rmd_file(ps_this_rmd_file)

Setter for s_this_rmd_file

get_this_rmd_file()

Getter for s_this_rmd_file

Private Methods

get_bib_from_mendeley_export(ps_new_ref)

Get BibTeX record based on citation key ps_new_ref

write_local_bib(pvec_bib_new_ref)

Adding pvec_bib_new_ref BibTeX record to the local bibliography file

convert_add_to_ref(ps_new_ref)

Convert the add() statement to the Rmarkdown reference

get_rmd_ref(ps_new_ref)

Get Rmarkdown reference from citation key ps_new_ref

Public fields

s_men_export_dir

directory where mendeley exports its BibTeX records

s_local_bib_file

name of local BibTeX file

s_this_rmd_file

full path to current Rmarkdown source document

Active bindings

s_men_export_dir

directory where mendeley exports its BibTeX records

s_local_bib_file

name of local BibTeX file

s_this_rmd_file

full path to current Rmarkdown source document

Methods

Public methods


Method new()

Usage
MendeleyExportToolR6$new(
  ps_men_export_dir = getOption("rmdhelp.mendeley.export.dir"),
  ps_local_bib_file = "bibliography.bib",
  ps_this_rmd_file = ifelse(rstudioapi::isAvailable(),
    rstudioapi::getActiveDocumentContext()$path, whereami::thisfile())
)

Method set_mendeley_export_dir()

Usage
MendeleyExportToolR6$set_mendeley_export_dir(ps_men_export_dir)

Method get_mendeley_export_dir()

Usage
MendeleyExportToolR6$get_mendeley_export_dir()

Method set_local_bib_file()

Usage
MendeleyExportToolR6$set_local_bib_file(ps_local_bib_file)

Method get_local_bib_file()

Usage
MendeleyExportToolR6$get_local_bib_file()

Method set_this_rmd_file()

Usage
MendeleyExportToolR6$set_this_rmd_file(ps_this_rmd_file)

Method get_this_rmd_file()

Usage
MendeleyExportToolR6$get_this_rmd_file()

Method add()

Usage
MendeleyExportToolR6$add(
  ps_new_ref,
  pb_is_rstudio_available = rstudioapi::isAvailable()
)

Method clone()

The objects of this class are cloneable with this method.

Usage
MendeleyExportToolR6$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples

## Not run: 
# instantiate a new MendeleyExportTool object
met <- rmdhelp::MendeleyExportToolR6$new()
# setting the current rmd-file
met$set_this_rmd_file(ps_this_rmd_file = ifelse(rstudioapi::isAvailable(),
                              rstudioapi::getActiveDocumentContext()$path,
                              whereami::thisfile()))
# check whether mendeley export dir exists
met$exists_mendeley_export_dir()
# add a new reference to the local BibTeX file
met$add("Phocas1998")

## End(Not run)


charlotte-ngs/rmdhelp documentation built on Oct. 31, 2023, 10:21 a.m.