Welcome! » Log In » Create A New Profile

AutoLink question | suggestion

Posted by Liquidice 
Liquidice
AutoLink question | suggestion
January 16, 2008 03:55PM

Is there a way to limit the length of the link so that the display part gets truncated... incase someone pastes a longgggg link that goes the whole width of the page or longer?

example: http://hey.omg/what.a/long/freaking/url/k.thx.html would end up being <a href="Full url" title="Full url for mouse over tooltip">http://hey.omg/what.a...</a>

If not, this is my feature request :)

Thanks ;]

Re: AutoLink question | suggestion
January 16, 2008 04:14PM

Unfortunately, no.

While I could implement this, I'm slightly concerned that this won't be enough. Other strings like thisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthisthis can be long and HTML Purifier wouldn't fix them.

Liquidice
Re: AutoLink question | suggestion
January 16, 2008 04:21PM

Though technically possible, I can't think of any reason a person would want to do that other than screwing around so it may not hurt to just inject a space character every $limit characters in a sequence without them.

What do you think? hmm Isn't there already line wrapping functionality built in? or does that wrap on spaces already?

Re: AutoLink question | suggestion
January 16, 2008 04:27PM

Line wrapping functionality is not built in, and it's a slightly touchy issue. For instance, it's not a good idea to wrap the contents of pre tags, where whitespace is significant. For things like inline images, it's impossible to regulate the length. There there's an issue of CSS properties like width and margin that can also interfere with it (and we can't just clip large values: they can accumulate and then stretch). It's not just a matter of making sure text wrap—which may incur severe performance penalties.

Text wrapping turns into shearing the yak. It may work for more restrictive sets of tags/attributes, but not for full-fledged pages.

I am of the opinion that the layout should be able to accommodate extremely long lines without messing up the rest of the layout. This usually means not using tables. :-)

Liquidice
Re: AutoLink question | suggestion
January 16, 2008 04:51PM

Ah right I see how that can complicate it right up lol...

I still consider being able to limit the display length of URLs a valid issue and believe it would be a helpful feature though, as pasting a URL into a forum is quite common and they're just plain ugly if they get too long.

I agree a site should be able to stretch – but stretching horizontally I think is rarely desirable as it can really screw up the proportions of a site in some cases. I think that's regardless of whether someone uses tables as nested elements can expand their parents.

Re: AutoLink question | suggestion
January 16, 2008 04:53PM

If the site is properly designed (monobook for Wikipedia comes to mind), the long text will go off the page, but the rest of the content won't be affected. I'll add the URL condensing to my todo list though. What would a sensible default length to truncate be?

Liquidice
Re: AutoLink question | suggestion
January 16, 2008 05:11PM

Yeah you're right, it goes off the containing element, doesn't expand it. Not quite as bad as messing up the design.

I think 40 would look good. People would be able to see the domain and part of the path in most cases :)

Author:
Your Email:

Subject:

HTML input is enabled. Make sure you escape all HTML and angled brackets with &lt; and &gt;.

Auto-paragraphing is enabled. Double newlines will be converted to paragraphs; for single newlines, use the pre tag.

Allowed tags: a, abbr, acronym, b, blockquote, caption, cite, code, dd, del, dfn, div, dl, dt, em, i, ins, kbd, li, ol, p, pre, s, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, var.

For inputting literal code such as HTML and PHP for display, use CDATA tags to auto-escape your angled brackets, and pre to preserve newlines:

<pre><![CDATA[
Place code here
]]></pre>

Power users, you can hide this notice with:

.htmlpurifier-help {display:none;}

Message: