package text
import "github.com/gohugoio/hugo/common/text"
Index ¶
- func Chomp(s string) string
- func Puts(s string) string
- func RemoveAccents(b []byte) []byte
- func RemoveAccentsString(s string) string
- func VisitLinesAfter(s string, fn func(line string))
- type Position
- type Positioner
Functions ¶
func Chomp ¶
Chomp removes trailing newline characters from s.
func Puts ¶
Puts adds a trailing \n none found.
func RemoveAccents ¶
RemoveAccents removes all accents from b.
func RemoveAccentsString ¶
RemoveAccentsString removes all accents from s.
func VisitLinesAfter ¶
VisitLinesAfter calls the given function for each line, including newlines, in the given string.
Types ¶
type Position ¶
type Position struct { Filename string // filename, if any Offset int // byte offset, starting at 0. It's set to -1 if not provided. LineNumber int // line number, starting at 1 ColumnNumber int // column number, starting at 1 (character count per line) }
Position holds a source position in a text file or stream.
func (Position) IsValid ¶
IsValid returns true if line number is > 0.
func (Position) String ¶
type Positioner ¶
type Positioner interface { // Position returns the current position. // Useful in error logging, e.g. {{ errorf "error in code block: %s" .Position }}. Position() Position }
Positioner represents a thing that knows its position in a text file or stream, typically an error.
Source Files ¶
- Version
- v0.144.2 (latest)
- Published
- Feb 19, 2025
- Platform
- linux/amd64
- Imports
- 9 packages
- Last checked
- 13 hours ago –
Tools for package owners.