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 |
aggregate bibliograhy to fill in the missing references
aggregate_bibliography(article_dir, log_rebib = FALSE)
aggregate_bibliography(article_dir, log_rebib = FALSE)
article_dir |
path to the directory which contains tex article |
log_rebib |
option to enable log files for rebib |
aggregated bib file
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)
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)
a quick converter for bbl/tex to bib
biblio_converter(file_path = "", log_rebib = FALSE)
biblio_converter(file_path = "", log_rebib = FALSE)
file_path |
provide a file_path with file name to point tex/bbl file |
log_rebib |
option to enable log files for rebib |
bib file
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)
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)
check if embedded bibliography exists in the latex file or not
bibliography_exists(article_dir)
bibliography_exists(article_dir)
article_dir |
path to the directory which contains tex article |
TRUE/FALSE
wd <- system.file("article", package = "rebib") # Only reads the article file rebib::bibliography_exists(wd)
wd <- system.file("article", package = "rebib") # Only reads the article file rebib::bibliography_exists(wd)
counts/reads Cite inline elements embedded within the latex file
citation_reader(file_path)
citation_reader(file_path)
file_path |
path to the LaTeX file |
count of the inline element
file_path <- system.file("article/example.tex", package = "rebib") # Only Reads the example.tex for possible citations cite <- rebib::citation_reader(file_path) cite
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
get_reference_name(bib_reference)
get_reference_name(bib_reference)
bib_reference |
first line containing the cite reference |
reference name (str)
ref_first_line <- "@book{ihaka:1996," ref_name <- rebib::get_reference_name(ref_first_line) ref_name
ref_first_line <- "@book{ihaka:1996," ref_name <- rebib::get_reference_name(ref_first_line) ref_name
get reference type
get_reference_type(bib_reference)
get_reference_type(bib_reference)
bib_reference |
first line containing the cite reference |
reference type (str)
ref_first_line <- "@book{ihaka:1996," ref_type <- rebib::get_reference_type(ref_first_line) ref_type
ref_first_line <- "@book{ihaka:1996," ref_type <- rebib::get_reference_type(ref_first_line) ref_type
if bibliography exists in bibtex format then (filename.bib) bibtex file will be preferred. else this function will generate a minimal bibliography
handle_bibliography(article_dir, override_mode = FALSE, log_rebib = FALSE)
handle_bibliography(article_dir, override_mode = FALSE, log_rebib = FALSE)
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 |
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
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)
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)
a wrapper function for logger package to set up log file for logging
log_setup(article_dir, file_name, idx)
log_setup(article_dir, file_name, idx)
article_dir |
path to the directory which contains tex article |
file_name |
name of the log file |
idx |
index of log level |
null
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)
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)
a wrapper function for logging different types of log entries
rebib_log(message, category, idx)
rebib_log(message, category, idx)
message |
message to be sent |
category |
category of the log message |
idx |
index of log level |
null
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)
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
split_bibtex_references(bib_path)
split_bibtex_references(bib_path)
bib_path |
path to the bibtex file to be read |
list of references separated as types and names based on indices
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)
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)