cvs commit: cocoon-2.1/tools/src/anttasks XConfToolTask.java

2003-06-20 Thread jefft
jefft   2003/06/20 23:53:55

  Modified:src/targets webapp-build.xml
   tools/src blocks-build.xsl
   tools/src/anttasks XConfToolTask.java
  Log:
  Surround sitemap.xmap block snippets with comments indicating their origin:
  

  
  to make it easier for users to see what's what.  Off by default, only switched
  on for sitemap.xmap
  
  Revision  ChangesPath
  1.20  +3 -2  cocoon-2.1/src/targets/webapp-build.xml
  
  Index: webapp-build.xml
  ===
  RCS file: /home/cvs/cocoon-2.1/src/targets/webapp-build.xml,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- webapp-build.xml  5 Jun 2003 03:02:45 -   1.19
  +++ webapp-build.xml  21 Jun 2003 06:53:55 -  1.20
  @@ -84,7 +84,8 @@
   
   
  +includes="**/*.xconf"
  +addComments="true"/>
 
   
 
  @@ -166,7 +167,7 @@
  
  
   
  -
  +
  
   
   
  
  
  
  1.22  +2 -1  cocoon-2.1/tools/src/blocks-build.xsl
  
  Index: blocks-build.xsl
  ===
  RCS file: /home/cvs/cocoon-2.1/tools/src/blocks-build.xsl,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- blocks-build.xsl  26 May 2003 08:44:30 -  1.21
  +++ blocks-build.xsl  21 Jun 2003 06:53:55 -  1.22
  @@ -77,7 +77,8 @@
   
 

  + srcdir="{string('${blocks}')}"
  + addcomments="true">
   
  
  
  
  
  
  1.8   +31 -1 cocoon-2.1/tools/src/anttasks/XConfToolTask.java
  
  Index: XConfToolTask.java
  ===
  RCS file: /home/cvs/cocoon-2.1/tools/src/anttasks/XConfToolTask.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XConfToolTask.java5 Jun 2003 21:06:17 -   1.7
  +++ XConfToolTask.java21 Jun 2003 06:53:55 -  1.8
  @@ -93,9 +93,12 @@
*/
   public final class XConfToolTask extends MatchingTask {
   
  +private static final String NL=System.getProperty("line.separator");
  +private static final String FSEP=System.getProperty("file.separator");
   private File file;
   private File directory;
   private File srcdir;
  +private boolean addComments;
   /** for resolving entities such as dtds */
   private XMLCatalog xmlCatalog = new XMLCatalog();
   
  @@ -128,6 +131,14 @@
   }
   
   /**
  + * Whether to add a comment indicating where this block of code comes
  + * from.
  + */
  +public void setAddComments(Boolean addComments) {
  +this.addComments = addComments.booleanValue();
  +}
  +
  +/**
* Initialize internal instance of XMLCatalog
*/
   public void init() throws BuildException
  @@ -227,6 +238,7 @@
   Element elem = component.getDocumentElement();
   
   String extension = 
file.lastIndexOf(".")>0?file.substring(file.lastIndexOf(".")+1):"";
  +String basename = basename(file);
   
   if ( !elem.getTagName().equals(extension)) {
   log("Skipping non xconf-tool file: "+file);
  @@ -325,6 +337,10 @@
   log("Processing: "+file);
   NodeList componentNodes = 
component.getDocumentElement().getChildNodes();
   
  +if (this.addComments) {
  +root.appendChild(configuration.createComment(". Start 
configuration from '"+basename+"' "));
  +root.appendChild(configuration.createTextNode(NL));
  +}
   for (int i = 0; i

cvs commit: cocoon-2.1/tools/src/anttasks XConfToolTask.java

2003-06-06 Thread ghoward
ghoward 2003/06/05 14:06:17

  Modified:tools/src/anttasks XConfToolTask.java
  Log:
  fix logical condition when unless-path is not specified.
  
  Revision  ChangesPath
  1.7   +2 -2  cocoon-2.1/tools/src/anttasks/XConfToolTask.java
  
  Index: XConfToolTask.java
  ===
  RCS file: /home/cvs/cocoon-2.1/tools/src/anttasks/XConfToolTask.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- XConfToolTask.java5 Jun 2003 02:55:51 -   1.6
  +++ XConfToolTask.java5 Jun 2003 21:06:17 -   1.7
  @@ -248,7 +248,7 @@
   
   // Test that 'root' node satisfies 'component' insertion criteria
   String testPath = 
component.getDocumentElement().getAttribute("unless-path");
  -if (testPath == null) {
  +if (testPath == null || testPath.length()==0) {
   // only look for old "unless" attr if unless-path is not present
   testPath = component.getDocumentElement().getAttribute("unless");
   }
  
  
  


cvs commit: cocoon-2.1/tools/src/anttasks XConfToolTask.java

2003-06-04 Thread ghoward
ghoward 2003/06/04 19:55:51

  Modified:tools/src/anttasks XConfToolTask.java
  Log:
  Add "unless-path".  Functionally identical but clearer name than "unless".
  For back compat, unless is used when unless-path is not specified.
  
  Revision  ChangesPath
  1.6   +9 -4  cocoon-2.1/tools/src/anttasks/XConfToolTask.java
  
  Index: XConfToolTask.java
  ===
  RCS file: /home/cvs/cocoon-2.1/tools/src/anttasks/XConfToolTask.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XConfToolTask.java23 May 2003 02:48:03 -  1.5
  +++ XConfToolTask.java5 Jun 2003 02:55:51 -   1.6
  @@ -247,15 +247,20 @@
   Node root = nodes.item(0);
   
   // Test that 'root' node satisfies 'component' insertion criteria
  -String test = component.getDocumentElement().getAttribute("unless");
  +String testPath = 
component.getDocumentElement().getAttribute("unless-path");
  +if (testPath == null) {
  +// only look for old "unless" attr if unless-path is not present
  +testPath = component.getDocumentElement().getAttribute("unless");
  +}
  +// Is if-path needed?
   String ifProp = component.getDocumentElement().getAttribute("if-prop");
   boolean ifValue = 
Boolean.valueOf(project.getProperty(ifProp)).booleanValue();

   if (ifProp != null && (ifProp.length()>0) && !ifValue ) {
   log("Skipping: " + file, Project.MSG_DEBUG);
   return false;
  -} else if ((test!=null) && (test.length()>0) &&
  -(XPathAPI.selectNodeList(root, test).getLength()!=0)) {
  +} else if ((testPath!=null) && (testPath.length()>0) &&
  +(XPathAPI.selectNodeList(root, testPath).getLength()!=0)) {
   log("Skipping: " + file, Project.MSG_DEBUG);
   return false;
   } else {