gc70val

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	G7UCLetter   = "A-Z"
	G7Digit      = "0-9"
	G7Nonzero    = "1-9"
	G7Underscore = "_"
	G7Atsign     = "@"
	G7Banned     = `\x{0}-\x{8}\x{B}-\x{C}\x{E}-\x{1F}\x{7F}\x{80}-\x{9F}\x{D800}-\x{DFFF}\x{FFFE}-\x{FFFF}`
)
View Source
const (
	TagCONT = "CONT"
	TagHEAD = "HEAD"
	TagTRLR = "TRLR"
)

Variables

View Source
var (
	URIPrefixes = map[string]string{
		"g7":   "https://gedcom.io/terms/v7/",
		"xsd":  "http://www.w3.org/2001/XMLSchema#",
		"dcat": "http://www.w3.org/ns/decat#",
	}
)

Functions

func AddValidTag

func AddValidTag(tag string) bool

AddValidTag adds a tag to the list of valid tags. If it already exists, return false, otherwise true.

func IsValidTag

func IsValidTag(tag string) bool

func IsValidTagType

func IsValidTagType(tp string) bool

func IsXref

func IsXref(v string) bool

IsXref validates that a string is a validly formatted XRef.

Types

type Specs

type Specs struct {
	Tags      map[string]TagDef
	Calendars map[string]calDef
	Types     map[string]typeDef
	// contains filtered or unexported fields
}

func New

func New() *Specs

func (*Specs) AddExtTag

func (s *Specs) AddExtTag(in []byte) error

AddExtTag adds a tag to the list of extension tags

func (*Specs) GetEnums

func (s *Specs) GetEnums(k string) []string

GetEnums gets the list of Enums for this tag.

func (*Specs) GetRule

func (s *Specs) GetRule(k string) operators.Operator

GetRule gets the rule definition for this tag.

func (*Specs) IsValidTag

func (g *Specs) IsValidTag(tag string) bool

IsValidTag returns true if the tag is a valid standard or extended tag

func (*Specs) SetDeprecatedTags

func (s *Specs) SetDeprecatedTags(v string)

SetDeprecatedTags sets the list of deprecated tags based on the provided GEDCOM version.

type TagDef

type TagDef struct {
	Lang          string `yaml:"lang"`
	Type          string `yaml:"type"`
	URI           string `yaml:"uri"`
	Tag           string `yaml:"standard tag"`
	FullTag       string
	Specification []string `yaml:"specification"`
	Payload       string   `yaml:"payload"`

	Substructures   map[string]string `yaml:"substructures"`
	Superstructures map[string]string `yaml:"superstructures"`
	ValueOf         []string          `yaml:"value of"`

	// Validation func based on ABNF spec
	Rule operators.Operator

	EnumSetName string `yaml:"enumeration set"`
	EnumSet     enumSet
}

func (*TagDef) InferRule

func (t *TagDef) InferRule()

InferRule extracts the tag's validation rule from the ABNF Validation map.

func (*TagDef) SetRule

func (t *TagDef) SetRule(rule operators.Operator)

func (*TagDef) ValidatePayload

func (t *TagDef) ValidatePayload(str string) bool

ValidatePayload checks if the tag's payload conforms to the ABNF definition.

Jump to

Keyboard shortcuts

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