From 3e4f68d40549f0146d2e620e5f8025163c236baa Mon Sep 17 00:00:00 2001 From: n0m1s Date: Tue, 23 Jul 2019 17:14:56 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Block=20names?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jdr/sheet.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/jdr/sheet.go b/jdr/sheet.go index bc14005..aad44ef 100644 --- a/jdr/sheet.go +++ b/jdr/sheet.go @@ -16,6 +16,7 @@ type SheetItem interface{ } type Block struct { + Name string Items []SheetItem } @@ -105,6 +106,16 @@ func parseVariable(root xmlNode, sheet *CharacterSheet) (*Variable, error) { func parseBlock(root xmlNode, sheet *CharacterSheet) (*Block, error) { ret := &Block{} + for i := 0; i < len(root.Attrs); i++ { + attrName := root.Attrs[i].Name.Local + attrVal := root.Attrs[i].Value + + switch attrName { + case "name": + ret.Name = attrVal + } + } + for i := 0; i < len(root.Nodes); i++ { item, err := parseItem(root.Nodes[i], sheet) if err != nil {