rubys       01/10/27 19:48:48

  Modified:    proposal/gump/java Project.java Workspace.java
               proposal/gump/stylesheet xref.xsl
  Log:
  More progress towards supporting of publishing of javadocs.  Now able to
  support "self publishing" (i.e., file:/// urls).
  
  Revision  Changes    Path
  1.12      +32 -11    jakarta-alexandria/proposal/gump/java/Project.java
  
  Index: Project.java
  ===================================================================
  RCS file: /home/cvs/jakarta-alexandria/proposal/gump/java/Project.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Project.java      2001/10/27 14:57:17     1.11
  +++ Project.java      2001/10/28 02:48:48     1.12
  @@ -354,40 +354,61 @@
       private void resolveJavadoc(Element javadoc) throws Exception {
           if (javadoc == null) return;
   
  +        // retrieve href and dir of javadoc from the workspace
  +        Element config = Workspace.getJavaDoc();
  +        if (config == null) return;
  +        String href = config.getAttribute("href");
  +        String javadocDir = config.getAttribute("dir");
  +
  +        // default project attribute to the name of this project
           if (javadoc.getAttributeNode("project") == null)
               javadoc.setAttribute("project", name);
   
  +        // default module attribute to the module which this project belongs
           String moduleName = javadoc.getAttribute("module");
           if (moduleName.equals("")) moduleName = this.get("module");
           Module module = Module.find(moduleName);
           require (module, "module", moduleName);
   
  +        // if there are no child nodes, add this project's description
           if (!javadoc.hasChildNodes() && description!=null) {
               javadoc.appendChild(description.cloneNode(true));
           }
   
  -        String path;
  -        if (javadoc.getAttributeNode("nested") != null) {
  -            path = get("srcdir");
  -            path += "/" + javadoc.getAttribute("nested");
  +        // resolve relative and full path to this javadoc entry
  +        String path = javadoc.getAttribute("nested");
  +        String fullpath;
  +        if (!path.equals("")) {
  +            fullpath = get("srcdir") + "/" + path;
           } else {
  -            path = Workspace.getBaseDir();
  -            path += "/" + javadoc.getAttribute("parent");
  +            path = javadoc.getAttribute("parent");
  +            fullpath = Workspace.getBaseDir() + "/" + path;
           }
   
  +        // for each description entry, resolve source, href, and dest attrs.
           Node child=javadoc.getFirstChild();
           for (; child != null; child=child.getNextSibling()) {
               if (child.getNodeName().equals("description")) {
  -                Element description = (Element) child;
  -                String dir = description.getAttribute("dir");
  -                if (dir.equals("")) {
  -                    description.setAttribute("path", path);
  +                Element desc = (Element) child;
  +                String dir = desc.getAttribute("dir");
  +                String append = "";
  +                if (!dir.equals("")) append = "/" + dir;
  +
  +                desc.setAttribute("source", fullpath + append);
  +
  +                if (href.equals("")) {
  +                    desc.setAttribute("href", "file:///" + fullpath);
                   } else {
  -                    description.setAttribute("path", path + "/" + dir);
  +                    desc.setAttribute("href", href + path + append);
  +                }
  +
  +                if (!javadocDir.equals("")) {
  +                    desc.setAttribute("dest", javadocDir + path + append);
                   }
               }
           }
   
  +        // copy the entire result to the desired module
           module.appendChild(javadoc);
       }
   
  
  
  
  1.2       +17 -0     jakarta-alexandria/proposal/gump/java/Workspace.java
  
  Index: Workspace.java
  ===================================================================
  RCS file: /home/cvs/jakarta-alexandria/proposal/gump/java/Workspace.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Workspace.java    2001/09/30 14:46:59     1.1
  +++ Workspace.java    2001/10/28 02:48:48     1.2
  @@ -1,4 +1,5 @@
   import org.w3c.dom.Element;
  +import org.w3c.dom.Node;
   
   public class Workspace {
   
  @@ -6,6 +7,7 @@
   
       private static Element element;
       private static String basedir;
  +    private static Element javadoc;
   
       /**
        * Static property accessor for basedir attribute.
  @@ -24,6 +26,14 @@
       }
   
       /**
  +     * Static property accessor for javadoc element.
  +     * @return Javadoc element (if any) associated with this workspace
  +     */
  +    public static Element getJavaDoc() {
  +        return javadoc;
  +    }
  +
  +    /**
        * Default and verify various workspace attributes.
        * If not specified:
        *   banner-image="http://jakarta.apache.org/images/jakarta-logo.gif";
  @@ -62,6 +72,13 @@
   
           if (workspace.getAttribute("pkgdir").equals("")) {
               workspace.setAttribute("pkgdir", basedir);
  +        }
  +
  +        Node child=element.getFirstChild();
  +        for (; child != null; child=child.getNextSibling()) {
  +            if (child.getNodeName().equals("javadoc")) {
  +                javadoc = (Element) child;
  +            }
           }
       }
   }
  
  
  
  1.16      +3 -3      jakarta-alexandria/proposal/gump/stylesheet/xref.xsl
  
  Index: xref.xsl
  ===================================================================
  RCS file: /home/cvs/jakarta-alexandria/proposal/gump/stylesheet/xref.xsl,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- xref.xsl  2001/10/27 14:57:18     1.15
  +++ xref.xsl  2001/10/28 02:48:48     1.16
  @@ -391,7 +391,7 @@
                        <xsl:if test="javadoc[@project!=$name]">
                          <xsl:for-each select="javadoc/description">
                            <xsl:sort select="../@project"/>
  -                         <a href="{@path}/index.html">
  +                         <a href="{@href}/index.html">
                              <xsl:value-of select="../@project"/>
                            </a>
                            <xsl:text> - </xsl:text>
  @@ -403,7 +403,7 @@
                        <!-- Multiple javadocs all from the same project -->
                        <xsl:if test="not(javadoc[@project!=$name])">
                          <xsl:for-each select="javadoc/description">
  -                         <a href="{@path}/index.html">
  +                         <a href="{@href}/index.html">
                              <xsl:value-of select="normalize-space(.)"/>
                            </a>
                            <br/>
  @@ -414,7 +414,7 @@
                    <xsl:otherwise>
   
                      <!-- Single javadoc -->
  -                   <a href="{javadoc/description/@path}/index.html">
  +                   <a href="{javadoc/description/@href}/index.html">
                        <xsl:value-of select="@name"/>
                      </a>
                      <xsl:text> - </xsl:text>
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to