--- Read / Write --- buildNoteMeta assembles NoteMeta for a note-like file. Excalidraw drawings store JSON, not Markdown, so their tags/wikilinks/excerpt are skipped — a hex color like "#1971c2" in the scene must not register as a #tag.
(relPosix, title string, folder NoteFolder, info os.FileInfo, bodyStr string)
| 1066 | // store JSON, not Markdown, so their tags/wikilinks/excerpt are skipped — a hex |
| 1067 | // color like "#1971c2" in the scene must not register as a #tag. |
| 1068 | func buildNoteMeta(relPosix, title string, folder NoteFolder, info os.FileInfo, bodyStr string) NoteMeta { |
| 1069 | meta := NoteMeta{ |
| 1070 | Path: relPosix, |
| 1071 | Title: title, |
| 1072 | Folder: folder, |
| 1073 | CreatedAt: info.ModTime().UnixMilli(), |
| 1074 | UpdatedAt: info.ModTime().UnixMilli(), |
| 1075 | Size: info.Size(), |
| 1076 | Tags: []string{}, |
| 1077 | Wikilinks: []string{}, |
| 1078 | } |
| 1079 | if isExcalidrawName(relPosix) { |
| 1080 | return meta |
| 1081 | } |
| 1082 | meta.Tags = ExtractTags(bodyStr) |
| 1083 | meta.Wikilinks = ExtractWikilinks(bodyStr) |
| 1084 | meta.HasAttachments = BodyHasLocalAsset(bodyStr) |
| 1085 | meta.Excerpt = BuildExcerpt(bodyStr) |
| 1086 | return meta |
| 1087 | } |
| 1088 | |
| 1089 | func (v *Vault) readMeta(folder NoteFolder, abs string) (NoteMeta, error) { |
| 1090 | info, err := os.Stat(abs) |
no test coverage detected