Open rakiru opened 10 years ago
Also, all formatters should subclass a generic formatter.
This generic formatter could actual parse/tokenise the input message and call other methods to handle it (either on a per-token basis or as a list of tokens), and by default simply return an empty string (or markdown) for formatting charaters/strings.
It could also contain generic formatting functions, such as limiting a string length and appending "...", etc. On this note, see #11 (some of that stuff could be done with the python standard library).
Well, if a protocol has no formatter, supply a generic one that removes formatting tokens.
Are you good at tokenizing and such? 'cause I'm really not. xD
How hard can it be? :P
It's something I was never able to wrap my head around :P
It just occurred to me that formatters should go both ways. That is to say..
We should definitely plan for this as some protocols are going to have odd formatting.
Raising this to blocker status, we really need this one.
Convert a message such as "{BOLD}foo{BOLD_END}" into the correct formatting for the given protocol.
This should probably be a class instantiated as proto_instance.formatter (Mumble could use a generic HTML one then, for instance, or a subclass of one, and protocols with no formatting could use one that does nothing (or markdown-style)). Actual format of messages still to be discussed.
Should missing formatting support (such as a protocol not support italics) do nothing, or attempt to format it another way? Should a formatter that can support certain formatting, but not natively (such as Mumble/HTML not having colour reverse support) do nothing, or attempt the formatting its own way?
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.