Documentation
¶
Index ¶
- Constants
- Variables
- func BuildFamilyNarrative(f *model.Family, inlineMedia bool) *narrative.FamilyNarrative[md.Text]
- func CleanTags(ss []string) []string
- func CopyFile(dst, src string) error
- func CreateFile(fname string) (*os.File, error)
- func IncludeInTimeline(ev model.TimelineEvent) bool
- func RenderAltPersonPage(s *Site, p *model.Person) (render.Document[md.Text], error)
- func RenderCitationPage(s *Site, c *model.GeneralCitation) (render.Document[md.Text], error)
- func RenderFacts[T render.EncodedText](p *model.Person, pov *model.POV, enc render.ContentBuilder[T]) error
- func RenderFamilyLineEventsPage(s *Site, fl *model.FamilyLine) (render.Document[md.Text], error)
- func RenderFamilyLinePage(s *Site, fl *model.FamilyLine) (render.Document[md.Text], error)
- func RenderFamilyPage(s *Site, f *model.Family) (render.Document[md.Text], error)
- func RenderMiscFacts[T render.EncodedText](p *model.Person, pov *model.POV, enc render.ContentBuilder[T]) error
- func RenderPersonFamilies[T render.EncodedText](p *model.Person, pov *model.POV, enc render.ContentBuilder[T]) error
- func RenderPersonPage(s *Site, p *model.Person) (render.Document[md.Text], error)
- func RenderPlacePage(s *Site, p *model.Place, placeMap *PlaceMap) (render.Document[md.Text], error)
- func RenderSourcePage(s *Site, so *model.Source) (render.Document[md.Text], error)
- func RenderTimeline[T render.EncodedText](t *model.Timeline, pov *model.POV, enc render.ContentBuilder[T], ...) error
- func RenderVitalFacts[T render.EncodedText](p *model.Person, pov *model.POV, enc render.ContentBuilder[T]) error
- func ScanGeneralCitationForAnomalies(cit *model.GeneralCitation) []*model.Anomaly
- func ScanTimelineEventForAnomalies(ev model.TimelineEvent) []*model.Anomaly
- func Tagify(s string) string
- type Calendar
- type Change
- type NoteDoc
- type PageLayout
- type Paginator
- type PaginatorEntry
- type PersonWithGreatestNumberHeap
- type PersonWithLeastNumberHeap
- type PersonWithNumber
- type PlaceMap
- type PublishSet
- func (ps *PublishSet) AncestorSurnameDistribution() map[string]int
- func (ps *PublishSet) AncestorSurnameGroupList() []string
- func (ps *PublishSet) Ancestors(p *model.Person, generations int) []*model.Person
- func (ps *PublishSet) EarliestBorn(limit int) []*model.Person
- func (ps *PublishSet) GreatestChildren(limit int) []*model.Person
- func (ps *PublishSet) Includes(v any) bool
- func (t *PublishSet) NumberOfPeople() int
- func (ps *PublishSet) OldestPeople(limit int) []*model.Person
- func (ps *PublishSet) TreeSurnameDistribution() map[string]int
- type Site
- func (s *Site) AddChangelog(o any)
- func (s *Site) AssignTags(p *model.Person) error
- func (s *Site) BuildCalendar() error
- func (s *Site) BuildGedcom() (*gedcom.Gedcom, error)
- func (s *Site) BuildPublishSet(m model.PersonMatcher) error
- func (s *Site) DetectPuzzles(p *model.Person) error
- func (s *Site) Generate() error
- func (s *Site) LinkFor(v any) string
- func (s *Site) LinkForFormat(v any, format string) string
- func (s *Site) LinkForSurnameListPage(surname string) string
- func (s *Site) NewDocument() *md.Document
- func (s *Site) NewMarkdownBuilder() render.ContentBuilder[md.Text]
- func (s *Site) RedirectPath(id string) string
- func (s *Site) ScanPersonForAnomalies(p *model.Person)
- func (s *Site) ScanPersonTodos(p *model.Person) []*model.ToDo
- func (s *Site) WriteAnomalyListPages(root string) error
- func (s *Site) WriteChangelog(root string) error
- func (s *Site) WriteChartAncestors(root string) error
- func (s *Site) WriteChartTrees(root string) error
- func (s *Site) WriteDescendantTree(fname string, p *model.Person, depth int) error
- func (s *Site) WriteFamilyLinesListPages(root string) error
- func (s *Site) WriteFamilyListPages(root string) error
- func (s *Site) WriteGedcom(root string) error
- func (s *Site) WriteInferenceListPages(root string) error
- func (s *Site) WritePages(contentDir string) error
- func (s *Site) WritePersonListPages(root string) error
- func (s *Site) WritePlaceListPages(root string) error
- func (s *Site) WritePlaceMapImage(p *model.Place, contentDir string) (*PlaceMap, error)
- func (s *Site) WriteSourceListPages(root string) error
- func (s *Site) WriteSurnameListPages(root string) error
- func (s *Site) WriteTodoListPages(root string) error
- func (s *Site) WriteTreeOverview(root string) error
- type TimelineEntryFormatter
- type Tuple
Constants ¶
const ( PageLayoutPerson = layout.PageLayoutPerson PageLayoutPlace = layout.PageLayoutPlace PageLayoutSource = layout.PageLayoutSource PageLayoutFamily = layout.PageLayoutFamily PageLayoutCitation = layout.PageLayoutCitation PageLayoutListInferences = layout.PageLayoutListInferences PageLayoutListAnomalies = layout.PageLayoutListAnomalies PageLayoutListTodo = layout.PageLayoutListTodo PageLayoutListPeople = layout.PageLayoutListPeople PageLayoutListPlaces = layout.PageLayoutListPlaces PageLayoutListSources = layout.PageLayoutListSources PageLayoutListSurnames = layout.PageLayoutListSurnames PageLayoutListChanges = layout.PageLayoutListChanges PageLayoutListFamilies = layout.PageLayoutListFamilies PageLayoutListFamilyLines = layout.PageLayoutListFamilyLines PageLayoutListTrees = layout.PageLayoutListTrees PageLayoutCalendar = layout.PageLayoutCalendar PageLayoutTreeOverview = layout.PageLayoutTreeOverview PageLayoutChartAncestors = layout.PageLayoutChartAncestors PageLayoutChartTrees = layout.PageLayoutChartTrees )
Re-export all layout constants so callers that import site do not also need to import layout.
const ( PageSectionPerson = "person" PageSectionPlace = "place" PageSectionCitation = "citation" PageSectionSource = "source" PageSectionList = "list" PageSectionChart = "chart" PageSectionMedia = "media" PageSectionFamily = "family" PageSectionFamilyLine = "familyline" )
const ( PageCategoryPerson = "person" PageCategoryCitation = "citation" PageCategorySource = "source" PageCategoryPlace = "place" PageCategoryFamily = "family" )
Variables ¶
var Command = &cli.Command{ Name: "gen", Usage: "Generate a website from a gedcom file", Action: gen, Flags: append([]cli.Flag{ &cli.StringFlag{ Name: "gedcom", Aliases: []string{"g"}, Usage: "GEDCOM file to read from", Destination: &genopts.gedcomFile, }, &cli.StringFlag{ Name: "gramps", Usage: "Gramps xml file to read from", Destination: &genopts.grampsFile, }, &cli.StringFlag{ Name: "gramps-dbname", Usage: "Name of the gramps database, used to keep IDs consistent between versions of the same database", Destination: &genopts.grampsDatabaseName, }, &cli.StringFlag{ Name: "config", Aliases: []string{"c"}, Usage: "Path to a KDL tree configuration file", Required: true, Destination: &genopts.treeConfig, }, &cli.StringFlag{ Name: "output", Aliases: []string{"o"}, Usage: "Directory in which to write generated site", Destination: &genopts.rootDir, }, &cli.StringFlag{ Name: "basepath", Aliases: []string{"b"}, Usage: "Base URL path to use as a prefix to all links.", Value: "/", Destination: &genopts.basePath, }, &cli.StringFlag{ Name: "identity-map", Aliases: []string{"m"}, Usage: "Filename of identity mapping file", }, &cli.StringFlag{ Name: "key", Aliases: []string{"k"}, Usage: "Identifier of the key individual", Destination: &genopts.keyIndividual, }, &cli.BoolFlag{ Name: "include-private", Usage: "Include living people and people who died less than 20 years ago.", Value: false, Destination: &genopts.includePrivate, }, &cli.BoolFlag{ Name: "debug", Usage: "Include debug info as inline comments.", Value: false, Destination: &genopts.debug, }, &cli.StringFlag{ Name: "inspect", Usage: "Type and ID of an object to inspect. The internal data structure of the object will be printed to stdout. Use format '{object}/{id}' where object can be 'person', 'place' or 'source'.", Destination: &genopts.inspect, }, &cli.StringFlag{ Name: "relation", Usage: "Only generate pages for people who are related to the key person. One of 'direct' (must be a direct ancestor), 'common' (must have a common ancestor) or 'any' (any relation). Ignored if no key person is specified.", Value: "any", Destination: &genopts.relation, }, &cli.BoolFlag{ Name: "experiment-families", Usage: "Enable experimental family pages.", Value: true, Destination: &genopts.experimentFamilies, }, &cli.BoolFlag{ Name: "experiment-altpersonpage", Usage: "Enable experimental alternative people pages.", Value: true, Destination: &genopts.experimentAltPersonPage, }, &cli.StringFlag{ Name: "content", Usage: "Path to the content directory whose diary, stories, and questions sub-folders are walked for person references.", Destination: &genopts.contentDir, }, &cli.BoolFlag{ Name: "include-drafts", Usage: "Include draft content pages when walking for person references.", Value: false, Destination: &genopts.includeDrafts, }, }, logging.Flags...), }
Functions ¶
func BuildFamilyNarrative ¶ added in v0.0.3
func IncludeInTimeline ¶
func IncludeInTimeline(ev model.TimelineEvent) bool
func RenderAltPersonPage ¶ added in v0.0.6
func RenderCitationPage ¶
func RenderFacts ¶
func RenderFacts[T render.EncodedText](p *model.Person, pov *model.POV, enc render.ContentBuilder[T]) error
func RenderFamilyLineEventsPage ¶ added in v0.0.3
func RenderFamilyLinePage ¶ added in v0.0.3
func RenderFamilyPage ¶ added in v0.0.3
func RenderMiscFacts ¶ added in v0.0.6
func RenderMiscFacts[T render.EncodedText](p *model.Person, pov *model.POV, enc render.ContentBuilder[T]) error
func RenderPersonFamilies ¶ added in v0.0.6
func RenderPersonFamilies[T render.EncodedText](p *model.Person, pov *model.POV, enc render.ContentBuilder[T]) error
RenderPersonFamilies renders the person's families, in chronological order, as a grouped list with each union's children listed beneath it.
func RenderPersonPage ¶
func RenderPlacePage ¶
func RenderSourcePage ¶
func RenderTimeline ¶
func RenderTimeline[T render.EncodedText](t *model.Timeline, pov *model.POV, enc render.ContentBuilder[T], fmtr TimelineEntryFormatter[T]) error
func RenderVitalFacts ¶ added in v0.0.6
func RenderVitalFacts[T render.EncodedText](p *model.Person, pov *model.POV, enc render.ContentBuilder[T]) error
func ScanGeneralCitationForAnomalies ¶
func ScanGeneralCitationForAnomalies(cit *model.GeneralCitation) []*model.Anomaly
func ScanTimelineEventForAnomalies ¶
func ScanTimelineEventForAnomalies(ev model.TimelineEvent) []*model.Anomaly
Types ¶
type Calendar ¶
type Calendar struct {
Events []model.TimelineEvent
}
type NoteDoc ¶
type PageLayout ¶
type PageLayout = layout.PageLayout
PageLayout is an alias for layout.PageLayout so existing callers in this package continue to work without modification.
type Paginator ¶
type Paginator struct {
MaxPageSize int
Entries []PaginatorEntry
}
func NewPaginator ¶
func NewPaginator() *Paginator
func (*Paginator) AddEntryWithGroup ¶
func (*Paginator) WritePages ¶
type PaginatorEntry ¶
type PersonWithGreatestNumberHeap ¶
type PersonWithGreatestNumberHeap []*PersonWithNumber
func (PersonWithGreatestNumberHeap) Len ¶
func (h PersonWithGreatestNumberHeap) Len() int
func (PersonWithGreatestNumberHeap) Less ¶
func (h PersonWithGreatestNumberHeap) Less(i, j int) bool
func (*PersonWithGreatestNumberHeap) Pop ¶
func (h *PersonWithGreatestNumberHeap) Pop() any
func (*PersonWithGreatestNumberHeap) Push ¶
func (h *PersonWithGreatestNumberHeap) Push(x any)
func (PersonWithGreatestNumberHeap) Swap ¶
func (h PersonWithGreatestNumberHeap) Swap(i, j int)
type PersonWithLeastNumberHeap ¶
type PersonWithLeastNumberHeap []*PersonWithNumber
func (PersonWithLeastNumberHeap) Len ¶
func (h PersonWithLeastNumberHeap) Len() int
func (PersonWithLeastNumberHeap) Less ¶
func (h PersonWithLeastNumberHeap) Less(i, j int) bool
func (*PersonWithLeastNumberHeap) Pop ¶
func (h *PersonWithLeastNumberHeap) Pop() any
func (*PersonWithLeastNumberHeap) Push ¶
func (h *PersonWithLeastNumberHeap) Push(x any)
func (PersonWithLeastNumberHeap) Swap ¶
func (h PersonWithLeastNumberHeap) Swap(i, j int)
type PersonWithNumber ¶
type PlaceMap ¶ added in v0.0.3
type PlaceMap struct {
ImageLink string // URL of the stitched map image file
ExploreURL string // link to an interactive map viewer for this location
ExploreText string // anchor text for ExploreURL
MapName string // human-readable name of the map layer used
}
PlaceMap holds the results of a downloaded place map image.
type PublishSet ¶
type PublishSet struct {
KeyPerson *model.Person
People map[string]*model.Person
Citations map[string]*model.GeneralCitation
Sources map[string]*model.Source
Repositories map[string]*model.Repository
Places map[string]*model.Place
Families map[string]*model.Family
FamilyLines map[string]*model.FamilyLine
MediaObjects map[string]*model.MediaObject
Events map[model.TimelineEvent]bool
LastUpdated time.Time
}
func NewPublishSet ¶
func NewPublishSet(t *tree.Tree, include model.PersonMatcher) (*PublishSet, error)
func (*PublishSet) AncestorSurnameDistribution ¶
func (ps *PublishSet) AncestorSurnameDistribution() map[string]int
AncestorSurnameDistribution returns a map of surnames and the number of direct ancestors with that surname It excludes redacted people.
func (*PublishSet) AncestorSurnameGroupList ¶
func (ps *PublishSet) AncestorSurnameGroupList() []string
AncestorSurnameList returns a list of surname groups in generation order, starting with the father of the key person, then the mother, then the father's father etc..
func (*PublishSet) Ancestors ¶
Ancestors returns the ancestors of p. The returned list is ordered such that the father of entry n is found at (n+2)*2-2, the mother of entry n is found at (n+2)*2-1 The list will always contain 2^n entries, with unknown ancestors left as nil at the appropriate index. Odd numbers are female, even numbers are male. The child of entry n is found at (n-2)/2 if n is even and (n-3)/2 if n is odd. 0: father 1: mother 2: father's father 3: father's mother 4: mother's father 5: mother's mother 6: father's father's father 7: father's father's mother 8: father's mother's father 9: father's mother's mother 10: mother's father's father 11: mother's father's mother 12: mother's mother's father 13: mother's mother's mother 14: father's father's father's father 15: father's father's father's mother 16: father's father's mother's father 17: father's father's mother's mother 18: father's mother's father's father 19: father's mother's father's mother 20: father's mother's mother's father 21: father's mother's mother's mother 22: mother's father's father's father 23: mother's father's father's mother 24: mother's father's mother's father 25: mother's father's mother's mother 26: mother's mother's father's father 27: mother's mother's father's mother 28: mother's mother's mother's father 29: mother's mother's mother's mother
func (*PublishSet) EarliestBorn ¶
func (ps *PublishSet) EarliestBorn(limit int) []*model.Person
EarliestBorn returns a list of the earliest born people in the tree, sorted by descending date It excludes redacted people.
func (*PublishSet) GreatestChildren ¶
func (ps *PublishSet) GreatestChildren(limit int) []*model.Person
GreatestChildren returns a list of the people with the greatest number of children in the tree It excludes redacted people.
func (*PublishSet) Includes ¶
func (ps *PublishSet) Includes(v any) bool
func (*PublishSet) NumberOfPeople ¶
func (t *PublishSet) NumberOfPeople() int
NumberOfPeople returns the number of people in the tree. It excludes redacted people.
func (*PublishSet) OldestPeople ¶
func (ps *PublishSet) OldestPeople(limit int) []*model.Person
OldestPeople returns a list of the oldest people in the tree, sorted by descending age It excludes redacted people.
func (*PublishSet) TreeSurnameDistribution ¶
func (ps *PublishSet) TreeSurnameDistribution() map[string]int
TreeSurnameDistribution returns a map of surnames and the number of people in the tree with that surname It excludes redacted people.
type Site ¶
type Site struct {
BaseURL string
Tree *tree.Tree
Calendars map[int]*Calendar
PersonDir string
PersonLinkPattern string
PersonFilePattern string
SourceDir string
SourceLinkPattern string
SourceFilePattern string
CitationDir string
CitationLinkPattern string
CitationFilePattern string
CalendarLinkPattern string
FamilyDir string
FamilyLinkPattern string
FamilyFilePattern string
FamilyLineDir string
FamilyLineLinkPattern string
FamilyLineFilePattern string
FamilyLineEventsLinkPattern string
FamilyLineEventsFilePattern string
PlaceDir string
PlaceLinkPattern string
PlaceFilePattern string
CalendarFilePattern string
MediaDir string
MediaLinkPattern string
MediaFilePattern string
ListInferencesDir string
ListAnomaliesDir string
ListTodoDir string
ListPeopleDir string
ListPlacesDir string
ListSourcesDir string
ListSurnamesDir string
ListChangesDir string
ListFamiliesDir string
ListFamilyLinesDir string
ChartAncestorsDir string
ChartTreesDir string
GedcomDir string
IncludePrivate bool
IncludeDebugInfo bool
ExperimentFamilies bool
ExperimentAltPersonPage bool
MapTilerAPIKey string // API key for MapTiler Cloud (NLS historic maps)
// PublishSet is the set of objects that will have pages written
PublishSet *PublishSet
Changelog []*Change
}
func (*Site) AddChangelog ¶ added in v0.0.3
func (*Site) BuildCalendar ¶
func (*Site) BuildPublishSet ¶
func (s *Site) BuildPublishSet(m model.PersonMatcher) error
func (*Site) LinkForSurnameListPage ¶
func (*Site) NewDocument ¶
func (*Site) NewMarkdownBuilder ¶
func (s *Site) NewMarkdownBuilder() render.ContentBuilder[md.Text]
func (*Site) RedirectPath ¶
func (*Site) ScanPersonForAnomalies ¶
func (*Site) WriteAnomalyListPages ¶
func (*Site) WriteChangelog ¶ added in v0.0.3
func (*Site) WriteChartAncestors ¶
func (*Site) WriteChartTrees ¶
func (*Site) WriteDescendantTree ¶
func (*Site) WriteFamilyLinesListPages ¶ added in v0.0.3
func (*Site) WriteFamilyListPages ¶ added in v0.0.3
func (*Site) WriteGedcom ¶ added in v0.0.3
func (*Site) WriteInferenceListPages ¶
func (*Site) WritePages ¶
func (*Site) WritePersonListPages ¶
func (*Site) WritePlaceListPages ¶
func (*Site) WritePlaceMapImage ¶ added in v0.0.3
WritePlaceMapImage produces a historic map image for p, saves it as a JPEG in the media subdirectory of contentDir, and returns a PlaceMap with the image URL, NLS explore link, and map name. Returns (nil, nil) when the place has no coordinates or the site has no MapTiler API key configured.
The stitched image is cached in $XDG_CACHE_HOME/genster/maps/ so subsequent runs copy from cache rather than re-downloading and re-stitching tiles.
func (*Site) WriteSourceListPages ¶
func (*Site) WriteSurnameListPages ¶
func (*Site) WriteTodoListPages ¶
func (*Site) WriteTreeOverview ¶
type TimelineEntryFormatter ¶
type TimelineEntryFormatter[T render.EncodedText] interface { Title(seq int, ev model.TimelineEvent) string Detail(seq int, ev model.TimelineEvent) string }
type Tuple ¶
type Tuple[K simplevalue, V simplevalue] struct {
K K
V V
}
func FlattenMap ¶
func FlattenMap[M ~map[K]V, K simplevalue, V simplevalue](m M) []Tuple[K, V]
FlattenMapByKeyAsc flattens a map into a slice of Tuples
func FlattenMapByKeyAsc ¶
func FlattenMapByKeyAsc[M ~map[K]V, K simplevalue, V simplevalue](m M) []Tuple[K, V]
FlattenMapByKeyAsc flattens a map and sorts by the key ascending
func FlattenMapByValueDesc ¶
func FlattenMapByValueDesc[M ~map[K]V, K simplevalue, V simplevalue](m M) []Tuple[K, V]
FlattenMapByValueDesc flattens a map and sorts by the value descending