unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* EWW Feature Request: Mark start and end of table cells?
@ 2020-10-20 23:59 T.V Raman
  2020-10-21 10:53 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: T.V Raman @ 2020-10-20 23:59 UTC (permalink / raw)
  To: emacs-devel

Hi Lars,

This is a feature request specifically for emacspeak
(https://github.com/tvraman/emacspeak:

I'd like a way to be able to easily speak table cell contents and move
across table cells --up, left, right and down.

To do this reliably, I wonder if you could mark the   start and end of
table cells (td, th) via text properties in the  rendered buffer.

I tried to do this without touching code in shr (ie via advice) but
mostly failed because of how table rendering works at present.



-- 

Thanks,

--Raman
♉ Id: kg:/m/0285kf1  🦮

-- 

Thanks,

--Raman
♉ Id: kg:/m/0285kf1  🦮



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: EWW Feature Request: Mark start and end of table cells?
  2020-10-20 23:59 EWW Feature Request: Mark start and end of table cells? T.V Raman
@ 2020-10-21 10:53 ` Lars Ingebrigtsen
  2020-10-21 14:27   ` T.V Raman
  2020-10-21 15:10   ` T.V Raman
  0 siblings, 2 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2020-10-21 10:53 UTC (permalink / raw)
  To: T.V Raman; +Cc: emacs-devel

"T.V Raman" <raman@google.com> writes:

> I'd like a way to be able to easily speak table cell contents and move
> across table cells --up, left, right and down.

It'd be a nice feature in general -- I mean, getting the contents of a
table cell in shr, so that you can `C-w' the contents, for instance.

But it's difficult in general because of the way the tables are
rendered.  I guess one could put some text property on all the
characters in a cell to allow some command to put the text back together
again (say, `table-id #42351' or something), but I don't know what the
performance impact would be (and shr is plenty slow as it is).

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: EWW Feature Request: Mark start and end of table cells?
  2020-10-21 10:53 ` Lars Ingebrigtsen
@ 2020-10-21 14:27   ` T.V Raman
  2020-10-22 11:25     ` Lars Ingebrigtsen
  2020-10-21 15:10   ` T.V Raman
  1 sibling, 1 reply; 8+ messages in thread
From: T.V Raman @ 2020-10-21 14:27 UTC (permalink / raw)
  To: larsi; +Cc: raman, emacs-devel

Thanks. Perhaps enable some type of configurable hook that allows for
experimentation? I'm just speculating at this point, as things stand,
even experimenting with such a feature is hard. Text properties would
be the easiest way to do it -- and if those properties dont have any
effect on rendering, they should be "invisible" both with respect to
display and performance to the user I hope Lars Ingebrigtsen writes:
 > "T.V Raman" <raman@google.com> writes:
 > 
 > > I'd like a way to be able to easily speak table cell contents and move
 > > across table cells --up, left, right and down.
 > 
 > It'd be a nice feature in general -- I mean, getting the contents of a
 > table cell in shr, so that you can `C-w' the contents, for instance.
 > 
 > But it's difficult in general because of the way the tables are
 > rendered.  I guess one could put some text property on all the
 > characters in a cell to allow some command to put the text back together
 > again (say, `table-id #42351' or something), but I don't know what the
 > performance impact would be (and shr is plenty slow as it is).
 > 
 > -- 
 > (domestic pets only, the antidote for overdose, milk.)
 >    bloggy blog: http://lars.ingebrigtsen.no

-- 
♉Id: kg:/m/0285kf1  🦮♉

--
♉Id: kg:/m/0285kf1  🦮♉



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: EWW Feature Request: Mark start and end of table cells?
  2020-10-21 10:53 ` Lars Ingebrigtsen
  2020-10-21 14:27   ` T.V Raman
@ 2020-10-21 15:10   ` T.V Raman
  2020-10-21 19:56     ` T.V Raman
  1 sibling, 1 reply; 8+ messages in thread
From: T.V Raman @ 2020-10-21 15:10 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 1150 bytes --]

Lars Ingebrigtsen <larsi@gnus.org> writes:
See my present "poor man's solution" for browsing tables by cells:
https://github.com/tvraman/emacspeak/blob/master/lisp/emacspeak-eww.el#L2375

I'm hanging the table-dom as a text property on the rendered table, and
the performance hit is not perceivable --- at least to me --- though it
might well be causing some kind of visual flicker by slowing the display 

> "T.V Raman" <raman@google.com> writes:
>
>> I'd like a way to be able to easily speak table cell contents and move
>> across table cells --up, left, right and down.
>
> It'd be a nice feature in general -- I mean, getting the contents of a
> table cell in shr, so that you can `C-w' the contents, for instance.
>
> But it's difficult in general because of the way the tables are
> rendered.  I guess one could put some text property on all the
> characters in a cell to allow some command to put the text back together
> again (say, `table-id #42351' or something), but I don't know what the
> performance impact would be (and shr is plenty slow as it is).

-- 

Thanks,

--Raman
7©4 Id: kg:/m/0285kf1  •0Ü8



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: EWW Feature Request: Mark start and end of table cells?
  2020-10-21 15:10   ` T.V Raman
@ 2020-10-21 19:56     ` T.V Raman
  2020-10-22 11:35       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 8+ messages in thread
From: T.V Raman @ 2020-10-21 19:56 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: emacs-devel

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 793 bytes --]

Hi Lars,

could you explain (perhaps via comments in the code for  posterity) the
meaning of the return value of shr-render-td-1 -- suspect this is where
the cell gets rendered and its rendered representation returned for
insertion in the output.

I used this markup:
<table><tr><td> sis is a test.</td></tr></table>
With this advice below:
(setq td-result  nil)

(defadvice shr-render-td-1 (after test pre act comp)
  (cl-declare (special td-result))
  (setq td-result ad-return-value)
  )

And td-result gets set to this list:

(7 7 1 (#("testing" 0 1 (shr-indentation 0))) 1 nil nil)
so (elt td-result 3) is the rendered cell, could you explain the meaning
of the other list elements in the returned value?
-- 

Thanks,

--Raman
7©4 Id: kg:/m/0285kf1  •0Ü8



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: EWW Feature Request: Mark start and end of table cells?
  2020-10-21 14:27   ` T.V Raman
@ 2020-10-22 11:25     ` Lars Ingebrigtsen
  2020-10-22 14:30       ` T.V Raman
  0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2020-10-22 11:25 UTC (permalink / raw)
  To: T.V Raman; +Cc: emacs-devel

"T.V Raman" <raman@google.com> writes:

> Thanks. Perhaps enable some type of configurable hook that allows for
> experimentation? I'm just speculating at this point, as things stand,
> even experimenting with such a feature is hard.

You can just put whatever functions you want into
`shr-external-rendering-functions' and write whatever code you want.
You don't have to render <table> as tabular data -- I imagine that for
emacspeak it might make sense to just render each <td> as a paragraph.
At least in some circumstances -- where <table> is used for layout and
not actual tabular data.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: EWW Feature Request: Mark start and end of table cells?
  2020-10-21 19:56     ` T.V Raman
@ 2020-10-22 11:35       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2020-10-22 11:35 UTC (permalink / raw)
  To: T.V Raman; +Cc: emacs-devel

"T.V Raman" <raman@google.com> writes:

> (7 7 1 (#("testing" 0 1 (shr-indentation 0))) 1 nil nil)
> so (elt td-result 3) is the rendered cell, could you explain the meaning
> of the other list elements in the returned value?

The return value (at the end of the function) should be pretty
self-explanatory:

      (list max-width
	    natural-width
	    (count-lines (point-min) (point-max))
	    (split-string (buffer-string) "\n")
	    (if (dom-attr dom 'colspan)
		(string-to-number (dom-attr dom 'colspan))
	      1)
	    (cdr (assq 'color shr-stylesheet))
	    (cdr (assq 'background-color shr-stylesheet))))))


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: EWW Feature Request: Mark start and end of table cells?
  2020-10-22 11:25     ` Lars Ingebrigtsen
@ 2020-10-22 14:30       ` T.V Raman
  0 siblings, 0 replies; 8+ messages in thread
From: T.V Raman @ 2020-10-22 14:30 UTC (permalink / raw)
  To: larsi; +Cc: raman, emacs-devel

Hi Lars,

You're right in a way, but not quite. For linearizing tables etc, I
already have xslt magic.
Also the web has evolved where complex visual layout is now achieved
via lots of divs and spans rather than lots of nested tables (note I
said has changed, not necessarily changed for the better).

For now what I'm looking for is to turn data tables into something
that is more than just screen-deep.
Lars Ingebrigtsen writes:
 > "T.V Raman" <raman@google.com> writes:
 > 
 > > Thanks. Perhaps enable some type of configurable hook that allows for
 > > experimentation? I'm just speculating at this point, as things stand,
 > > even experimenting with such a feature is hard.
 > 
 > You can just put whatever functions you want into
 > `shr-external-rendering-functions' and write whatever code you want.
 > You don't have to render <table> as tabular data -- I imagine that for
 > emacspeak it might make sense to just render each <td> as a paragraph.
 > At least in some circumstances -- where <table> is used for layout and
 > not actual tabular data.
 > 
 > -- 
 > (domestic pets only, the antidote for overdose, milk.)
 >    bloggy blog: http://lars.ingebrigtsen.no

-- 
♉Id: kg:/m/0285kf1  🦮♉

--
♉Id: kg:/m/0285kf1  🦮♉



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-10-22 14:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-20 23:59 EWW Feature Request: Mark start and end of table cells? T.V Raman
2020-10-21 10:53 ` Lars Ingebrigtsen
2020-10-21 14:27   ` T.V Raman
2020-10-22 11:25     ` Lars Ingebrigtsen
2020-10-22 14:30       ` T.V Raman
2020-10-21 15:10   ` T.V Raman
2020-10-21 19:56     ` T.V Raman
2020-10-22 11:35       ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).