update_fm: update_fm (Update Front Matter)

View source: R/update_fm.R

update_fmR Documentation

update_fm (Update Front Matter)

Description

Checks for new galacticPubs front-matter_TEMPLATE.yml. If found, it will add new fields, return the updated object, and write to drive (meta/front-matter.yml) if requested.

Usage

update_fm(
  WD = "?",
  WD_git = NULL,
  change_this = NULL,
  save_output = TRUE,
  return_fm = FALSE,
  reorder = TRUE,
  drive_reconnect = FALSE,
  try_harder = FALSE,
  recompile = TRUE
)

Arguments

WD

working directory; default=getwd(); if "?" supplied, will invoke pick_lesson(). The basename of this working directory will then be used to find a match in the gp-lessons git project folder by calling get_wd_git(). It's a little roundabout, but is consistent with lookups centering on the Google Drive project working directory.

WD_git

default=NULL. If you already know the path to the gp-lessons folder, this is more efficient.

change_this

A list of values to change in the front matter. Default=NULL. Example: list(RebuildAllMaterials=TRUE,Language="Italian) will trigger a full lesson rebuild when compile_lesson() is run and change the Language and locale.

save_output

do you want to save the updated front-matter to WD/meta/front-matter.yml? Default=TRUE

return_fm

logical; if TRUE, returns the the updated front-matter; if FALSE (default), returns TRUE/FALSE of success

reorder

do you want to reorder the resulting list, based on template order? default=TRUE

drive_reconnect

logical; do you want to re-look-up all ⁠Gdrive*⁠ keys? (might be useful if old files have been replaced instead of updated and ⁠Gdrive*⁠ keys point to a trashed file); default=F

try_harder

passed to catch_err() specifically when we look for GdriveDir, just in case the Google Drive for Desktop and Web are out of sync, it'll try after a series of intervals. Default= FALSE.

recompile

logical; if TRUE (default), runs compile_fm() and compile_JSON()

Details

If meta/front-matter.yml not found, it is created from the template. Will also combine language and country info to create locale, and add GPCatalogURL if those fields are blank. Attempts to find the lesson on Google Drive in GP-Studio and add GdriveDirID if missing.

Value

returns logical of success


galacticpolymath/GPpub documentation built on April 5, 2025, 6:04 p.m.