From 6140b5a1318a73093ee8dae2e185f99f6ec61b37 Mon Sep 17 00:00:00 2001 From: diamondburned Date: Fri, 9 Oct 2020 00:17:58 -0700 Subject: [PATCH] Clarified text.{Imager,Avatarer}'s bound behavior This commit clarifies text.Imager and text.Avatarer's bound behaviors. Prior to this, the only behavior that those two interfaces have regarding bounds is that only the starting bound matters, because images must not substitute texts. This commit clarifies that images are allowed complement other sections. For example, a Mentioner can "have" an Imager by having the bounds overlap. These details are intentionally vaguely defined (it doesn't list any interfaces beyond Mentioner), so implementations of either side can implement these however they want, as long as the bounds overlap. In the future, further clarification rules may be added if needed. --- repository/main.go | 7 +++++-- text/text.go | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/repository/main.go b/repository/main.go index 54fbaed..c2dfb14 100644 --- a/repository/main.go +++ b/repository/main.go @@ -131,8 +131,11 @@ var Main = Packages{ }, { Comment: Comment{` Imager implies the segment should be replaced with a (possibly - inlined) image. Only the starting bound matters, as images - cannot substitute texts. + inlined) image. Unless the Imager segment covers something + meaningful, only the starting bound should matter, as images + must not substitute texts and only complement them. An example + of this would be having Imager cover the entire chunk that + Mentioner does. For segments that also implement mentioner, the image should be treated as a square avatar. diff --git a/text/text.go b/text/text.go index c4fd96c..c58f376 100644 --- a/text/text.go +++ b/text/text.go @@ -93,7 +93,10 @@ type Colorer interface { } // Imager implies the segment should be replaced with a (possibly inlined) -// image. Only the starting bound matters, as images cannot substitute texts. +// image. Unless the Imager segment covers something meaningful, only the +// starting bound should matter, as images must not substitute texts and only +// complement them. An example of this would be having Imager cover the entire +// chunk that Mentioner does. // // For segments that also implement mentioner, the image should be treated as a // square avatar.