From 7fb1289b032171002928d77e4075c22227ae1961 Mon Sep 17 00:00:00 2001 From: "Thomas M. Edwards" Date: Mon, 6 Nov 2023 16:25:22 -0600 Subject: [PATCH] Update storyout.go --- storyout.go | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/storyout.go b/storyout.go index 5018a5a..1e56664 100644 --- a/storyout.go +++ b/storyout.go @@ -32,12 +32,17 @@ func (s *story) toJSON(startName string) []byte { &storyJSON{ s.name, s.ifid, - startName, - twine2OptionsMapToSlice(s.twine2.options), s.twine2.format, s.twine2.formatVersion, + twine2OptionsMapToSlice(s.twine2.options), + startName, + s.twine2.tags, + "", // s.twine2.tagColors ← twine2TagColorsMap + s.twine2.zoom, strings.Title(tweegoName), tweegoVersion.Version(), + "", // s.twine2.style, + "", // s.twine2.script, passages, }, "", @@ -212,7 +217,8 @@ func (s *story) getTwine2DataChunk(startName string) []byte { var ( data []byte startID string - options string + optsValue string + tagsVal string pid uint ) @@ -345,32 +351,42 @@ func (s *story) getTwine2DataChunk(startName string) []byte { } // Add the wrapper. + /* - + */ - if optCount := len(s.twine2.options); optCount > 0 { - opts := make([]string, 0, optCount) + if optsCount := len(s.twine2.options); optsCount > 0 { + opts := make([]string, 0, optsCount) for opt, val := range s.twine2.options { if val { opts = append(opts, opt) } } - options = strings.Join(opts, " ") + optsValue = strings.Join(opts, " ") + } + if tagsCount := len(s.twine2.tags); tagsCount > 0 { + tags := make([]string, 0, tagsCount) + for tag, val := range s.twine2.tags { + if val { + tags = append(tags, tag) + } + } + tagsValue = strings.Join(tags, " ") } data = append([]byte(fmt.Sprintf( ``+ - `