Documentation
¶
Overview ¶
Package sourcemap provides a simplified sourcemap for data-files. Its primary use is to map keypaths to the correct linenumber / offsets within the data-file.
Index ¶
- func DiffOfObjects(a, b interface{}) (diff.Changelog, error)
- func IsValueLike(t chroma.Token) bool
- func JsonKeys(tokens []Token) map[string]SpanToken
- func MapToSource(contentType string, content string) (map[string]SpanToken, error)
- func MapToSourceFromTokens(contentType string, tokens []Token) (map[string]SpanToken, error)
- func SourceMapperSupports(contentType string) bool
- type JsonPath
- type Offset
- type SpanToken
- type Token
- type Tokenizer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DiffOfObjects ¶
func DiffOfObjects(a, b interface{}) (diff.Changelog, error)
DiffOfObjects returns a changelog with options set for use with for instance i18n-json.
func IsValueLike ¶
func JsonKeys ¶
JsonKeys creates a map of all the key-paths within a json-file pointing to the line-number/offset of the json-file This is mostly used to be able to use git blame on the file on the client-side to get a timestamp for the change, to make it easier to autoresolve change-conflicts. Asumptions for the input-file: - Valid Json - Each json-value is on a single line. I don't think JSON supports values spanning multiple lines
func MapToSource ¶
func MapToSourceFromTokens ¶
func SourceMapperSupports ¶
Types ¶
type JsonPath ¶
type JsonPath struct { Queue string // contains filtered or unexported fields }
func NewJsonPath ¶
func NewJsonPath() JsonPath
func (*JsonPath) AddArrayElement ¶
func (jp *JsonPath) AddArrayElement()