Create the necessary directories for a new post, copy in template files and make them relevant to the day and year (see Details).
Arguments
- day
An integer between 1 and 25
- year
An integer representing the year, from 2015 to the current year. Defaults to the current year.
Details
aoc_new_post()
and
aoc_new_day()
both assume they being called from a project with a directory
_templates
, with a subdirectory post-template
that contains, at minimum,
the file index.qmd
. They will copy all the files in post-template
into a
directory "./YYYY/day/DD"
where YYYY
is the value of the year parameter and
DD
is value of the day parameter (creating these directories if they do not
already exist). This path echoes the URL structure of the Advent of Code
website. Additionally, they replace any instances of YYYY
and DD
in the
index.qmd
and (if present) script.R
files with the values of the year and day
parameters, respectively. In addition, aoc_new_day()
will also run
aoc_get_input()
to download the puzzle input and save it into the post
directory.
If you have your Advent of Code session token set in your
.Renviron
file, we recommend using aoc_new_day()
over aoc_new_post()
.
If you wish to download and save your puzzle input separately, use
aoc_new_post()
.