97ad71d66b
Kind prefixes now follow the canonical grammar: `-` for todo, `@time` for event, `!time` for reminder. Removed `*`/`◇`/`▸` as capture aliases (display-layer only). Added `\` escape prefix, `?` query mode, `!pin` flag extraction, `##word` hash escape, and tag lowercasing. Both parsers produce identical results.
38 lines
682 B
Go
38 lines
682 B
Go
package display
|
|
|
|
import "github.com/lerko/nib/internal/db"
|
|
|
|
var glyphMap = map[db.Glyph]string{
|
|
db.GlyphNote: "—",
|
|
db.GlyphTodo: "○",
|
|
db.GlyphEvent: "◇",
|
|
db.GlyphReminder: "△",
|
|
}
|
|
|
|
var cardGlyphMap = map[db.CardType]string{
|
|
db.CardSnippet: "◆",
|
|
db.CardTemplate: "◈",
|
|
db.CardChecklist: "☐",
|
|
db.CardDecision: "⚖",
|
|
db.CardLink: "↗",
|
|
}
|
|
|
|
func DisplayGlyph(glyph db.Glyph, cardType *db.CardType) string {
|
|
if cardType != nil {
|
|
if g, ok := cardGlyphMap[*cardType]; ok {
|
|
return g
|
|
}
|
|
}
|
|
if g, ok := glyphMap[glyph]; ok {
|
|
return g
|
|
}
|
|
return "—"
|
|
}
|
|
|
|
func FormatID(id string) string {
|
|
if len(id) > 12 {
|
|
return id[:12]
|
|
}
|
|
return id
|
|
}
|