/[classpath]/gjdoc/src/gnu/classpath/tools/doclets/htmldoclet/HtmlPage.java
ViewVC logotype

Diff of /gjdoc/src/gnu/classpath/tools/doclets/htmldoclet/HtmlPage.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1 by julian, Fri Dec 3 18:54:36 2004 UTC revision 1.2 by julian, Fri Dec 10 14:47:01 2004 UTC
# Line 20  Free Software Foundation, Inc., 59 Templ Line 20  Free Software Foundation, Inc., 59 Templ
20    
21  package gnu.classpath.tools.doclets.htmldoclet;  package gnu.classpath.tools.doclets.htmldoclet;
22    
23    import java.io.BufferedWriter;
24  import java.io.File;  import java.io.File;
25    import java.io.FileOutputStream;
26    import java.io.FileWriter;
27  import java.io.IOException;  import java.io.IOException;
28  import java.io.BufferedWriter;  import java.io.OutputStream;
29    import java.io.OutputStreamWriter;
30  import java.io.PrintWriter;  import java.io.PrintWriter;
31  import java.io.FileWriter;  import java.io.Writer;
32    
33  import com.sun.javadoc.Tag;  import com.sun.javadoc.Tag;
34    
# Line 41  public class HtmlPage Line 45  public class HtmlPage
45     public static final String DOCTYPE_FRAMESET = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">";     public static final String DOCTYPE_FRAMESET = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">";
46     public static final String DOCTYPE_STRICT = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";     public static final String DOCTYPE_STRICT = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">";
47    
48     public HtmlPage(File file, String pathToRoot)     public HtmlPage(File file, String pathToRoot, String encoding)
49        throws IOException        throws IOException
50     {     {
51        this(file, pathToRoot, DOCTYPE_STRICT);        this(file, pathToRoot, encoding, DOCTYPE_STRICT);
52     }     }
53    
54     public HtmlPage(File file, String pathToRoot, String docType)     public HtmlPage(File file, String pathToRoot, String encoding, String docType)
55        throws IOException        throws IOException
56     {     {
57        this.out = new PrintWriter(new BufferedWriter(new FileWriter(file)));        OutputStream fileOut = new FileOutputStream(file);
58          Writer writer;
59          if (null != encoding) {
60             writer = new OutputStreamWriter(fileOut,
61                                             encoding);
62          }
63          else {
64             writer = new OutputStreamWriter(fileOut);
65          }
66          this.out = new PrintWriter(new BufferedWriter(writer));
67        this.pathToRoot = pathToRoot;        this.pathToRoot = pathToRoot;
68        this.docType = docType;        this.docType = docType;
69     }     }
# Line 140  public class HtmlPage Line 153  public class HtmlPage
153        
154     public void beginDiv(CssClass cssClass)     public void beginDiv(CssClass cssClass)
155     {     {
156        beginElement(cssClass.getDivElementName(), "class", cssClass.getName());        String[] divAttributeNames = cssClass.getAttributeNames();
157          String[] divAttributeValues = cssClass.getAttributeValues();
158          if (null == divAttributeNames) {
159             divAttributeNames = new String[0];
160          }
161          if (null == divAttributeValues) {
162             divAttributeValues = new String[0];
163          }
164    
165          String[] attributeNames = new String[1 + divAttributeNames.length];
166          String[] attributeValues = new String[1 + divAttributeValues.length];
167          
168          System.arraycopy(divAttributeNames, 0, attributeNames, 1, divAttributeNames.length);
169          System.arraycopy(divAttributeValues, 0, attributeValues, 1, divAttributeNames.length);
170    
171          beginElement(cssClass.getDivElementName(), attributeNames, attributeValues);
172     }     }
173    
174     public void endDiv(CssClass cssClass)     public void endDiv(CssClass cssClass)
# Line 175  public class HtmlPage Line 203  public class HtmlPage
203        endDiv(cssClass);        endDiv(cssClass);
204     }     }
205    
206     public void beginPage(String title)     public void beginPage(String title, String charset)
207     {     {
208        print("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");        print("<?xml version=\"1.0\" encoding=\"" + charset + "\"?>\n");
209        print(docType);        print(docType);
210        print("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">");        print("<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">");
211        beginElement("head");        beginElement("head");
212        beginElement("title");        beginElement("title");
213        print(title);        print(title);
214        endElement("title");        endElement("title");
215          atomicElement("meta",
216                        new String[] { "http-equiv", "content" },
217                        new String[] { "Content-Type", "text/html; charset=" + charset });
218        endElement("head");        endElement("head");
219     }     }
220    

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26