Re: Reconsidering Pre and Reflow

(W3C-hat off.)

Hi Wayne,

On 5 Feb 2019, at 22:50, Wayne Dick wrote:

(…)
> First let's ask honestly, does preformatted text fail Reflow (1.4.10) 
> for
> display code.  We must ask what is functional display code at 320 CSS
> pixels? Display code must:
>
>    1. be produced by authors with relative ease,
>    2. preserve the formatting conventions for the programming 
> language,
>    3. support discussion effectively,
>    4. cut and pasted into a text editors,
>
(…)
>
> So, do we live with it or try something new? I think it is time to 
> change.
> What we have now doesn't really work. It fails me, and I know what I'm
> doing. Here is my start. It works on all block-structured languages. 
> It is
> much better than pre. It meets (1) through (4).
>
> http://nosetothepage.org/reflowDisplayCode.html
>
> My technique is not perfect, but it beats the pants off any Pre 
> format.

I’m unsure that it really meets your four criterions:

1. It probably needs parsing and scripting to generate from a code 
snippet or manual insertion of line numbers and specification of 
indentation.

2. It does not for languages where whitespace indentation is part of the 
language, for example YAML https://en.wikipedia.org/wiki/YAML.

4. When I copy and paste your example into my text editor, the result 
is:

<start>

This grid example was modified from Eric Meyer Grid Layout in CSS, 
Figure 1.4

001
for (var i =0; i < sLst.length; i++) {
002
str+=sheet(sLst[i]);
003
if (i < sLst.length-1) {
004
// recursive case inserts comma separator
005
str+=com;
006
}
007
}

<end>

Maybe I’m doing something wrong but I think it is important to not 
having manually remove line numbers after copy/pasting and that 
indentation is also intact after pasting.

It also still has horizontal scrolling if code sequences like 
document.querySelectorAll('.toggle'); are used which are not broken up 
in any way by this approach.

I agree that there is a strong case for better native tools for 
displaying content. I don’t feel that we can throw out the advantages 
that pre has right now while we have no adequate replacement.

Eric

>
> Best, Wayne





--

Eric Eggert
Web Accessibility Specialist
Web Accessibility Initiative (WAI) at World Wide Web Consortium (W3C)

Received on Wednesday, 6 February 2019 11:00:16 UTC