* HowTo: EWW: Tagging regions with properties
@ 2022-12-12 2:41 T.V Raman
2022-12-12 15:04 ` Stefan Monnier
0 siblings, 1 reply; 10+ messages in thread
From: T.V Raman @ 2022-12-12 2:41 UTC (permalink / raw)
To: emacs-devel
Mostly for Lars but help from others welcome:
In Emacspeak, I have advice placed on the shr-tag functions to attach
text properties that identify portions of the rendered text with
properties that show the originating tag: e.g.:
An around advice on shr-tag-li puts text property 'li with value
'eww-tag on the region produced by rendering from the <li> tag.
The motivation is to enable Emacspeak to be able to speak the logical
contents of the bullet.
The properties get placed correctly, but when the rendering completes,
the whitespace at the beginning and end of the block of text on each
line dont get these properties, so when attempting to speak the entire
<li> contents, all I get is one line at a time depending on where
point is in the rendered bullet.
I suspect it's because some other part of shr ie outside of shr-tag-li
in this instance shifts the block of text from the <li> tag to get it
indented --- and I was hoping that default stickiness of text
properties would just take care of that -- sdly, that doesn't
happen. So question: How do I achieve what I want?
--
Thanks,
--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1 🦮
--
Thanks,
--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1 🦮
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: HowTo: EWW: Tagging regions with properties
2022-12-12 2:41 HowTo: EWW: Tagging regions with properties T.V Raman
@ 2022-12-12 15:04 ` Stefan Monnier
2022-12-12 15:38 ` T.V Raman
2022-12-12 17:55 ` T.V Raman
0 siblings, 2 replies; 10+ messages in thread
From: Stefan Monnier @ 2022-12-12 15:04 UTC (permalink / raw)
To: T.V Raman; +Cc: emacs-devel
> An around advice on shr-tag-li puts text property 'li with value
> 'eww-tag on the region produced by rendering from the <li> tag.
[ I assume you don't really mean that and it's the `eww-tag` *property*
which gets the `li` *value*, right? Nitpick: I suggest you use
`shr-tag` as property name, since it's done by `shr` rather than by `eww`,
and `shr` is also used in other contexts such as by Gnus. ]
> I suspect it's because some other part of shr ie outside of shr-tag-li
> in this instance shifts the block of text from the <li> tag to get it
> indented --- and I was hoping that default stickiness of text
> properties would just take care of that -- sdly, that doesn't
> happen. So question: How do I achieve what I want?
Text properties are fundamentally "not sticky" (they're defined as
adding a property to each character individually). The stickiness
applies only to a few special cases, basically those that use
`insert-and-inherit`. So you'll probably have to change `shr.el` so it
uses `insert-and-inherit` when inserting that whitespace.
Another approach might be to rely on overlays rather than text
properties.
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: HowTo: EWW: Tagging regions with properties
2022-12-12 15:04 ` Stefan Monnier
@ 2022-12-12 15:38 ` T.V Raman
2022-12-12 15:45 ` T.V Raman
2022-12-12 17:54 ` Stefan Monnier
2022-12-12 17:55 ` T.V Raman
1 sibling, 2 replies; 10+ messages in thread
From: T.V Raman @ 2022-12-12 15:38 UTC (permalink / raw)
To: monnier; +Cc: raman, emacs-devel
I will change eww-tag to shr-tag -- that's a good suggestion.
I did mean property li with value eww-tag at present -- did that for
some obscure reason that I dont remember.
--
Thanks,
--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1 🦮
--
Thanks,
--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1 🦮
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: HowTo: EWW: Tagging regions with properties
2022-12-12 15:38 ` T.V Raman
@ 2022-12-12 15:45 ` T.V Raman
2022-12-12 18:14 ` Yuri Khan
2022-12-12 17:54 ` Stefan Monnier
1 sibling, 1 reply; 10+ messages in thread
From: T.V Raman @ 2022-12-12 15:45 UTC (permalink / raw)
To: monnier; +Cc: emacs-devel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 365 bytes --]
I now remember the obscure reason; html tags nest and if I had used
shr-tag as the prop-name and the tag as the value, I would have had to
make the value a list and that would have made the search/navigate by
property slightly more complicated to implement.
--
Thanks,
--Raman(I Search, I Find, I Misplace, I Research)
7©4 Id: kg:/m/0285kf1 0Ü8
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: HowTo: EWW: Tagging regions with properties
2022-12-12 15:38 ` T.V Raman
2022-12-12 15:45 ` T.V Raman
@ 2022-12-12 17:54 ` Stefan Monnier
1 sibling, 0 replies; 10+ messages in thread
From: Stefan Monnier @ 2022-12-12 17:54 UTC (permalink / raw)
To: T.V Raman; +Cc: emacs-devel
T.V Raman [2022-12-12 07:38:44] wrote:
> I did mean property li with value eww-tag at present -- did that for
> some obscure reason that I dont remember.
Then I'd recommend you use `shr-li` as property name, so as to avoid
conflict with other packages which risk using that same property name
for something else.
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: HowTo: EWW: Tagging regions with properties
2022-12-12 15:04 ` Stefan Monnier
2022-12-12 15:38 ` T.V Raman
@ 2022-12-12 17:55 ` T.V Raman
2022-12-12 18:13 ` Stefan Monnier
1 sibling, 1 reply; 10+ messages in thread
From: T.V Raman @ 2022-12-12 17:55 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 411 bytes --]
Also, would overlays "scale" in this instance? Especially for *large*
html pages, where large could be a buffer of 20K+ lines in the case of
Ebookse-books?
Incidentally, EWW is beginning to feel slow already on very large
Ebookse-books, this is anecdotal, but it feels slower than it used to
be.
--
Thanks,
--Raman(I Search, I Find, I Misplace, I Research)
7©4 Id: kg:/m/0285kf1 0Ü8
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: HowTo: EWW: Tagging regions with properties
2022-12-12 17:55 ` T.V Raman
@ 2022-12-12 18:13 ` Stefan Monnier
2022-12-12 23:13 ` T.V Raman
0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2022-12-12 18:13 UTC (permalink / raw)
To: T.V Raman; +Cc: emacs-devel
> Also, would overlays "scale" in this instance? Especially for *large*
> html pages, where large could be a buffer of 20K+ lines in the case of
> Ebookse-books?
At least in Emacs-29 they should, yes. In Emacs<29 maybe yes, maybe no,
it depends (and you may be able to help along with judicious calls to
`overlay-recenter`).
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: HowTo: EWW: Tagging regions with properties
2022-12-12 15:45 ` T.V Raman
@ 2022-12-12 18:14 ` Yuri Khan
2022-12-12 20:36 ` T.V Raman
0 siblings, 1 reply; 10+ messages in thread
From: Yuri Khan @ 2022-12-12 18:14 UTC (permalink / raw)
To: T.V Raman; +Cc: monnier, emacs-devel
On Mon, 12 Dec 2022 at 22:47, T.V Raman <raman@google.com> wrote:
> I now remember the obscure reason; html tags nest and if I had used
> shr-tag as the prop-name and the tag as the value, I would have had to
> make the value a list and that would have made the search/navigate by
> property slightly more complicated to implement.
li elements nest, too, though. Not directly, but an ol > li > ol > li
nesting is nothing out of the ordinary.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: HowTo: EWW: Tagging regions with properties
2022-12-12 18:14 ` Yuri Khan
@ 2022-12-12 20:36 ` T.V Raman
0 siblings, 0 replies; 10+ messages in thread
From: T.V Raman @ 2022-12-12 20:36 UTC (permalink / raw)
To: yuri.v.khan; +Cc: raman, monnier, emacs-devel
Yes, they all nest.
Originally I was hoping to detect the closest enclosing li based on
the property change at each step
Yuri Khan writes:
> On Mon, 12 Dec 2022 at 22:47, T.V Raman <raman@google.com> wrote:
>
> > I now remember the obscure reason; html tags nest and if I had used
> > shr-tag as the prop-name and the tag as the value, I would have had to
> > make the value a list and that would have made the search/navigate by
> > property slightly more complicated to implement.
>
> li elements nest, too, though. Not directly, but an ol > li > ol > li
> nesting is nothing out of the ordinary.
--
Thanks,
--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1 🦮
--
Thanks,
--Raman(I Search, I Find, I Misplace, I Research)
♉ Id: kg:/m/0285kf1 🦮
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: HowTo: EWW: Tagging regions with properties
2022-12-12 18:13 ` Stefan Monnier
@ 2022-12-12 23:13 ` T.V Raman
0 siblings, 0 replies; 10+ messages in thread
From: T.V Raman @ 2022-12-12 23:13 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb18030, Size: 292 bytes --]
I found a temporary work-around: shr also sets property
shr-continuation-indentation that appears to span the contents of the
li element.
Not sure show reliable or robust this is.
--
Thanks,
--Raman(I Search, I Find, I Misplace, I Research)
7©4 Id: kg:/m/0285kf1 0Ü8
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2022-12-12 23:13 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-12 2:41 HowTo: EWW: Tagging regions with properties T.V Raman
2022-12-12 15:04 ` Stefan Monnier
2022-12-12 15:38 ` T.V Raman
2022-12-12 15:45 ` T.V Raman
2022-12-12 18:14 ` Yuri Khan
2022-12-12 20:36 ` T.V Raman
2022-12-12 17:54 ` Stefan Monnier
2022-12-12 17:55 ` T.V Raman
2022-12-12 18:13 ` Stefan Monnier
2022-12-12 23:13 ` T.V Raman
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.