diff --git a/emilia/accoutrement.go b/emilia/accoutrement.go index 594da51..f15d314 100644 --- a/emilia/accoutrement.go +++ b/emilia/accoutrement.go @@ -38,11 +38,13 @@ func InitializeAccoutrement(page *yunyun.Page) { } // FillAccoutrement parses `options` and fills the `target`. -func FillAccoutrement(options *string, target *yunyun.Accoutrement) { +func FillAccoutrement(options *string, page *yunyun.Page) { // Exit immediately if it's an empty string. if len(*options) < 1 { return } + // Let's first initialize it before filling. + InitializeAccoutrement(page) for _, option := range strings.Split(*options, " ") { elements := strings.SplitN(option, ":", 2) key := gana.First(elements) @@ -53,7 +55,7 @@ func FillAccoutrement(options *string, target *yunyun.Accoutrement) { } // If action is found, then execute it. if action, ok := accotrementActions[key]; ok { - action(value, target) + action(value, page.Accoutrement) } } } diff --git a/parse/orgmode/parse.go b/parse/orgmode/parse.go index 9f36113..d6a3832 100644 --- a/parse/orgmode/parse.go +++ b/parse/orgmode/parse.go @@ -58,8 +58,7 @@ func (p ParserOrgmode) Parse() *yunyun.Page { // optionsStrings will get populated as the page is being scanned // and then parsed out before leaving this parser. optionsStrings := "" - emilia.InitializeAccoutrement(page) - defer emilia.FillAccoutrement(&optionsStrings, page.Accoutrement) + defer emilia.FillAccoutrement(&optionsStrings, page) // Optional parsing to see if H.E. has been left on the first line // as the date