Themes & Templates: Add new types
authorMikael Berthe <mikael@lilotux.net>
Tue, 20 Mar 2018 13:53:04 +0100
changeset 193 4a1e3b57fd0f
parent 192 be28c23ace0e
child 194 660233815ca8
Themes & Templates: Add new types
printer/templateprinter.go
printer/themeprinter.go
templates/themes/ansi-dark/list.tmpl
templates/themes/ansi/list.tmpl
--- a/printer/templateprinter.go	Tue Mar 20 13:13:06 2018 +0100
+++ b/printer/templateprinter.go	Tue Mar 20 13:53:04 2018 +0100
@@ -78,11 +78,12 @@
 	}
 
 	switch ot := obj.(type) { // I wish I knew a better way...
-	case []madon.Account, []madon.Application, []madon.Attachment, []madon.Card,
-		[]madon.Client, []madon.Context, []madon.Instance, []madon.Mention,
+	case []madon.Account, []madon.Application, []madon.Attachment,
+		[]madon.Card, []madon.Client, []madon.Context, []madon.Emoji,
+		[]madon.Instance, []madon.List, []madon.Mention,
 		[]madon.Notification, []madon.Relationship, []madon.Report,
-		[]madon.Results, []madon.Status, []madon.StreamEvent, []madon.Tag,
-		[]*gomif.InstanceStatus, []string:
+		[]madon.Results, []madon.Status, []madon.StreamEvent,
+		[]madon.Tag, []*gomif.InstanceStatus, []string:
 		return p.templateForeach(ot, w)
 	}
 
--- a/printer/themeprinter.go	Tue Mar 20 13:13:06 2018 +0100
+++ b/printer/themeprinter.go	Tue Mar 20 13:53:04 2018 +0100
@@ -76,8 +76,12 @@
 		objType = "client"
 	case []madon.Context, madon.Context, *madon.Context:
 		objType = "context"
+	case []madon.Emoji, madon.Emoji, *madon.Emoji:
+		objType = "emoji"
 	case []madon.Instance, madon.Instance, *madon.Instance:
 		objType = "instance"
+	case []madon.List, madon.List, *madon.List:
+		objType = "list"
 	case []madon.Mention, madon.Mention, *madon.Mention:
 		objType = "mention"
 	case []madon.Notification, madon.Notification, *madon.Notification:
@@ -91,7 +95,7 @@
 	case []madon.Status, madon.Status, *madon.Status:
 		objType = "status"
 	case []madon.StreamEvent, madon.StreamEvent, *madon.StreamEvent:
-		objType = "streamEvent"
+		objType = "stream_event"
 	case []madon.Tag, madon.Tag, *madon.Tag:
 		objType = "tag"
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/themes/ansi-dark/list.tmpl	Tue Mar 20 13:53:04 2018 +0100
@@ -0,0 +1,2 @@
+- ID:    {{color ",,bold"}}{{.id}}{{color "reset"}}
+  Title: {{color "cyan"}}{{.title}}{{color "reset"}}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/themes/ansi/list.tmpl	Tue Mar 20 13:53:04 2018 +0100
@@ -0,0 +1,2 @@
+- ID:    {{color ",,bold"}}{{.id}}{{color "reset"}}
+  Title: {{color "blue"}}{{.title}}{{color "reset"}}