scarpe-team / scarpe

Scarpe - shoes but running on webview

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Text Drawables should declare all the visible Shoes styles, not just the ones HTML doesn't handle

noahgibbs opened this issue · comments

Schwad asked a great question in PR #517: where do you look for the Shoes styles that define a given TextDrawable, like the fact that del is strikethrough and ins is single-underline. I basically said "I mostly did this how we've been doing it, so I'm using HTML and CSS defaults everywhere we can and then declaring ins-is-underline with a Shoes default."

That's not actually a good answer. It leaks HTML-based implementation knowledge: display service has to know all the Shoes-equivalent styles, except for ins because HTML doesn't have it. The current way works, but it's inelegant.

It also means the styles aren't available in Lacci - calling em("foo").style won't return them. That's not really a Shoes-compatibility argument, though, because .style (no args, return the styles) has to be called on a slot instead of a Drawable or TextDrawable in Shoes. Still, it would be nice if those things were visible in Lacci, even if Shoes3 didn't do that. And it would be nice if there were one place in Lacci or Scarpe-Webview to see all the definitions together.

Here are some ways we might solve that (pick one, not do all of them):

  • Do it all in Shoes, and HTML tag output is very wordy. All our <em> tags turn into span-with-italics-as-inline-style, for instance.
  • Don't do it in Shoes but add a bunch of CSS styling. So there's a stylesheet that says every del tag under the Shoes body div has strikethrough, for instance. Then that stylesheet becomes the "one source", at least for HTML. Things like ins-means-underline can be a custom ins tag specific to Calzini if we do that. We could also add custom tags to other drawables if we wanted. We could also do this with classes instead of tags for some things (single underline) but not others (fill color, since it takes an arg.)
  • Do it all in Shoes, and teach Shoes how to know which tag to use (del when strikethrough is set, em when it's italicised, strong when bold, etc.) This adds some complexity since we have to teach Calzini how to pick HTML tags based on their CSS (or Shoes?) properties. But we'd be able to set all the properties in one place and still get pretty HTML output. I like our pretty HTML output.