Package 'rebib'

Title: Convert and Aggregate Bibliographies
Description: Authors working with 'LaTeX' articles use the built-in bibliography options and 'BibTeX' files. While this might work with 'LaTeX', it does not function well with Web articles. As a way out, 'rebib' offers tools to convert and combine bibliographies from both sources.
Authors: Abhishek Ulayil [aut, cre, cph] , Heather Turner [ctb] , Christophe Dervieux [ctb] , Mitchell O'Hara-Wild [ctb] , Dianne Cook [ctb] , Yinxiang Huang [ctb]
Maintainer: Abhishek Ulayil <[email protected]>
License: MIT + file LICENSE
Version: 0.5.0
Built: 2024-11-21 05:36:10 UTC
Source: https://github.com/abhi-1u/rebib

Help Index


aggregate bibliography

Description

aggregate bibliograhy to fill in the missing references

Usage

aggregate_bibliography(article_dir, log_rebib = FALSE)

Arguments

article_dir

path to the directory which contains tex article

log_rebib

option to enable log files for rebib

Value

aggregated bib file

Examples

dir.create(your_article_folder <- file.path(tempdir(), "exampledir"))
example_files <-  system.file("aggr_example", package = "rebib")
x <- file.copy(from = example_files,to=your_article_folder,recursive = TRUE)
your_article_path <- paste(your_article_folder,"aggr_example",sep="/")
rebib::aggregate_bibliography(your_article_path)
readLines(paste(your_article_path,"example.bib",sep="/"))
unlink(your_article_folder,recursive = TRUE)

bibliography converter

Description

a quick converter for bbl/tex to bib

Usage

biblio_converter(file_path = "", log_rebib = FALSE)

Arguments

file_path

provide a file_path with file name to point tex/bbl file

log_rebib

option to enable log files for rebib

Value

bib file

Examples

test_file <- system.file("standalone/test.bbl", package = "rebib")
dir.create(your_article_folder <- file.path(tempdir(), "testdir"))
file.copy(test_file, your_article_folder)
your_article_path <- xfun::normalize_path(paste(your_article_folder,"test.bbl",sep="/"))
rebib::biblio_converter(file_path = your_article_path)
head(readLines(xfun::with_ext(your_article_path,"bib")))
unlink(your_article_folder,recursive = TRUE)

bibliography exists

Description

check if embedded bibliography exists in the latex file or not

Usage

bibliography_exists(article_dir)

Arguments

article_dir

path to the directory which contains tex article

Value

TRUE/FALSE

Examples

wd <-  system.file("article", package = "rebib")
# Only reads the article file
rebib::bibliography_exists(wd)

citation reader

Description

counts/reads Cite inline elements embedded within the latex file

Usage

citation_reader(file_path)

Arguments

file_path

path to the LaTeX file

Value

count of the inline element

Examples

file_path <- system.file("article/example.tex",
                 package = "rebib")
# Only Reads the example.tex for possible citations
cite <- rebib::citation_reader(file_path)
cite

get reference name

Description

get reference name

Usage

get_reference_name(bib_reference)

Arguments

bib_reference

first line containing the cite reference

Value

reference name (str)

Examples

ref_first_line <- "@book{ihaka:1996,"
ref_name <- rebib::get_reference_name(ref_first_line)
ref_name

get reference type

Description

get reference type

Usage

get_reference_type(bib_reference)

Arguments

bib_reference

first line containing the cite reference

Value

reference type (str)

Examples

ref_first_line <- "@book{ihaka:1996,"
ref_type <- rebib::get_reference_type(ref_first_line)
ref_type

function to solve bibliography problems

Description

if bibliography exists in bibtex format then (filename.bib) bibtex file will be preferred. else this function will generate a minimal bibliography

Usage

handle_bibliography(article_dir, override_mode = FALSE, log_rebib = FALSE)

Arguments

article_dir

path to the directory which contains tex article

override_mode

force use parser and ignore BibTeX bibliography.

log_rebib

option to enable log files for rebib

Value

bibliography links the bibtex file with latex source code or generates a minimal bibtex file from embedded bibliography and links that file to the latex file

Examples

dir.create(your_article_folder <- file.path(tempdir(), "exampledir"))
example_files <-  system.file("article", package = "rebib")
x <- file.copy(from = example_files,to=your_article_folder,recursive = TRUE)
your_article_path <- paste(your_article_folder,"article",sep="/")
rebib::handle_bibliography(your_article_path)
unlink(your_article_folder,recursive = TRUE)

rebib log setup

Description

a wrapper function for logger package to set up log file for logging

Usage

log_setup(article_dir, file_name, idx)

Arguments

article_dir

path to the directory which contains tex article

file_name

name of the log file

idx

index of log level

Value

null

Examples

dir.create(your_article_folder <- file.path(tempdir(), "exampledir"))
example_files <-  system.file("article", package = "rebib")
x <- file.copy(from = example_files,to=your_article_folder,recursive = TRUE)
your_article_path <- paste(your_article_folder,"article",sep="/")
rebib::log_setup(your_article_path, "log-file.log", 2)
unlink(your_article_folder,recursive = TRUE)

log messages for various categories

Description

a wrapper function for logging different types of log entries

Usage

rebib_log(message, category, idx)

Arguments

message

message to be sent

category

category of the log message

idx

index of log level

Value

null

Examples

dir.create(your_article_folder <- file.path(tempdir(), "exampledir"))
example_files <-  system.file("article", package = "rebib")
x <- file.copy(from = example_files,to=your_article_folder,recursive = TRUE)
your_article_path <- paste(your_article_folder,"article",sep="/")
rebib::log_setup(your_article_path, "log-file.log", 2)
rebib::rebib_log("Hello", "INFO", 2)
cat(readLines(paste(your_article_path,"/log-file.log",sep="")),sep="\n")
unlink(your_article_folder,recursive = TRUE)

split BibTex references

Description

split BibTex references

Usage

split_bibtex_references(bib_path)

Arguments

bib_path

path to the bibtex file to be read

Value

list of references separated as types and names based on indices

Examples

dir.create(your_article_folder <- file.path(tempdir(), "exampledir"))
example_files <-  system.file("article", package = "rebib")
x <- file.copy(from = example_files,to=your_article_folder,recursive = TRUE)
your_article_path <- paste(your_article_folder,"article",sep="/")
bib_path <- paste0(your_article_path,"/example.bib")
rebib::handle_bibliography(your_article_path)
references <- rebib::split_bibtex_references(bib_path)
references
unlink(your_article_folder,recursive = TRUE)