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.
This commit is contained in:
diamondburned 2020-10-09 00:17:58 -07:00
parent 285ac6403f
commit 6140b5a131
2 changed files with 9 additions and 3 deletions

View File

@ -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.

View File

@ -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.