Skip to content

Commit

Permalink
feat: sort game content docs by id
Browse files Browse the repository at this point in the history
  • Loading branch information
BigJk committed Jan 18, 2024
1 parent f710fd2 commit 2f41c9c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 33 deletions.
21 changes: 18 additions & 3 deletions cmd/internal/docs/game_content.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ Content that is dynamically generated at runtime is not included in this documen
artifactTable.SetStyle(simpletable.StyleMarkdown)

artifacts := lo.Values(res.Artifacts)
sort.SliceStable(artifacts, func(i, j int) bool {
return artifacts[i].ID < artifacts[j].ID
})
sort.SliceStable(artifacts, func(i, j int) bool {
return artifacts[i].Price < artifacts[j].Price
})
Expand Down Expand Up @@ -151,6 +154,9 @@ Content that is dynamically generated at runtime is not included in this documen
cardType := make(map[string]int)

cards := lo.Values(res.Cards)
sort.SliceStable(cards, func(i, j int) bool {
return cards[i].ID < cards[j].ID
})
sort.SliceStable(cards, func(i, j int) bool {
return cards[i].Price < cards[j].Price
})
Expand Down Expand Up @@ -219,6 +225,9 @@ Content that is dynamically generated at runtime is not included in this documen
statusEffectTable.SetStyle(simpletable.StyleMarkdown)

statusEffects := lo.Values(res.StatusEffects)
sort.SliceStable(statusEffects, func(i, j int) bool {
return statusEffects[i].ID < statusEffects[j].ID
})
sort.SliceStable(statusEffects, func(i, j int) bool {
return statusEffects[i].Order < statusEffects[j].Order
})
Expand Down Expand Up @@ -262,6 +271,9 @@ Content that is dynamically generated at runtime is not included in this documen
enemyTable.SetStyle(simpletable.StyleMarkdown)

enemies := lo.Values(res.Enemies)
sort.SliceStable(enemies, func(i, j int) bool {
return enemies[i].ID < enemies[j].ID
})
sort.SliceStable(enemies, func(i, j int) bool {
return enemies[i].Name < enemies[j].Name
})
Expand Down Expand Up @@ -301,6 +313,9 @@ Content that is dynamically generated at runtime is not included in this documen
eventTable.SetStyle(simpletable.StyleMarkdown)

events := lo.Values(res.Events)
sort.SliceStable(events, func(i, j int) bool {
return events[i].ID < events[j].ID
})
sort.SliceStable(events, func(i, j int) bool {
return events[i].Name < events[j].Name
})
Expand All @@ -311,9 +326,9 @@ Content that is dynamically generated at runtime is not included in this documen
{Text: v.Name},
{Text: stripSpecial(stripansi.Strip(v.Description))},
{Text: strings.Join(v.Tags, ", ")},
{Text: makeCodes(lo.Map(v.Choices, func(c game.EventChoice, i int) string {
return stripansi.Strip(c.Description)
}))},
{Text: "<ul>" + strings.Join(lo.Map(v.Choices, func(c game.EventChoice, i int) string {
return "<li>" + makeCode(stripansi.Strip(c.Description)) + "</li>"
}), " ") + "</ul>"},
{Text: lo.Ternary(v.Test != nil, ":heavy_check_mark:", ":no_entry_sign:")},
}

Expand Down
Loading

0 comments on commit 2f41c9c

Please sign in to comment.