diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2019-06-21 13:16:47 -0400 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2019-06-21 13:16:47 -0400 |
| commit | 84121b3bb4820945eeec3ad6084f24c37b015683 (patch) | |
| tree | d4aa970ce388eae8e1a41c4d94decedbc4f6f9f3 /database.go | |
| parent | 58011496071a49e8f5f916a0416c36806ee94614 (diff) | |
| download | bibtex-master.tar.gz | |
Diffstat (limited to 'database.go')
| -rw-r--r-- | database.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/database.go b/database.go index 945f9eb..ddb9340 100644 --- a/database.go +++ b/database.go @@ -115,12 +115,12 @@ func (e Entry) Marshal() string { } type Database struct { - SNames []string `json:"-"` - Strings map[string]Value `json:"strings,omitempty"` - Entries map[string]Entry `json:"entries"` - Preamble Value `json:"preamble,omitempty"` - EKeys []string `json:"-"` - CrossRefs map[string]int `json:"crossrefs,omitempty"` + SNames []string `json:"-"` + Strings map[string]Value `json:"strings,omitempty"` + Entries map[string]*Entry `json:"entries"` + Preamble Value `json:"preamble,omitempty"` + EKeys []string `json:"-"` + CrossRefs map[string]int `json:"crossrefs,omitempty"` } func (d *Database) UnTex() { @@ -158,14 +158,16 @@ func (d *Database) SplitNames() { func (d *Database) Resolve() { var key string - var ref Entry for _, entry := range d.Entries { for field, value := range entry.Fields { if field != "crossref" { continue } key = strings.ToLower(value.String()) - ref = d.Entries[key] + ref, in := d.Entries[key] + if !in { + continue + } for f, v := range ref.Fields { if _, in := entry.Fields[f]; !in { entry.Fields[f] = v |
