← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/fix_examples_XQDoc into lp:zorba

 

Sorin Marian Nasoi has proposed merging lp:~zorba-coders/zorba/fix_examples_XQDoc into lp:zorba.

Commit message:
- fixed examples links in the XQDoc documentation

Requested reviews:
  Chris Hillery (ceejatec)
  Sorin Marian Nasoi (sorin.marian.nasoi)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fix_examples_XQDoc/+merge/170878
-- 
https://code.launchpad.net/~zorba-coders/zorba/fix_examples_XQDoc/+merge/170878
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'doc/zorba/CMakeLists.txt'
--- doc/zorba/CMakeLists.txt	2013-02-07 17:24:36 +0000
+++ doc/zorba/CMakeLists.txt	2013-06-21 17:16:30 +0000
@@ -67,5 +67,5 @@
 # xqdoc generated API documentation
 ADD_SUBDIRECTORY(xqdoc)
 
-# make the xqdoc target as a dependee of the doc target
-ADD_DEPENDENCIES(doc "xqdoc")
+# make the xqdoc target as a dependency of the doc target
+ADD_DEPENDENCIES(doc "xqdoc")
\ No newline at end of file

=== modified file 'doc/zorba/xqdoc/images/modules_new.svg'
--- doc/zorba/xqdoc/images/modules_new.svg	2013-06-15 20:57:44 +0000
+++ doc/zorba/xqdoc/images/modules_new.svg	2013-06-21 17:16:30 +0000
@@ -144,10 +144,10 @@
 <text text-anchor="middle" x="774" y="-358.8" font-family="Times,serif" font-size="14.00">HMAC</text>
 </a>
 </g>
-<g id="graph25" class="cluster"><title>clusterZorbaCryptographyhash</title>
-<a xlink:title="Zorba/Cryptography/hash">
+<g id="graph25" class="cluster"><title>clusterZorbaCryptographyHash</title>
+<a xlink:title="Zorba/Cryptography/Hash">
 <polygon fill="lightsteelblue" stroke="black" points="657,-299 657,-374 727,-374 727,-299 657,-299"/>
-<text text-anchor="middle" x="692" y="-358.8" font-family="Times,serif" font-size="14.00">hash</text>
+<text text-anchor="middle" x="692" y="-358.8" font-family="Times,serif" font-size="14.00">Hash</text>
 </a>
 </g>
 <g id="graph26" class="cluster"><title>clusterZorbaDataCleaning</title>
@@ -1009,7 +1009,7 @@
 </g>
 <!-- 62 -->
 <g id="node42" class="node"><title>62</title>
-<a xlink:href="../modules_zorba_cryptography_hash.html" xlink:title="(External module) module uri=http://www.zorba-xquery.com/modules/cryptography/hash";>
+<a xlink:href="../modules_zorba_cryptography_Hash.html" xlink:title="(External module) module uri=http://www.zorba-xquery.com/modules/cryptography/hash";>
 <ellipse fill="white" stroke="white" cx="692" cy="-325" rx="27" ry="18"/>
 <text text-anchor="middle" x="692" y="-321.3" font-family="Times,serif" font-size="14.00" fill="green">hash</text>
 </a>

=== modified file 'doc/zorba/xqdoc/src/xqdoc-html.xq'
--- doc/zorba/xqdoc/src/xqdoc-html.xq	2013-06-15 20:57:44 +0000
+++ doc/zorba/xqdoc/src/xqdoc-html.xq	2013-06-21 17:16:30 +0000
@@ -44,25 +44,29 @@
   file:write($xqdocBuildPath || $slash || "schemas" || $slash || replace(replace($target-uri, "http://";, ""), "/", "_") || ".xsd" , $schema-doc, ())
 };
 
+file:create-directory($xqdocBuildPath || $slash ||  "examples");
 variable $manifest := parse-xml(file:read-text($zorbaManifestPath));
 for $module in $manifest/z:manifest/z:module
 let $uri := $module/z:uri/text()
 let $xqdoc := xqdoc:xqdoc($uri)
+let $module-name := tokenize($uri,"/")[last()]
 return {
   (: Copy Examples :)
   for $example in $xqdoc//xqd:custom[@tag="example"]/text()
-  let $source := $module/z:projectRoot/text() || file:directory-separator() || $example
-  let $destination := $xqdocBuildPath || file:directory-separator() || $example
+  let $source := $module/z:projectRoot/text() || $slash || $example
+  let $test-name := trace(tokenize($source,"/")[last()], "example-name")
+  let $destination := $xqdocBuildPath || $slash ||  "examples" || $slash || concat($module-name, "_", $test-name)
   let $base-dest := file:dir-name($destination)
   return {
-    file:copy($source, $xqdocBuildPath || file:directory-separator() || $example); 
+    file:create-directory($base-dest);
+    file:copy($source, $destination);
   }
 }
 
 (: XQDoc Batch :)
 let $static-folders := ("js", "css", "images")
-let $static-folders := for $static in $static-folders return $xhtmlRequisitesPath || file:directory-separator() || $static
-let $template := parse-xml(file:read-text($xhtmlRequisitesPath || file:directory-separator() || "template.xml"))/*
+let $static-folders := for $static in $static-folders return $xhtmlRequisitesPath || $slash || $static
+let $template := parse-xml(file:read-text($xhtmlRequisitesPath || $slash || "template.xml"))/*
 let $output-folder := $xqdocBuildPath
 let $modules := xqdoc-html:modules($manifest)
 return batch:build-xqdoc($output-folder, $static-folders, $template, $modules);

=== modified file 'modules/com/zorba-xquery/www/modules/xqdoc/html.xq'
--- modules/com/zorba-xquery/www/modules/xqdoc/html.xq	2013-06-15 16:20:18 +0000
+++ modules/com/zorba-xquery/www/modules/xqdoc/html.xq	2013-06-21 17:16:30 +0000
@@ -144,6 +144,7 @@
   </section>
   {
     let $examples := $module//xq:custom[@tag="example"]/text()
+    let $module-name := tokenize($module/xq:uri/text(),"/")[last()]
     return
       if(exists($examples)) then
         <section class="examples">
@@ -151,8 +152,8 @@
            <ul>
            {
              for $example in $examples
-             let $example := normalize-space($example)
-             return <li><a href="{$example}" class="example-link">{$example}</a></li>
+             let $example-name := tokenize($example,"/")[last()]
+             return <li><a href="{concat("examples/",$module-name,"_",$example-name)}" class="example-link">{$example-name}</a></li>
            }
            </ul>
         </section>
@@ -320,8 +321,9 @@
                 </section>
               else ()
             }
-            {
+            {(:
               let $examples := $function//xq:custom[@tag="example"]/text()
+              let $module-name := tokenize($module/xq:uri/text(),"/")[last()]
               return
                 if(exists($examples)) then
                   <section class="examples">
@@ -329,12 +331,12 @@
                      <ul>
                      {
                        for $example in $examples
-                       let $example := normalize-space($example)
-                       return <li><a href="{$example}">{$example}</a></li>
+                       let $example-name := tokenize($example,"/")[last()]
+                       return <li><a href="{concat("examples/",$module-name,"_",$example-name)}" class="example-link">{$example-name}</a></li>
                      }
                      </ul>
                   </section>
-                else ()
+                else ():)
             }
             {
               let $sees := $function/xq:comment/xq:see


Follow ups