Monday, November 08, 2010 at 12:01 AM.
system.verbs.apps.trackback.getAutodiscoveryXml
on getAutodiscoveryXml (permalinkUrl, pingUrl, title="", subject="", description="", author="", postdate="") {
<<Changes
<<5/1/03; 12:57:03 PM by JES
<<Created. Get the RDF snippet for Trackback auto-discovery.
<<Parameters:
<<permalinkUrl -- the permalinkUrl for the post
<<pingUrl -- the URL to ping when sending a Trackback ping to this post
<<title -- the title of the post -- default is the empty string
<<Sample RDF snippet:
<<<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
<<<rdf:Description rdf:about="http://www.foo.com/archive.html#foo" dc:identifer="http://www.foo.com/archive.html#foo" dc:title="Foo Bar" trackback:ping="http://www.foo.com/tb.cgi/5" />
<<</rdf:RDF>
local (xtext);
on add (s) {
xtext = xtext + (s + "\r");};
on entityEncode (s) {
s = string.replaceAll (s, "&", "&");
s = string.replaceAll (s, "<", "<");
s = string.replaceAll (s, ">", ">");
s = string.replaceAll (s, "\"", """);
s = string.replaceAll (s, "\'", "'");
return (s)};
on getShortString (s) {
if sizeOf (s) > 255 {
local (ix = 252);
loop {
if s[ix] == ' ' {
s = string.mid (s, 1, ix - 1);
break};
if ix == 1 {
break};
ix--};
s = s + "..."};
return (s)};
if sizeOf (pingUrl) == 0 { //assume we ping the permalinkUrl
pingUrl = permalinkUrl};
local (rdfns = "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
local (dcns = "http://purl.org/dc/elements/1.1/");
local (tbns = "http://madskills.com/public/xml/rss/module/trackback/");
local (atts = "");
bundle { //build atts
atts = atts + "\r\trdf:about=\"" + entityEncode (permalinkUrl) + "\"";
atts = atts + "\r\tdc:identifier=\"" + entityEncode (permalinkUrl) + "\"";
atts = atts + "\r\tdc:title=\"" + entityEncode (title) + "\"";
atts = atts + "\r\ttrackback:ping=\"" + entityEncode (pingUrl) + "\""};
bundle { //if supplied, add subject, description, author and date to atts
if sizeOf (subject) > 0 {
atts = atts + "\r\tdc:subject=\"" + entityEncode (subject) + "\""};
if sizeOf (author) > 0 {
atts = atts + "\r\tdc:creator=\"" + entityEncode (author) + "\""};
if sizeOf (description) > 0 {
atts = atts + "\r\tdc:description=\"" + entityEncode (getShortString (description)) + "\""};
if sizeOf (postdate) > 0 {
atts = atts + "\r\tdc:date=\"" + date.dateToIso8601String (postdate) + "\""}};
add ("<rdf:RDF xmlns:rdf=\"" + rdfns + "\"\r\txmlns:dc=\"" + dcns + "\"\r\txmlns:trackback=\"" + tbns + "\">");
add ("<rdf:Description " + atts + " />");
add ("</rdf:RDF>");
return (xtext)}
<<bundle //test code
<<wp.newTextObject (getAutodiscoveryXml ("http://jake.userland.com/2002/04/01.html#a123", "http://radio.xmlsotragesystem.com/trackbackPing?u=0001000&p=123", postDate:clock.now (), description:"<b>Foo</b>\r\r<i>bar</i>"), @workspace.xtext)
<<edit (@workspace.xtext)
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.