Skip to content

Commit

Permalink
factored out the one href remaining (article)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuno Job committed Apr 15, 2010
1 parent 8c5ca2e commit d033c07
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.xqy
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ xdmp:set-response-content-type( "application/xhtml+xml" ),
</div><br/> </div><br/>
<h2>Listing Posts</h2> <h2>Listing Posts</h2>
<dl> { for $a in fn:doc() [1 to 10] <dl> { for $a in fn:doc() [1 to 10]
let $permalink := fn:concat('show.xqy?uri=', fn:document-uri($a)) let $permalink := h:link_to_show( fn:document-uri($a) )
let $snippet := fn:string-join( let $snippet := fn:string-join(
fn:tokenize(fn:string($a//*:body), " ")[1 to 20], " ") fn:tokenize(fn:string($a//*:body), " ")[1 to 20], " ")
return return
Expand Down
5 changes: 4 additions & 1 deletion lib/helpers.xqy
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -6,4 +6,7 @@ declare function h:link_to_index() {
<a href="index.xqy" xmlns="http://www.w3.org/1999/xhtml">Back to main</a> } ; <a href="index.xqy" xmlns="http://www.w3.org/1999/xhtml">Back to main</a> } ;


declare function h:link_to_new() { declare function h:link_to_new() {
<a href="new.xqy" xmlns="http://www.w3.org/1999/xhtml">Add new</a> } ; <a href="new.xqy" xmlns="http://www.w3.org/1999/xhtml">Add new</a> } ;

declare function h:link_to_show( $path ) {
fn:concat( 'show.xqy?uri=', $path ) };

0 comments on commit d033c07

Please sign in to comment.