Re: Code in Pre should not be a failure at this time.

The issue with adding line numbers directly as part of the content in 
code blocks is that it then makes it impossible to directly copy/paste 
working code (user has to first manually strip back out the hardcoded 
line numbers), which is why authors are loathe to do it.

My comment was specifically about not having any CSS way of generating 
styles (including line numbers) directly, as there's no selectors to 
drill down into individual lines of a <pre>.

Running JS on top though, it's possible to wrap individual lines in, 
say, <span>s or similar, which THEN can be restyled. That is likely the 
more robust solution.

P

On 02/02/2019 02:59, Wayne Dick wrote:
> Hi Everyone,
> 
> 
> The following code Figure 1 will produce the display in Figure 2
> 
> 
> <pre style="white-space: pre-line;">
> 001this.fontSheet = {
> 002"name": this.fontNameRec,
> 003"purpose": "change to the user running font from the author's choice.",
> 004"source": "user",
> 005"rules": [
> 006{
> 007"selector": this.fontSelect,
> 008"list": [
> 009this.famRec,
> 010this.fSizeRec
> 011]
> 012},
> 013{
> 014"selector": this.font2Select,
> 015"list": [
> 016this.fam2Rec,
> 017this.fSize2Rec
> 018]
> 019}
> 020]
> 021};
> 
> </pre>
> 
> 
> Figure 1: Pre formatted html code for display
> 
> 
>    001this.fontSheet = {
> 002 "name": this.fontNameRec,
> 003"purpose": "change to the user running font from the  author's choice.",
> 004 "source": "user",
> 005"rules": [
> 006 {
> 007"selector": this.fontSelect,
> 008"list": [
> 009this.famRec,
> 010this.fSizeRec
> 011]
> 012},
> 013{
> 014"selector": this.font2Select,
> 015"list": [
> 016this.fam2Rec,
> 017this.fSize2Rec
> 018]
> 019}
> 020]
> 021};
> 
> 
> This will zoom pretty well. Not perfect (see lines 002, 003, 007, 014)
> 
> 
> 001this.fontSheet = {
> 002 "name": this.fontNameRec,
> 003"purpose": "change to the user running font from the  author's choice.",
> 004 "source": "user",
> 005"rules": [
> 006 {
> 007"selector": this.fontSelect,
> 008"list": [
> 009this.famRec,
> 010this.fSizeRec
> 011]
> 012},
> 013{
> 014"selector": this.font2Select,
> 015"list": [
> 016this.fam2Rec,
> 017this.fSize2Rec
> 018]
> 019}
> 020]
> 021};
> 
> 
> This is not perfect, but it does satisfy 1.4.10. I think we might do 
> better with
> 
> 
> 
> On Fri, Feb 1, 2019 at 5:45 PM Patrick H. Lauke <redux@splintered.co.uk 
> <mailto:redux@splintered.co.uk>> wrote:
> 
>     The problem is that, to my knowledge, there's no way to style
>     individual
>     lines in a <code> or <pre> block with pure CSS, unless some extra
>     elements have been used to delimit individual lines as well...
> 
>     P
> 
>     On 02/02/2019 01:03, Wayne Dick wrote:
>      > I'm workin' on it.
>      >
>      > On Fri, Feb 1, 2019 at 1:51 PM Jonathan Avila
>     <jon.avila@levelaccess.com <mailto:jon.avila@levelaccess.com>
>      > <mailto:jon.avila@levelaccess.com
>     <mailto:jon.avila@levelaccess.com>>> wrote:
>      >
>      >     Editor like Notepad++ show line numbers and then have no line
>     number
>      >     for lines that wrap.  So some sort of indicator would do the
>     job for
>      >     wrapped text that is not a line break.____
>      >
>      >     __ __
>      >
>      >     Jon____
>      >
>      >     __ __
>      >
>      >     *From:* Wayne Dick <wayneedick@gmail.com
>     <mailto:wayneedick@gmail.com> <mailto:wayneedick@gmail.com
>     <mailto:wayneedick@gmail.com>>>
>      >     *Sent:* Friday, February 1, 2019 3:31 PM
>      >     *To:* GLWAI Guidelines WG org <w3c-wai-gl@w3.org
>     <mailto:w3c-wai-gl@w3.org>
>      >     <mailto:w3c-wai-gl@w3.org <mailto:w3c-wai-gl@w3.org>>>
>      >     *Subject:* Code in Pre should not be a failure at this time.____
>      >
>      >     __ __
>      >
>      >     *CAUTION:*This email originated from outside of the
>     organization. Do
>      >     not click links or open attachments unless you recognize the
>     sender
>      >     and know the content is safe.____
>      >
>      >     __ __
>      >
>      >     In my final note on crowd sourcing Pre I outlined the
>     difficulties
>      >     with code. However, we do not have an alternative html construct
>      >     that does the job.____
>      >
>      >     __ __
>      >
>      >     I think we should work on some basic format rules to enable
>      >     formatting that does not obscure block structure when it word
>      >     wraps.  I can pull down some examples to see what we can do. BUT
>      >     this should be WCAG 2.1 only. ____
>      >
>      >     __ __
>      >
>      >     We need a bridge until suitable semantic code for developed for
>      >     HTML.____
>      >
>      >     __ __
>      >
>      >     Best, Wayne____
>      >
> 
> 
>     -- 
>     Patrick H. Lauke
> 
>     www.splintered.co.uk <http://www.splintered.co.uk> |
>     https://github.com/patrickhlauke
>     http://flickr.com/photos/redux/ | http://redux.deviantart.com
>     twitter: @patrick_h_lauke | skype: patrick_h_lauke
> 


-- 
Patrick H. Lauke

www.splintered.co.uk | https://github.com/patrickhlauke
http://flickr.com/photos/redux/ | http://redux.deviantart.com
twitter: @patrick_h_lauke | skype: patrick_h_lauke

Received on Saturday, 2 February 2019 10:22:11 UTC