You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Caeml currently assumes that seeing the text/plain part is what you want. It does not provide any information about the existence of other message parts, nor is it obvious from the output whether the message is empty or whether it did not contain a text/plain part (some people might only send text/html).
Some thoughts about improvement:
print a warning, if there's no text/plain part found
allow a commandline override to output a different part other than text/plain
somehow print an enumeration of all the message parts (maybe as a special "header"?)
Some notes to myself:
Maybe go somehow like this: iterate over all the parts. If we see text/plain, store it for output and after the entire iteration write it to stdout. If we haven't yet seen text/plain but we see text/html store that for output, but overwrite with text/plain if we see that. If user passes text/html as the desired output, do the same, but don't overwrite with text/plain (need to store a flag that the stored output is not fallback probably). We can do this for any other part (i.e. first always fall back to text/plain, if that is not available to text/html, but if we see the requested part store that for output and set the flag that we are not fallback anymore).
The text was updated successfully, but these errors were encountered:
You could DIY a simple HTML parser which basically turns <b>, <i>, <em>, <a> and so on into ANSI escape codes and strips anything else. Plus maybe a wrapper. This way, you wouldn't even have to create a tokenizer, you can just use either regex or write what the RegEx does if it is too slow (which I doubt). I wouldn't personally bother with CSS parsing and the likes.
Would at least make the HTML experience more bearable :D
Hmm, I don't think I want to get into html parsing. On the other hand we could make a filter interface, similar to aerc. In that case it would make sense to fall back to first text/markdown and if that doesn't exist to text/html and if even that doesn't exist to any text/*. Or something like this. Shouldn't be very complicated.
Caeml currently assumes that seeing the
text/plain
part is what you want. It does not provide any information about the existence of other message parts, nor is it obvious from the output whether the message is empty or whether it did not contain atext/plain
part (some people might only sendtext/html
).Some thoughts about improvement:
text/plain
part foundtext/plain
Some notes to myself:
Maybe go somehow like this: iterate over all the parts. If we see text/plain, store it for output and after the entire iteration write it to stdout. If we haven't yet seen text/plain but we see text/html store that for output, but overwrite with text/plain if we see that. If user passes text/html as the desired output, do the same, but don't overwrite with text/plain (need to store a flag that the stored output is not fallback probably). We can do this for any other part (i.e. first always fall back to text/plain, if that is not available to text/html, but if we see the requested part store that for output and set the flag that we are not fallback anymore).
The text was updated successfully, but these errors were encountered: