Skip to content

Commit

Permalink
update PR, see comment in #172
Browse files Browse the repository at this point in the history
  • Loading branch information
nuest committed Jul 30, 2018
1 parent 1278161 commit edaaa5d
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 38 deletions.
5 changes: 3 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ Authors@R: c(
person("Marc-Andre", "Desautels", role = c("aut", "cph"), email = "marc-andre.desautels@cstjean.qc.ca"),
person("Dominik", "Leutnant", role = c("aut", "cph"), email = "leutnant@fh-muenster.de"),
person(family = "MDPI", role = c("aut", "cph")),
person("Oğuzhan", "Öğreden", role = c("aut"), comment = c(ORCID = "0000-0002-9949-3348"),
person("Daniel", "Nüst", role = c("aut", "cph"), email = "daniel.nuest@uni-muenster.de"))
person("Oğuzhan", "Öğreden", role = c("aut"), comment = c(ORCID = "0000-0002-9949-3348")),
person("Daniel", "Nüst", role = c("aut", "cph"), email = "daniel.nuest@uni-muenster.de", comment = c(ORCID = "0000-0002-0024-5046"))
)
Description: A suite of custom R Markdown formats and templates for
authoring journal articles and conference submissions.
License: GPL-3
Expand Down
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ rticles 0.6 (unreleased)

- Added the template for the SAGE Journals (thanks, @oguzhanogreden, #181).

- Added the template for Copernicus Publications journals (thanks, @nuest, #172).

rticles 0.5
---------------------------------------------------------------------

Expand Down
23 changes: 9 additions & 14 deletions R/copernicus_article.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#' @param base_format The function to use for the base format of the article.
#' By default, this is \code{rmarkdown::pdf_document}, but to use bookdown's
#' cross-referencing feature, this can be set to \code{bookdown::pdf_document2}
#' @param journal_name A regular expression to filter the by the journal name, see \code{pattern} in \code{\link[base]{grep}}; defaults to \code{*}.
#'
#' @return R Markdown output format to pass to
#' \code{\link[rmarkdown:render]{render}}
Expand All @@ -18,6 +19,8 @@
#'
#' \strong{Version:} Based on copernicus_package.zip in the version 5.0, 21 March 2018, using \code{copernicus.cls} in version 8.67, 30 January 2018
#'
#' \strong{Copernicus journal abbreviations:} You can use the function \code{copernicus_journal_abbreviations()} to get the journal abbreviation for all journals supported by the copernicus article template.
#'
#' \strong{Important note:} The online guidelines by Copernicus are the official resource.
#' Copernicus is not responsible for the community contributions made to support the template in this package.
#' Copenicus converts all typeset TeX files into XML, the expressions and markups have to be highly standardized.
Expand All @@ -41,7 +44,8 @@
#' \url{https://publications.copernicus.org/for_authors/manuscript_preparation.html}
#'
#' @examples
#'
#' names(copernicus_journal_abbreviations())
#' copernicus_journal_abbreviations(journal_name = "Science Data")
#' \dontrun{
#' library("rmarkdown")
#' draft("MyArticle.Rmd", template = "copernicus_article", package = "rticles")
Expand All @@ -57,7 +61,7 @@ copernicus_article <- function(...,
"-autolink_bare_uris", # disables automatic links, needed for plain email in \correspondence
"-auto_identifiers" # disables \hypertarget commands
)) {
if (inherits(base_format, "character")) {
if (is.character(base_format)) {
FMT <- eval(parse(text = base_format))
} else {
FMT <- match.fun(base_format)
Expand Down Expand Up @@ -112,18 +116,9 @@ copernicus_journals <- list(
"Wind Energy Science" = "wes"
)

#' Copernicus journal abbreviations
#'
#' Get the journal abbreviation for all journals supported by the copernicus article template.
#'
#' @param name A regular expression to filter the by the journal name, see \code{pattern} in \code{\link[base]{grep}}; defaults to \code{*}.
#'
#' @examples
#' names(copernicus_journal_abbreviations())
#' copernicus_journal_abbreviations(name = "Science Data")
#'
#' @rdname copernicus_article
#' @export
copernicus_journal_abbreviations <- function(name = "*") {
journal <- copernicus_journals[grepl(pattern = name, x = names(copernicus_journals), ignore.case = TRUE)]
copernicus_journal_abbreviations <- function(journal_name = "*") {
journal <- copernicus_journals[grepl(pattern = journal_name, x = names(copernicus_journals), ignore.case = TRUE)]
return(unlist(journal))
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Template for preparing your manuscript submission to Copernicus journals using RMarkdown
journal: "`r rticles::copernicus_journal_abbreviations(name = 'communication')`"
journal: "`r rticles::copernicus_journal_abbreviations(journal_name = 'communication')`"
author:
- given_name: Daniel
surname: Nüst
Expand Down
12 changes: 10 additions & 2 deletions man/copernicus_article.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 0 additions & 19 deletions man/copernicus_journal_abbreviations.Rd

This file was deleted.

1 change: 1 addition & 0 deletions tests/testit/test-formats.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ test_format("peerj_article")
test_format("amq_article")
test_format("mdpi_article")
test_format("mnras_article")
test_format("copernicus_article")

0 comments on commit edaaa5d

Please sign in to comment.