elliotchance/gedcom

View on GitHub
source_node.go

Summary

Maintainability
A
0 mins
Test Coverage
package gedcom

// SourceNode represents a source.
type SourceNode struct {
    *SimpleNode
}

func NewSourceNode(value, pointer string, children ...Node) *SourceNode {
    return &SourceNode{
        newSimpleNode(TagSource, value, pointer, children...),
    }
}

// If the node is nil the result will be an empty string.
func (node *SourceNode) Title() string {
    if n := First(NodesWithTag(node, TagTitle)); n != nil {
        return n.Value()
    }

    return ""
}