xfn-spider

changeset 9:8a30b90da375 tip

Attempts to implement proper parsing of non-absolute links.
author Dmitry Dzhus <mail@sphinx.net.ru>
date Wed Jul 04 21:25:41 2007 +0400 (3 years ago)
parents d09421b8f11e
children
files TODO make-manyeyes-network.xsl mf-extract.xsl
line diff
1.1 --- a/TODO Wed Jul 04 13:09:43 2007 +0400 1.2 +++ b/TODO Wed Jul 04 21:25:41 2007 +0400 1.3 @@ -4,6 +4,13 @@ 1.4 CLOSED: [2007-07-03 Втр 10:44] 1.5 For example, `rel="cosmetics"` matches current patterns while it 1.6 doesn't comply with XFN format. 1.7 +* TODO Improper handling of relative links :bug: 1.8 + E.g. <a href="/author">Link</a> on a site with URL 1.9 + http://test.com/blog/latest/ will be extracted and treated as 1.10 + http://test.com/blog/latest/author instead of 1.11 + http://test.com/author. 1.12 + 1.13 + Current solution is to ignore non-absolute links at all. 1.14 * TODO [#B] Respect hCard 1.15 * DONE [#C] Tags must be lowercased 1.16 CLOSED: [2007-06-30 Сбт 21:14]
2.1 --- a/make-manyeyes-network.xsl Wed Jul 04 13:09:43 2007 +0400 2.2 +++ b/make-manyeyes-network.xsl Wed Jul 04 21:25:41 2007 +0400 2.3 @@ -32,8 +32,8 @@ 2.4 <xsl:template name="label-by-url"> 2.5 <xsl:param name="url" /> 2.6 <xsl:choose> 2.7 - <xsl:when test="string-length(//site[@url=$url]/title) > 0"> 2.8 - <xsl:value-of select="//site[@url=$url]/title" /> 2.9 + <xsl:when test="string-length(//site[contains($url, @url)]/title) > 0"> 2.10 + <xsl:value-of select="//site[contains($url, @url)]/title" /> 2.11 </xsl:when> 2.12 <xsl:otherwise> 2.13 <xsl:value-of select="@url" />
3.1 --- a/mf-extract.xsl Wed Jul 04 13:09:43 2007 +0400 3.2 +++ b/mf-extract.xsl Wed Jul 04 21:25:41 2007 +0400 3.3 @@ -75,7 +75,14 @@ 3.4 <xsl:template name="xfn-link"> 3.5 <rel> 3.6 <xsl:attribute name="url"> 3.7 - <xsl:value-of select="@href" /> 3.8 + <xsl:choose> 3.9 + <xsl:when test="starts-with(@href, 'http://')"> 3.10 + <xsl:value-of select="@href" /> 3.11 + </xsl:when> 3.12 + <xsl:otherwise> 3.13 + <xsl:value-of select="concat($site-url, @href)" /> 3.14 + </xsl:otherwise> 3.15 + </xsl:choose> 3.16 </xsl:attribute> 3.17 <xsl:attribute name="type"> 3.18 <xsl:value-of select="@rel" />