You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by cz...@apache.org on 2004/07/02 11:49:14 UTC

cvs commit: cocoon-2.1/src/java/org/apache/cocoon/generation CalendarGenerator.java

cziegeler    2004/07/02 02:49:14

  Modified:    tools/src/anttasks SitemapTask.java DocumentCache.java
               src/java/org/apache/cocoon/generation CalendarGenerator.java
  Log:
  Fix doc generation problems
  
  Revision  Changes    Path
  1.17      +10 -3     cocoon-2.1/tools/src/anttasks/SitemapTask.java
  
  Index: SitemapTask.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/tools/src/anttasks/SitemapTask.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- SitemapTask.java	26 May 2004 13:12:40 -0000	1.16
  +++ SitemapTask.java	2 Jul 2004 09:49:14 -0000	1.17
  @@ -16,6 +16,7 @@
   
   import java.io.File;
   import java.io.IOException;
  +import java.net.MalformedURLException;
   import java.util.ArrayList;
   import java.util.HashMap;
   import java.util.Iterator;
  @@ -464,7 +465,7 @@
               String configuration = this.getTagValue(CONF_TAG, null);
               if ( configuration != null ) {
                   configuration = "<root>" + configuration + "</root>";
  -                final Document confDoc = DocumentCache.getDocument(configuration);
  +                final Document confDoc = DocumentCache.getDocument(configuration, null);
                   setValue(node, null, confDoc.getDocumentElement().getChildNodes());
               }
   
  @@ -507,7 +508,13 @@
               
               // append root element and surrounding paragraph
               final String description = "<root><p>" + doc + "</p></root>";
  -            final Document descriptionDoc = DocumentCache.getDocument(description);
  +            String systemURI = null;
  +            try {
  +                systemURI = docFile.toURL().toExternalForm();
  +            } catch (MalformedURLException mue) {
  +                // we ignore this
  +            }
  +            final Document descriptionDoc = DocumentCache.getDocument(description, systemURI);
               
               // Title
               setValue(template, "/document/header/title", 
  
  
  
  1.6       +6 -3      cocoon-2.1/tools/src/anttasks/DocumentCache.java
  
  Index: DocumentCache.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/tools/src/anttasks/DocumentCache.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DocumentCache.java	3 May 2004 09:00:28 -0000	1.5
  +++ DocumentCache.java	2 Jul 2004 09:49:14 -0000	1.6
  @@ -97,12 +97,15 @@
           return document;
       }
       
  -    public static Document getDocument(String string) {
  +    public static Document getDocument(String string, String systemURI) {
           try {
               final InputSource is = new InputSource(new StringReader(string));
  +            if ( systemURI != null ) {
  +                is.setSystemId(systemURI);
  +            }
               return builder.parse(is);
           } catch (Exception e) {
  -            throw new BuildException("Unable to parse string.");
  +            throw new BuildException("Unable to parse string.", e);
           }
       }
       
  
  
  
  1.11      +14 -13    cocoon-2.1/src/java/org/apache/cocoon/generation/CalendarGenerator.java
  
  Index: CalendarGenerator.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/java/org/apache/cocoon/generation/CalendarGenerator.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- CalendarGenerator.java	29 Jun 2004 20:33:38 -0000	1.10
  +++ CalendarGenerator.java	2 Jul 2004 09:49:14 -0000	1.11
  @@ -41,6 +41,7 @@
    * Generates an XML document representing a calendar for a given month and year.
    * <p>
    * Here is a sample output:
  + * </p>
    * <pre>
    * &lt;calendar:calendar xmlns:calendar="http://apache.org/cocoon/calendar/1.0"
    *     year="2004" month="January" prevMonth="12" prevYear="2003"
  @@ -60,22 +61,22 @@
    * <p>
    *  <b>Configuration options:</b>
    *  <dl>
  - *   <dt> <i>month</i> (optional)
  - *   <dd> Sets the month for the calendar (January is 1). Default is the current month.
  - *   <dt> <i>year</i> (optional)
  - *   <dd> Sets the year for the calendar. Default is the current year.
  - *   <dt> <i>dateFormat</i> (optional)
  + *   <dt> <i>month</i> (optional)</dt>
  + *   <dd> Sets the month for the calendar (January is 1). Default is the current month.</dd>
  + *   <dt> <i>year</i> (optional)</dt>
  + *   <dd> Sets the year for the calendar. Default is the current year.</dd>
  + *   <dt> <i>dateFormat</i> (optional)</dt>
    *   <dd> Sets the format for the date attribute of each node, as
    *        described in java.text.SimpleDateFormat. If unset, the default
  - *        format for the current locale will be used.
  - *   <dt> <i>lang</i> (optional)
  - *   <dd> Sets the ISO language code for determining the locale.
  - *   <dt> <i>country</i> (optional)
  - *   <dd> Sets the ISO country code for determining the locale.
  - *   <dt> <i>padWeeks</i> (optional)
  + *        format for the current locale will be used.</dd>
  + *   <dt> <i>lang</i> (optional)</dt>
  + *   <dd> Sets the ISO language code for determining the locale.</dd>
  + *   <dt> <i>country</i> (optional)</dt>
  + *   <dd> Sets the ISO country code for determining the locale.</dd>
  + *   <dt> <i>padWeeks</i> (optional)</dt>
    *   <dd> If set to true, full weeks will be generated by adding
    *        days from the end of the previous month and the beginning
  - *        of the following month.
  + *        of the following month.</dd>
    *  </dl>
    * </p>
    *