Package 'condensr'

Title: Academic Group Website Generator
Description: Helps automate 'Quarto' website creation for small academic groups. Builds a database-like structure of people, projects and publications, linking them together with a string-based ID system. Then, provides functions to automate production of clean markdown for these structures, and in-built CSS formatting using CSS flexbox.
Authors: Michael Lydeamore [aut, cre]
Maintainer: Michael Lydeamore <[email protected]>
License: MIT + file LICENSE
Version: 1.0.0.9000
Built: 2024-10-24 13:03:03 UTC
Source: https://github.com/mikelydeamore/condensr

Help Index


Create a quarto file for a specific staff member

Description

Creates a quarto file for a given input staff member.

Usage

create_staff_member_page(staff_member, site_dir, staff_folder = "staff")

Arguments

staff_member

An object of class staff_member that will be used to generate the template.

site_dir

Directory of the website.

staff_folder

Subfolder in which the staff qmd files are stored. Default "staff". Note that each template will be index.qmd to facilitate pretty link formatting in-browser.

Value

No return value, called to create a qmd file for the staff member.

Examples

example_staff_member <- staff_member(
    id = "example-id",
    name = "Example Name",
    description = "Example description for example staff member.",
    external_link = "http://www.example.com/",
    internal_link = FALSE
)
create_staff_member_page(example_staff_member, tempdir())

Create the templates for a condensr website

Description

Creates the necessary directories, high level files and structures for a condensr website.

Usage

create_website(dir, title)

Arguments

dir

Target directory for the website.

title

Title of the website.

Details

Under the hood, this function is creating a distill website (using distill:::do_create_website), and then overwriting some files with condensr specifics. These specific files are:

  • _site.yml - for site specific configurations

  • index.qmd - the home page of the website

  • staff_list.R - an example setup the condensr staff, project and publication lists

  • staff/index.qmd - the template page that will list staff members

  • staff/joe-bloggs/index.qmd - an example page for the hypothetical staff member

Value

No return value, called to create the skeleton structure of the website.

Examples

create_website(dir = tempdir(), "test_site")

Generate markdown for staff member

Description

Generates the image, short description and linking-out buttons for use in a list of staff belonging to a group.

Usage

generate_markdown_for_member(member, extension = "png")

Arguments

member

An object of class staff_member.

extension

Extension of the image file. Don't include the .

Value

No return value, function will output text directly into markdown document using cat.

Examples

example_staff_member <- staff_member(
    id = "example-id",
    name = "Example Name",
    description = "Example description for example staff member.",
    external_link = "http://www.example.com/",
    internal_link = FALSE
)
generate_markdown_for_member(example_staff_member)

Generate markdown for projects

Description

Generate markdown block for codensr projects.

Usage

generate_markdown_for_projects(project)

Arguments

project

A condensr project object. If a link is available (i.e. !is.na(project$link)), then a hyperlink will be inserted.

Value

No return value, function will output text directly into markdown document using cat.

Examples

example_project <- project(
       id = "joes-model",
       name = "Joe's Blogging Model",
       related_staff = "joe-bloggs"
   )
generate_markdown_for_projects(example_project)

Generate markdown for publications

Description

Generate markdown block for codensr publications.

Usage

generate_markdown_for_publications(publication)

Arguments

publication

A condensr publication object. If a link is available (i.e. !is.na(publication$link)), then a hyperlink will be inserted.

Value

No return value, function will output text directly into markdown document using cat.

Examples

example_publication <- publication(
    title = "Joe's Blogging Paper",
    related_staff = c("joe-bloggs"),
    link = NA,
    citation = "Bloggs, J., Bloggy, Y. (2019),
         The power of blogging, Australian Journal of Bloggs, 43: 149-155.",
    date = as.Date("2019-01-01")
)
generate_markdown_for_publications(example_publication)

Generate Academic Project

Description

Generates an academic project to be listed on staff profiles

Usage

project(id, name, related_staff, link = NA)

Arguments

id

A character string that uniquely identifies this project.

name

Human readable name for the project.

related_staff

Vector of ids for staff members. Projects will be listed on the staff pages for this vector

link

URL for the project. Default NA if there is no page to link to.

Value

An object of class project containing the input information.

Examples

example_project <- project(
       id = "joes-model",
       name = "Joe's Blogging Model",
       related_staff = "joe-bloggs"
   )

Generate publication

Description

Generates a publication object that is linked from staff websites

Usage

publication(title, related_staff, link, citation, date)

Arguments

title

Title of the publication.

related_staff

Vector of the ids of the related staff.

link

URL of the publication that will be linked.

citation

Text that will be displayed for this publication.

date

Date of publication. List of publications is sorted on the staff pages.

Value

An object of class publication with 5 elements:

  • title

  • related_staff

  • link

  • citation

  • date

Examples

example_publication <- publication(
    title = "Joe's Blogging Paper",
    related_staff = c("joe-bloggs"),
    link = NA,
    citation = "Bloggs, J., Bloggy, Y. (2019),
         The power of blogging, Australian Journal of Bloggs, 43: 149-155.",
    date = as.Date("2019-01-01")
)

Copy Rmd template to target path

Description

Copies a file from the rmarkdown/templates folder to a target path

Usage

render_template(
  file,
  template_folder,
  target_path,
  output_name = NA,
  data = list()
)

Arguments

file

File name to copy.

template_folder

Folder name of file.

target_path

Path to copy to.

output_name

Name of copies file. If NA, name will be the same as input file name.

data

List of additional metadata. Must have at least element name and title.


Sort a list by the list element date.

Description

Sorts a list for the column date.

Usage

sort_list_by_date(list_to_sort)

Arguments

list_to_sort

List to sort. Each element of the list must have column date.

Value

The sorted list.


Create staff member

Description

Creates a staff member for use in an academic group website. On the list of all staff members (by default in staff_list.Rmd), the name and description will be reported. In addition, an image, stored in images/staff with filename id.png will be shown.

Usage

staff_member(
  id,
  name,
  description,
  external_link,
  internal_link = FALSE,
  email = NA
)

Arguments

id

String defining the unique identifier for a staff member.

name

Display name of staff member.

description

Short description, used on staff pages.

external_link

Link to an external website.

internal_link

Should an internal link be used? TRUE/FALSE

email

email address for the staff member. Used to pre-fill the templates.

Details

The external link will be the link in the "MORE" button on the rendered website.

Value

An object of class staff_member with the following elements:

  • id

  • name

  • description

  • external_link

  • internal_link

  • email

Examples

example_staff_member <- staff_member(
     id = "example-id",
     name = "Example Name",
     description = "Example description for example staff member.",
     external_link = "http://www.example.com/",
     internal_link = FALSE
 )