Re: [whatwg] Simple Links
On Tue, Jul 27, 2010 at 3:13 PM, Ian Hickson i...@hixie.ch wrote: I also randomly picked a Wikipedia page (Potato) and looked at some of th= e links there. The only link that matched that pattern on the whole page wa= s in the footer that only gets displayed in the print media: =C2=A0 div class=3Dprintfooter Retrieved from a href=3Dhttp://en.w= ikipedia.org/wiki/Potatohttp://en.wikipedia.org/wiki/Potato/a/div It's also presented to unknown UAs (as Wikimedia assumes they're dumb bots). For what it's worth, this is because the href's in the articles themselves have /wiki/ prepended (a href=3D/wiki/Potato, not a href=3DPotato). In turn, this is because the pages can actually be served from multiple directories: http://en.wikipedia.org/wiki/Potato is the same as http://en.wikipedia.org/w/index.php?title=3DPotato. (There are actually some differences at the moment if you do a diff, but that's because they're cached separately by Squid. If you log in, the differences should disappear.) So href=3DPotato would do the wrong thing in the latter case. Indeed, in a dynamic web application, something like href=3DPotato is practically useless unless you can guarantee that you're always rewriting URLs to look pretty and conceal the actual script serving the request. So in particular, MediaWiki could not use the proposed a href syntax. I consider the equivalence of /wiki/Potato and /w/index.php?title=Potato a bug. Metadata such as the URI of the document can be served by various means, such as the Location header in HTTP, and a seperate base URI to use for relative linking can be specified with the base element in HTML. Ian Hickson: On Tue, 30 Mar 2010, Christoph P=E4per wrote: I wonder whether HTML could and should provide some sort of similar = shortening, i.e. =93a hrefFoo/a=94 or even, just maybe, = =93aFoo/a=94. I later came to the conclusion that this might be a nice thing for HTML = editors, but not for browsers.=20 If nothing else, it would probably be abused for comment spam, because = there probably are scripts out there that do not filter =91href=92-less = =91a=92-elements. The UA would append the string content, properly encoded, to the base = Web address as the hyperlink=92s target, =85 =20 I (=85) couldn't find any pages that matched the pattern a = href=3D(.+)$1/a, =85 Um, that=92s not exactly what I meant, note =93append =85 to the base = Web address=94. These are conversions I had in mind, assuming the location = https://example.com/Bar/baz.html: derived href value a hrefFoo/a=3D /Bar/Foo or ./Foo or Foo a hrefFoo.html/a =3D /Bar/Foo.html or ./Foo.html or = Foo.html a hrefFoo.com/a=3D /Bar/Foo.com or ./Foo.com or Foo.com a hrefFoo//a =3D /Bar/Foo/ or ./Foo/ or Foo/ a href/Foo/a =3D /Foo a href#Foo/a =3D #Foo a href//a =3D / a hrefhttp://Foo.com/a =3D http://foo.com a href://Foo.com/a =3D https://foo.com (?)= According to RFC 3986, section 4.2, the first component of a relative reference can't contain a colon (':'). The last example should be: a href//Foo.com/a https://foo.com We don't need to define a new append algorithm, relative [IU]RI references are powerful enaugh.
Re: [whatwg] Simple Links
On Tue, Jul 27, 2010 at 3:13 PM, Ian Hickson i...@hixie.ch wrote: I also randomly picked a Wikipedia page (Potato) and looked at some of the links there. The only link that matched that pattern on the whole page was in the footer that only gets displayed in the print media: div class=printfooter Retrieved from a href=http://en.wikipedia.org/wiki/Potato;http://en.wikipedia.org/wiki/Potato/a/div For what it's worth, this is because the href's in the articles themselves have /wiki/ prepended (a href=/wiki/Potato, not a href=Potato). In turn, this is because the pages can actually be served from multiple directories: http://en.wikipedia.org/wiki/Potato is the same as http://en.wikipedia.org/w/index.php?title=Potato. (There are actually some differences at the moment if you do a diff, but that's because they're cached separately by Squid. If you log in, the differences should disappear.) So href=Potato would do the wrong thing in the latter case. Indeed, in a dynamic web application, something like href=Potato is practically useless unless you can guarantee that you're always rewriting URLs to look pretty and conceal the actual script serving the request. So in particular, MediaWiki could not use the proposed a href syntax.
Re: [whatwg] Simple Links
On Tue, 30 Mar 2010, Christoph P�per 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=FooFoo/a�. HTML would actually need more, since you also need to add a class for indicating whether the page at the end of the link is available or not. I wonder whether HTML could and should provide some sort of similar shortening, i.e. �a hrefFoo/a� or even, just maybe, �aFoo/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=FooFoo/a�. I looked at some pages that I use regularly, and couldn't find any pages that matched the pattern a href=(.+)$1/a, so I don't know that that is that much of an improvement. I also randomly picked a Wikipedia page (Potato) and looked at some of the links there. The only link that matched that pattern on the whole page was in the footer that only gets displayed in the print media: div class=printfooter Retrieved from a href=http://en.wikipedia.org/wiki/Potato;http://en.wikipedia.org/wiki/Potato/a/div I'm not sure it's really worth it to make a syntax change just to handle the case of a link's text itself being a URL, since most of the time that kind of link will be autogenerated anyway. I haven't changed the spec. -- Ian Hickson U+1047E)\._.,--,'``.fL http://ln.hixie.ch/ U+263A/, _.. \ _\ ;`._ ,. Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Re: [whatwg] Simple Links
Ian Hickson: On Tue, 30 Mar 2010, Christoph Päper wrote: I wonder whether HTML could and should provide some sort of similar shortening, i.e. “a hrefFoo/a” or even, just maybe, “aFoo/a”. I later came to the conclusion that this might be a nice thing for HTML editors, but not for browsers. If nothing else, it would probably be abused for comment spam, because there probably are scripts out there that do not filter ‘href’-less ‘a’-elements. The UA would append the string content, properly encoded, to the base Web address as the hyperlink’s target, … I (…) couldn't find any pages that matched the pattern a href=(.+)$1/a, … Um, that’s not exactly what I meant, note “append … to the base Web address”. These are conversions I had in mind, assuming the location https://example.com/Bar/baz.html: derived href value a hrefFoo/a= /Bar/Foo or ./Foo or Foo a hrefFoo.html/a = /Bar/Foo.html or ./Foo.html or Foo.html a hrefFoo.com/a= /Bar/Foo.com or ./Foo.com or Foo.com a hrefFoo//a = /Bar/Foo/ or ./Foo/ or Foo/ a href/Foo/a = /Foo a href#Foo/a = #Foo a href//a = / a hrefhttp://Foo.com/a = http://foo.com a href://Foo.com/a = https://foo.com (?)
Re: [whatwg] Simple Links
On Tue, Mar 30, 2010 at 11:44 PM, Christoph Päper christoph.pae...@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=FooFoo/a”. I wonder whether HTML could and should provide some sort of similar shortening, i.e. “a hrefFoo/a” or even, just maybe, “aFoo/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=FooFoo/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 “aBar/a” I rather think of the origin of that element name, ‘anchor’. So I expect it to be equivalent to “a idBar/a” and “a nameBar/a” which would be shortcuts for “a id=BarBar/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 bases 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. Regards, Eduard Pascual
Re: [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.pae...@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=FooFoo/a”. I wonder whether HTML could and should provide some sort of similar shortening, i.e. “a hrefFoo/a” or even, just maybe, “aFoo/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=FooFoo/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 “aBar/a” I rather think of the origin of that element name, ‘anchor’. So I expect it to be equivalent to “a idBar/a” and “a nameBar/a” which would be shortcuts for “a id=BarBar/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 emptya 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 yourbases 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
Re: [whatwg] Simple Links
On Tue, 2010-03-30 at 23:44 +0200, Christoph Päper 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=FooFoo/a”. I wonder whether HTML could and should provide some sort of similar shortening, i.e. “a hrefFoo/a” or even, just maybe, “aFoo/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=FooFoo/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 “aBar/a” I rather think of the origin of that element name, ‘anchor’. So I expect it to be equivalent to “a idBar/a” and “a nameBar/a” which would be shortcuts for “a id=BarBar/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. I think to me afoo/a would indicate it is a named anchor in a page. Are all UA's intelligent enough to be able to accurately recognise any form of URL? Also, in XHTML the tag would look like a href=hreffoo/a. And, shouldn't links be as semantic as possible? Consider these two: * find the latest spec at a href=http://www.somespecsite.com;http://www.somespecsite.com/a * get a href=http://www.somespecsite.com;the latest spec/a In my opinion, the second one is far more semantic, and is what I prefer to use on anything I put together. The HTML spec should encourage the best practices, and making shorter link tags that actually take a step backwards in the world of semantic markup just seems a little foolish. Thanks, Ash http://www.ashleysheridan.co.uk