Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions internal/puzzles/solutions/new.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (

func createNewFromTemplate(purl string) error {
const (
perms = 0o655
perms = os.ModePerm
yearLen = 4
dayLen = 2
)
Expand All @@ -38,10 +38,13 @@ func createNewFromTemplate(purl string) error {
}

params := templates.Params{
Year: year,
Day: pd.day,
DayStr: day,
URL: purl,
Year: year,
Day: pd.day,
DayStr: day,
URL: purl,
Title: "<!--- Pass here the title --->",
DescriptionPartOne: "<!--- Pass here the description for part one --->",
DescriptionPartTwo: "<!--- Pass here the description for part two --->",
}

path := filepath.Clean(filepath.Join(year, "day"+day))
Expand Down
11 changes: 7 additions & 4 deletions internal/puzzles/solutions/templates/embed.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ var (

// Params contains parameters for templates.
type Params struct {
Year string // e.g. "2023"
Day int // e.g. 2
DayStr string // e.g. "02"
URL string // e.g. "https://adventofcode.com/2023/day/2"
Year string // e.g. "2023"
Day int // e.g. 2
DayStr string // e.g. "02"
URL string // e.g. "https://adventofcode.com/2023/day/2"
Title string // For now it's empty.
DescriptionPartOne string // For now it's empty.
DescriptionPartTwo string // For now it's empty.
}

// SolutionTmpl returns template for solution.go file.
Expand Down
10 changes: 10 additions & 0 deletions internal/puzzles/solutions/templates/spec.md.tmpl
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
# Puzzle {{ .URL }}

# --- Day {{ .Day }}: {{ .Title }} ---

## --- Part One ---

{{ .DescriptionPartOne }}

## --- Part Two ---

{{ .DescriptionPartTwo }}

Loading