Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var TenderCodeRegex = regexp.MustCompile(`\d{4}-[A-Z0-9]+-[A-Z0-9]+`)
TenderCodeRegex matches tender codes such as "2023-JQ01-W1295".
Functions ¶
func ResolveURL ¶ added in v1.4.10
ResolveURL turns a link reference into an absolute URL: absolute references are returned unchanged, relative ones are joined to base. An empty base leaves a relative reference unresolved (""), so the caller can drop it.
func SimplifyHTML ¶ added in v1.4.1
SimplifyHTML rewrites notice HTML into the markup Telegram's HTML parse mode renders: b/i/u/s/code/pre/blockquote/a/span.tg-spoiler plus literal newlines.
It rewrites instead of stripping because Telegram renders the message as HTML: block elements have to become line breaks, unsupported elements must be unwrapped (their text kept), and text must be escaped so a stray "<" cannot make the message unparseable.
Relative links are resolved against baseURL; when it is empty they degrade to their text.
The second result reports whether the notice contains a table too complex to flatten (see complexTableColumns/complexTableRows): such a table is replaced by a placeholder line and the caller is expected to attach the original page as a PDF instead.
Call it once per notice: the result encodes line breaks as literal newlines (Telegram has no <br>), so running it again would fold them into spaces.
Types ¶
type Config ¶
type Config struct {
// Enable console logging
ConsoleLoggingEnabled bool
// EncodeLogsAsJson makes the log framework log JSON
EncodeLogsAsJson bool
// FileLoggingEnabled makes the framework log to a file
// the fields below can be skipped if this value is false!
FileLoggingEnabled bool
// Directory to log to when file logging is enabled
Directory string
// Filename is the name of the logfile which will be placed inside the directory
Filename string
// MaxSize the max size in MB of the logfile before it's rolled
MaxSize int
// MaxBackups the max number of rolled files to keep
MaxBackups int
// MaxAge the max age in days to keep a logfile
MaxAge int
LogLevel zerolog.Level
}
Config for logging