-
Notifications
You must be signed in to change notification settings - Fork 20
/
surname_list_page.go
41 lines (35 loc) 路 1.11 KB
/
surname_list_page.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package html
import (
"github.com/elliotchance/gedcom"
"github.com/elliotchance/gedcom/html/core"
"io"
)
type SurnameListPage struct {
document *gedcom.Document
googleAnalyticsID string
options *PublishShowOptions
indexLetters []rune
}
func NewSurnameListPage(document *gedcom.Document, googleAnalyticsID string, options *PublishShowOptions, indexLetters []rune) *SurnameListPage {
return &SurnameListPage{
document: document,
googleAnalyticsID: googleAnalyticsID,
options: options,
indexLetters: indexLetters,
}
}
func (c *SurnameListPage) WriteHTMLTo(w io.Writer) (int64, error) {
table := []core.Component{
core.NewTableHead("Surname", "Number of Individuals"),
}
for _, surname := range getSurnames(c.document).Strings() {
table = append(table, NewSurnameInList(c.document, surname))
}
return core.NewPage("Surnames", core.NewComponents(
NewPublishHeader(c.document, "", selectedSurnamesTab, c.options,
c.indexLetters),
core.NewRow(
core.NewColumn(core.EntireRow, core.NewTable("", table...)),
),
), c.googleAnalyticsID).WriteHTMLTo(w)
}