Text reflow woes (or: I want bullets back!)y

On Fri, Jan 17, 2020 at 08:58:04AM -0500, lel wrote:
> 
> Yes, this is exactly what I was trying to say.

Ah, right, sorry for not getting that.  I think this whole conversation,
despite Sean's best efforts to give us formally defined terms, is
suffering a lot from the fact that things like "reflowing" mean
different things to different people or in different contexts, so we're
often talking past each other.

We'd still need ``` in this system, right, to avoid e.g. long lines of
source getting mangled on very narrow phone screens?  So minimal
rendering pseudocode looks like this:

preformatted = False
for line in all_the_lines:
    if line == "```":
        preformatted = not preformatted
    elif preformatted:
        print(line)
    elif line.startwith("=>"):
        handle_link(line)
    else:
        wrap_line_to_viewport(line)

Where wrap_line_to_viewport may need to be written by the user if there
isn't a library function (and should print empty lines if given them).

Non-minimal rendering just involves replacing that final "else" clause
with more "elifs" to catch e.g. list items or headers (dispatching to
different functions, like wrap_bold_line_to_viewport to display headings
in bold).  You can add as many or as few of those extra clauses as you
like to pretty things up, as long as whatever prettiness you want
doesn't depend upon anything.

If this rendering code *is* fed text/gemini that has been hard wrapped
to a width less than or equal to the viewport, that text comes back
unmangled (but narrower than it otherwise could be). 

Are there really no catches beyond this?  I'm sure there must be, but if
not I guess the next thing to do is to start thinking about how
difficult a "good enough" (not necessarily perfect) implementation of
wrap_line_to_viewport is in most languages, and decide whether or not we
think that burden is too high.

Cheers,
Solderpunk

---

Previous in thread (98 of 148): 🗣️ lel (lel (a) envs.net)

Next in thread (100 of 148): 🗣️ lel (lel (a) envs.net)

View entire thread.