diff options
author | xuri <xuri.me@gmail.com> | 2021-04-26 22:51:35 +0800 |
---|---|---|
committer | xuri <xuri.me@gmail.com> | 2021-04-26 22:51:35 +0800 |
commit | e5c5ecc379434b7ef4ffcbb9dcf58526cafda66a (patch) | |
tree | 3c206af0890a8bb9ef93b11cbcb14d9523b8ec96 /comment.go | |
parent | f5a20fa03f2abd9edfa2f9da66680e987fffae79 (diff) |
Fixed #825, improves compatibility for comments with absolute XML path
Diffstat (limited to 'comment.go')
-rw-r--r-- | comment.go | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -39,7 +39,14 @@ func parseFormatCommentsSet(formatSet string) (*formatComment, error) { func (f *File) GetComments() (comments map[string][]Comment) { comments = map[string][]Comment{} for n, path := range f.sheetMap { - if d := f.commentsReader("xl" + strings.TrimPrefix(f.getSheetComments(filepath.Base(path)), "..")); d != nil { + target := f.getSheetComments(filepath.Base(path)) + if target == "" { + continue + } + if !filepath.IsAbs(target) { + target = "xl" + strings.TrimPrefix(target, "..") + } + if d := f.commentsReader(strings.TrimPrefix(target, "/")); d != nil { sheetComments := []Comment{} for _, comment := range d.CommentList.Comment { sheetComment := Comment{} |