Last active
August 29, 2015 14:01
-
-
Save grtjn/ac2767665de474492452 to your computer and use it in GitHub Desktop.
MarkLogic Kick-ass Awesome Thanks..
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xquery version "1.0-ml"; | |
declare namespace html = "http://www.w3.org/1999/xhtml"; | |
declare namespace xdmp = "http://marklogic.com/xdmp"; | |
declare function xdmp:tidy-mess($query) { | |
for $tweet in xdmp:tidy(xdmp:http-get(concat("https://twitter.com/search?q=", encode-for-uri($query)))[2])[2] | |
//html:div[string(@class) = 'content'] | |
return | |
<li xmlns="http://www.w3.org/1999/xhtml">{ | |
$tweet/*[not(data(@class) = ('stream-item-footer', 'cards-media-container', 'expanded-content', 'bottom-tweet-actions'))] | |
}</li> | |
}; | |
declare function xdmp:awesome() { | |
xdmp:tidy-mess("marklogic awesome") | |
}; | |
declare function xdmp:thanks() { | |
xdmp:tidy-mess("marklogic thanks") | |
}; | |
declare function xdmp:kick-ass() { | |
xdmp:tidy-mess("marklogic kick ass") | |
}; | |
declare function xdmp:rad() { | |
xdmp:tidy-mess("marklogic rapid application development") | |
}; | |
xdmp:set-response-content-type("text/html"), | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<style>.avatar {{ height: 2em; }}</style> | |
</head> | |
<body> | |
<h1>MarkLogic</h1> | |
<h2>RAD</h2> | |
<ul>{xdmp:rad()}</ul> | |
<h2>Awesome</h2> | |
<ul>{xdmp:awesome()}</ul> | |
<h2>Thanks</h2> | |
<ul>{xdmp:thanks()}</ul> | |
<h2>Kick-ass</h2> | |
<ul>{xdmp:kick-ass()}</ul> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Added xdmp:rad() upon special request by @wpaven..