[whatwg] Simple Links

  On 7/28/2010 6:22 AM, Eduard Pascual wrote:
> On Tue, Mar 30, 2010 at 11:44 PM, Christoph P?per
> <christoph.paeper at crissov.de>  wrote:
>> If you think about various syntax variants of wiki systems they?ve got one thing in common that makes them preferable to direct HTML input: easy links! (Local ones at least, whatever that means.) The best known example is probably double square brackets as in Mediawiki, the engine that powers the Wikimediaverse. A link to another article on the same wiki is as simple as ?[[Foo]]?, where HTML would have needed ?<a href="Foo">Foo</a>?.
>>
>> I wonder whether HTML could and should provide some sort of similar shortening, i.e. ?<a href>Foo</a>? or even, just maybe, ?<a>Foo</a>?. The UA would append the string content, properly encoded, to the base Web address as the hyperlink?s target, thus behave as had it encounters ?<a href="Foo">Foo</a>?.
>>
>> I prefer the binary toggle role of the ?href? attribute, although it doesn?t work well in the XML serialisation, because it provides better compatibility with existing content and when I see or write ?<a>Bar</a>? I rather think of the origin of that element name, ?anchor?. So I expect it to be equivalent to ?<a id>Bar</a>? and ?<a name>Bar</a>? which would be shortcuts for ?<a id="Bar">Bar</a>?.
>>
>> PS: Square brackets aren?t that simple actually, because on many keyboard layouts they?re not easy to input and might not be found on keytops at all.
>> PPS: The serialisation difference is not that important, because XML, unlike HTML, isn?t intended to be written by hand anyway.
> Can't this be handled with CSS' generated content? I'm not sure if
> I'll be getting the syntax right, but I think something like this:
>
> a[href]:empty { content: attr(href); }
> would pull the href from every empty<a>  that has such attribute (so
> it doesn't mess with anchor-only elements) and render it as the
> content of the element. Note that href attributes are resolved
> relative to what your<base>s define (this is slightly better than
> just "appending", since it makes '../whatever'-style URLs work the
> right way), so you don't need to (rather, should not) use absolute
> URLs for such links.
>
> It seems that you are only concerned about avoiding duplication of
> content for the href and the content of the element. Your proposal
> puts the stuff on the content, while the CSS-based solution would put
> it on the href; but both put it only once.
While it is a creative solution, something as basic as content of an 
href should not depend on CSS... CSS content is supposed to be reserved 
for decorative content.

I for one like the abbreviated syntax; a lot of times one does wish to 
make the link visible. I imagine the web would be full of such links.

Abbreviating to <a>...</a> wouldn't work as an abbrev for <a href> as 
the former is still used for anchors.

Brett

Received on Tuesday, 27 July 2010 22:11:46 UTC