Gnus development mailing list
 help / color / mirror / Atom feed
* shr: alt text truncation
@ 2010-11-05  0:53 Katsumi Yamaoka
  2010-11-05  1:07 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Katsumi Yamaoka @ 2010-11-05  0:53 UTC (permalink / raw)
  To: ding

Currently the width of an alt text is limited by 8, so I come
across ones like the following occasionally:

+--------+
|Amazon.c|
+--------+
[   image   ]

Is it really necessary?  Even so, can't the limit be extended to
shr-width at least in a table?  For instance:

--- shr.el~	2010-11-04 22:03:07 +0000
+++ shr.el	2010-11-05 00:51:26 +0000
@@ -557,3 +557,6 @@
-	  (let ((shr-state 'space))
-	    (if (> (string-width alt) 8)
-		(shr-insert (truncate-string-to-width alt 8))
+	  (let ((shr-state 'space)
+		(limit (if (zerop shr-table-depth) 8 shr-width)))
+	    (if (> (string-width alt) limit)
+		(shr-insert
+		 (concat (truncate-string-to-width alt (- limit 3))
+			 (make-string 3 ?.)))



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

* Re: shr: alt text truncation
  2010-11-05  0:53 shr: alt text truncation Katsumi Yamaoka
@ 2010-11-05  1:07 ` Lars Magne Ingebrigtsen
  2010-11-05  8:22   ` Steinar Bang
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-11-05  1:07 UTC (permalink / raw)
  To: ding

Katsumi Yamaoka <yamaoka@jpl.org> writes:

> Is it really necessary?  Even so, can't the limit be extended to
> shr-width at least in a table?  For instance:

I added the limit because of tables, really.  :-)  I found that in my
test cases, the alt texts were typically the thing that took up most
space, because it's not uncommon to have obnoxiously long, but
nonsensical alt texts, and when rendering tables, this made many of them
somewhat unreadable.

So the limitation can be removed outside of tables, but not inside.  The
length (8) could probably be increased, though.  16?

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

* Re: shr: alt text truncation
  2010-11-05  1:07 ` Lars Magne Ingebrigtsen
@ 2010-11-05  8:22   ` Steinar Bang
  2010-11-08 20:32     ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 9+ messages in thread
From: Steinar Bang @ 2010-11-05  8:22 UTC (permalink / raw)
  To: ding

>>>>> Lars Magne Ingebrigtsen <larsi@gnus.org>:

> I added the limit because of tables, really.  :-) I found that in my
> test cases, the alt texts were typically the thing that took up most
> space, because it's not uncommon to have obnoxiously long, but
> nonsensical alt texts, and when rendering tables, this made many of
> them somewhat unreadable.

Couldn't you keep them out of the width calculation for the table
columns, but let them expand to the width determined by the other cells
in that column?

Or is that what you tried, that looked bad?






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

* Re: shr: alt text truncation
  2010-11-05  8:22   ` Steinar Bang
@ 2010-11-08 20:32     ` Lars Magne Ingebrigtsen
  2010-11-09  8:39       ` Steinar Bang
  0 siblings, 1 reply; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-11-08 20:32 UTC (permalink / raw)
  To: ding

Steinar Bang <sb@dod.no> writes:

> Couldn't you keep them out of the width calculation for the table
> columns, but let them expand to the width determined by the other cells
> in that column?
>
> Or is that what you tried, that looked bad?

I don't think it makes all that much difference.  The usual use case is
that you have a table with only an image in a <td>.  You have to use
something for the width, and the alt texts are often just the url
itself, so it's awkward.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

* Re: shr: alt text truncation
  2010-11-08 20:32     ` Lars Magne Ingebrigtsen
@ 2010-11-09  8:39       ` Steinar Bang
  2010-11-09 17:49         ` Lars Magne Ingebrigtsen
  2010-11-09 22:00         ` Ted Zlatanov
  0 siblings, 2 replies; 9+ messages in thread
From: Steinar Bang @ 2010-11-09  8:39 UTC (permalink / raw)
  To: ding

>>>>> Lars Magne Ingebrigtsen <larsi@gnus.org>:

> ..., and the alt texts are often just the url itself, so it's awkward.

In the early days of the web, 1994 or thereabouts, I experimented with
putting ASCII art versions of the image in tha alt attribute.

I was quickly told to stop doing that.






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

* Re: shr: alt text truncation
  2010-11-09  8:39       ` Steinar Bang
@ 2010-11-09 17:49         ` Lars Magne Ingebrigtsen
  2010-11-09 22:00         ` Ted Zlatanov
  1 sibling, 0 replies; 9+ messages in thread
From: Lars Magne Ingebrigtsen @ 2010-11-09 17:49 UTC (permalink / raw)
  To: ding

Steinar Bang <sb@dod.no> writes:

> In the early days of the web, 1994 or thereabouts, I experimented with
> putting ASCII art versions of the image in tha alt attribute.

Heh heh.

-- 
(domestic pets only, the antidote for overdose, milk.)
  larsi@gnus.org * Lars Magne Ingebrigtsen




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

* Re: shr: alt text truncation
  2010-11-09  8:39       ` Steinar Bang
  2010-11-09 17:49         ` Lars Magne Ingebrigtsen
@ 2010-11-09 22:00         ` Ted Zlatanov
  2010-11-09 23:00           ` Steinar Bang
  1 sibling, 1 reply; 9+ messages in thread
From: Ted Zlatanov @ 2010-11-09 22:00 UTC (permalink / raw)
  To: ding

On Tue, 09 Nov 2010 09:39:20 +0100 Steinar Bang <sb@dod.no> wrote: 

>>>>>> Lars Magne Ingebrigtsen <larsi@gnus.org>:
>> ..., and the alt texts are often just the url itself, so it's awkward.

SB> In the early days of the web, 1994 or thereabouts, I experimented with
SB> putting ASCII art versions of the image in tha alt attribute.

SB> I was quickly told to stop doing that.

Why?  You can probably get very close these days if you allow Unicode
glyphs :)

Ted




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

* Re: shr: alt text truncation
  2010-11-09 22:00         ` Ted Zlatanov
@ 2010-11-09 23:00           ` Steinar Bang
  2010-11-09 23:12             ` Rupert Swarbrick
  0 siblings, 1 reply; 9+ messages in thread
From: Steinar Bang @ 2010-11-09 23:00 UTC (permalink / raw)
  To: ding

>>>>> Ted Zlatanov <tzz@lifelogs.com>:

> On Tue, 09 Nov 2010 09:39:20 +0100 Steinar Bang <sb@dod.no> wrote: 
>>>>>>> Lars Magne Ingebrigtsen <larsi@gnus.org>:
>>> ..., and the alt texts are often just the url itself, so it's awkward.

SB> In the early days of the web, 1994 or thereabouts, I experimented with
SB> putting ASCII art versions of the image in tha alt attribute.

SB> I was quickly told to stop doing that.

> Why?

Well the argument used by one person was that he used lynx to read the
web pages, because it was fast.  And my ASCII art got in the way of the
fast aquiring of information.

Imagine that!




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

* Re: shr: alt text truncation
  2010-11-09 23:00           ` Steinar Bang
@ 2010-11-09 23:12             ` Rupert Swarbrick
  0 siblings, 0 replies; 9+ messages in thread
From: Rupert Swarbrick @ 2010-11-09 23:12 UTC (permalink / raw)
  To: ding

[-- Attachment #1: Type: text/plain, Size: 808 bytes --]

Steinar Bang <sb@dod.no> writes:
>>>>>> Ted Zlatanov <tzz@lifelogs.com>:
>
>> On Tue, 09 Nov 2010 09:39:20 +0100 Steinar Bang <sb@dod.no> wrote: 
>>>>>>>> Lars Magne Ingebrigtsen <larsi@gnus.org>:
>>>> ..., and the alt texts are often just the url itself, so it's awkward.
>
> SB> In the early days of the web, 1994 or thereabouts, I experimented with
> SB> putting ASCII art versions of the image in tha alt attribute.
>
> SB> I was quickly told to stop doing that.
>
>> Why?
>
> Well the argument used by one person was that he used lynx to read the
> web pages, because it was fast.  And my ASCII art got in the way of the
> fast aquiring of information.
>
> Imagine that!

Nowadays, I guess that screen-readers would have trouble too. "hyphen
hyphen slash slash slash..."

Rupert

[-- Attachment #2: Type: application/pgp-signature, Size: 315 bytes --]

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

end of thread, other threads:[~2010-11-09 23:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-05  0:53 shr: alt text truncation Katsumi Yamaoka
2010-11-05  1:07 ` Lars Magne Ingebrigtsen
2010-11-05  8:22   ` Steinar Bang
2010-11-08 20:32     ` Lars Magne Ingebrigtsen
2010-11-09  8:39       ` Steinar Bang
2010-11-09 17:49         ` Lars Magne Ingebrigtsen
2010-11-09 22:00         ` Ted Zlatanov
2010-11-09 23:00           ` Steinar Bang
2010-11-09 23:12             ` Rupert Swarbrick

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 NNTP newsgroup(s).