Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Chris Houston 535 posts 980 karma points MVP admin c-trib
    Nov 10, 2009 @ 18:52
    Chris Houston
    0

    Allow support for multiple links within Tweets :)

    Hi Warren,

    I have a tweet with two @links, the first one gets turned into a link by your "FormatURLS" function but the second one just stays as plain text.

    Cheers,

    Chris

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Nov 10, 2009 @ 19:24
    Dirk De Grave
    0

    Oh no, I've told warren ages ago about that, did even sent him some code to replace multiple @'s. Guess he didn't really like my code :p

  • Chris Houston 535 posts 980 karma points MVP admin c-trib
    Nov 13, 2009 @ 17:23
    Chris Houston
    0

    Hi Warren,

    This works, of course you could hide the functionality within your DLL if you prefer or just use this XSLT.

    This will work for:

    URL's ( both HTTP & HTTPS )
    @names
    #Tags ( Links to the Twitter search page )

    In your main template where you want to output the encoded text you put this call-template:

    <xsl:call-template name="formaturl">
     <xsl:with-param name="url" select="text"/>
    </xsl:call-template>

    Then the template it calls is:

       <xsl:template name="formaturl">
         <xsl:param name="url"/>
         <xsl:variable name="transform-http" select="Exslt.ExsltRegularExpressions:replace($url, '(http\:\/\/\S+)',ig,'&lt;a href=&quot;$1&quot;&gt;$1&lt;/a&gt;')"/>
         <xsl:variable name="transform-https" select="Exslt.ExsltRegularExpressions:replace($transform-http, '(HTTps\:\/\/\S+)',ig,'&lt;a href=&quot;$1&quot;&gt;$1&lt;/a&gt;')"/>
         <xsl:variable name="transform-AT" select="Exslt.ExsltRegularExpressions:replace($transform-https, '(^|\s)@(\w+)',ig,' &lt;a href=&quot;http://www.twitter.com/$2&quot;&gt;@$2&lt;/a&gt;')"/>
         <xsl:variable name="transform-HASH" select="Exslt.ExsltRegularExpressions:replace($transform-AT, '(^|\s)#(\w+)',ig,' &lt;a href=&quot;http://www.twitter.com/search?q=$2&quot;&gt;#$2&lt;/a&gt;')"/>
         <xsl:value-of select="$transform-HASH" disable-output-escaping="yes"/>
       </xsl:template>

    I hope that helps :)

    Cheers,

    Chris

  • Chris Houston 535 posts 980 karma points MVP admin c-trib
    Dec 08, 2009 @ 02:53
    Chris Houston
    0

    I have just submitted a patched version of the code for Warren to publish, so this issue should be fixed very soon :)

    Cheers,

    Chris

  • Warren Buckley 2106 posts 4836 karma points MVP ∞ admin hq c-trib
    Dec 08, 2009 @ 18:28
    Warren Buckley
    0

    Yep I have seen Chris's patch for this and in the process of implemeting, testing & packaging up.

    Will be out tomorrow :)

Please Sign in or register to post replies

Write your reply to:

Draft