Skip to content

Latest commit

 

History

History
33 lines (28 loc) · 735 Bytes

README.md

File metadata and controls

33 lines (28 loc) · 735 Bytes

Go Reference

ugent-library/bibtex

Robust (as in forgiving) Golang BibTeX parser

Examples

p := bibtex.NewParser(os.Stdin)
for {
    e, err := p.Next()
    if err != nil {
        log.Fatal(err)
    }
    if e == nil {
        break
    }
    
    fmt.Printf("bibtex entry: %s", e.Raw)
    fmt.Printf("type: %s", e.Type)
    fmt.Printf("key: %s", e.Key)
    for _, f := range e.Fields {
        fmt.Printf("field %s: %s", f.Name, f.Value)
    }
    for _, a := range e.Authors {
        fmt.Printf("author: %s", a)
    }
    for _, a := range e.Editors {
        fmt.Printf("editor: %s", a)
    }
}