internal

package
v0.0.0-...-279b4d9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ChangeFreqAlways  = "always"
	ChangeFreqHourly  = "hourly"
	ChangeFreqDaily   = "daily"
	ChangeFreqWeekly  = "weekly"
	ChangeFreqMonthly = "monthly"
	ChangeFreqYearly  = "yearly"
	ChangeFreqNever   = "never"
)

ChangeFreq constants for sitemap

View Source
const BASE_HISTORY_URL string = "https://matthias2wym.com/history/"
View Source
const DIV_ALL_HISTORY_ITEMS string = `
  <div class="starter-template">
    <h1>History</h1>
  </div>
  <div class="container">
    <div class="row">
      {{range .Items}}
      <div class="col-lg-3 col-md-4 col-sm-6 mb-3">
        <a href="` + BASE_HISTORY_URL + `{{.Filename}}.html" class="d-block p-3 border rounded text-center" style="font-size: 1.25rem; text-decoration: none;">{{.Date}}</a>
      </div>
      {{else}}{{end}}
    </div>
  </div>
`
View Source
const DIV_NEW_WORD_ITEM_TEMPLATE = `` /* 968-byte string literal not displayed */
View Source
const HISTORY_HEADER string = `` /* 3460-byte string literal not displayed */
View Source
const HISTORY_PATH string = "../public/history/"
View Source
const PUBLIC_PATH string = "../public/"
View Source
const WORD_INDEX_FOOTER string = `` /* 1010-byte string literal not displayed */
View Source
const WORD_INDEX_HEADER string = `` /* 3591-byte string literal not displayed */

Variables

This section is empty.

Functions

func CheckErr

func CheckErr(err error)

func CreateHistoryHtmlAndSitemap

func CreateHistoryHtmlAndSitemap(historyPath string)

func GenDailyWordHtmlFromJson

func GenDailyWordHtmlFromJson(dailyNewWordJsonFilePath string, historyPath string)

func GetDailyFileName

func GetDailyFileName() string

func GetDateFromFilename

func GetDateFromFilename(filename string) string

func GetFilenameNoExt

func GetFilenameNoExt(filename string) string

func GetHistoryFilenameFromFolder

func GetHistoryFilenameFromFolder(historyPath string) []string

func GetTodaysDate

func GetTodaysDate() string

func GetTodaysDateWithFormat

func GetTodaysDateWithFormat(format string) string

Types

type History

type History struct {
	Index    int    `json:"index"`
	Filename string `json:"filename"`
	Date     string `json:"date"`
}

type Sitemap

type Sitemap struct {
	URLs []URL
}

Sitemap represents a sitemap with URLs

func GenerateSitemapFromHistory

func GenerateSitemapFromHistory(history []History) *Sitemap

func NewSitemap

func NewSitemap() *Sitemap

NewSitemap creates a new sitemap

func (*Sitemap) AddURL

func (s *Sitemap) AddURL(loc string, lastMod *time.Time, changeFreq string, priority float32)

AddURL adds a URL to the sitemap

func (*Sitemap) Generate

func (s *Sitemap) Generate(w io.Writer) error

Generate creates an XML sitemap

func (*Sitemap) GenerateToString

func (s *Sitemap) GenerateToString() (string, error)

GenerateToString returns the sitemap as a string

type URL

type URL struct {
	Loc        string
	LastMod    *time.Time
	ChangeFreq string
	Priority   float32
}

URL represents a single URL entry in the sitemap

type Word

type Word struct {
	Index      int    `json:"index"`
	Word       string `json:"word"`
	Definition string `json:"def"`
}

func Decode2WordsInLimit

func Decode2WordsInLimit(r io.Reader) ([]Word, error)

func ReadLimitedJsonFile2Words

func ReadLimitedJsonFile2Words(jsonFile *os.File) ([]Word, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL