utils

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JoinURL added in v0.4.0

func JoinURL(base string, segments ...string) string

JoinURL joins a base URL with path segments, trimming slashes and skipping empty segments. A trailing empty segment yields the directory URL. When base is empty the result is a root-relative path.

func NormalizeFeedName

func NormalizeFeedName(title string) string

NormalizeFeedName converts a feed title to a URL-safe normalized name Converts to lowercase, replaces spaces with '-', and special chars with '_'

func ParseDayUTC

func ParseDayUTC(s string) (start, end time.Time, err error)

ParseDayUTC parses a single-day selector into a [start, end) window covering that whole day in UTC (midnight to midnight). Accepts "YYYY-MM-DD", "today", or "yesterday". For the "today"/"yesterday" shortcuts the calendar date is taken from local time, while the returned window is still UTC.

func ParseTimeString

func ParseTimeString(s string) (time.Time, error)

ParseTimeString parses a user-friendly time string into a time.Time Supported formats:

  • "now" - current time
  • RFC3339: "2006-01-02T15:04:05Z07:00"
  • Date: "2006-01-02"
  • Relative: "7d", "2h", "30m" or "-7d", "-2h", "-30m" (days, hours, minutes ago)
func ResolveLink(base, link string) string

ResolveLink returns link unchanged when it is already absolute or when base is empty. Otherwise it joins base with the (relative) link.

func StripCSSComments added in v0.4.0

func StripCSSComments(css string) string

StripCSSComments removes /* ... */ comments from a stylesheet, replacing each with a single space (so adjacent tokens like "0/* */0" stay separated rather than merging into "00"), then trims trailing whitespace per line and drops any line left blank. It scans character by character and ignores /* sequences that appear inside single- or double-quoted strings (e.g. url("...")), so it never cuts into a value.

Source .css files keep their comments; this is applied at render time so the published HTML stays lean.

Types

This section is empty.

Jump to

Keyboard shortcuts

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