View Javadoc

1   package net.sf.statcvs.pages;
2   
3   import net.sf.statcvs.output.ConfigurationOptions;
4   
5   /**
6    * @author Benoit Xhenseval
7    * @author Richard Cyganiak (richard@cyganiak.de)
8    * @version $Id: MarkupXDoc.java,v 1.9 2009/08/05 17:22:52 benoitx Exp $
9    */
10  public class MarkupXDoc extends AbstractMarkup implements MarkupSyntax {
11      private final static MarkupSyntax instance = new MarkupXDoc();
12  
13      public static MarkupSyntax getInstance() {
14          return instance;
15      }
16  
17      private MarkupXDoc() {
18          // Singleton
19      }
20  
21      public String getEndOfPage() {
22          return "</body>\n</document>";
23      }
24  
25      public String getExtension() {
26          return "xml";
27      }
28  
29      public String getHeader(final String pageName, final String stylesheetURL, final String charSet) {
30          StringBuffer b = new StringBuffer();
31          
32          
33          b.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n");
34          b.append("<document xmlns:lxslt=\"http://xml.apache.org/xslt\">\n");
35          b.append("<properties><title>");
36          b.append(pageName);
37          b.append("</title></properties>\n");
38          b.append("<head>");
39          b.append("    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=");
40          b.append(charSet);
41          b.append("\"/>\n");
42          b.append("    <meta name=\"Generator\" content=\"StatCVS @VERSION@\"/>\n");
43          b.append("   <link rel=\"stylesheet\" href=\"");
44          b.append(HTML.escape(stylesheetURL));
45          b.append("\" type=\"text/css\"/>\n");
46          
47          if (ConfigurationOptions.isEnableTwitterButton()) {
48              addTwitterScript(b);
49          }
50          b.append("</head>\n\n<body>");
51  
52          return b.toString();
53      }
54  
55      public String startSection1(final String title) {
56          return "<section name=\"" + title + "\">\n";
57      }
58  
59      public String endSection1() {
60          return "</section>";
61      }
62  
63      public String startSection2(final String title) {
64          return "\n<div class=\"section\">\n<subsection name =\"" + title + "\">\n";
65      }
66  
67      public String startSection2(final String title, final String id) {
68          return "\n<div id=\"" + HTML.escape(id) + "\" class=\"section\">\n<subsection name =\"" + title + "\">\n";
69      }
70  
71      public String endSection2() {
72          return "</subsection></div>";
73      }
74  
75      public String getTableFormat() {
76          return " class=\"statCvsTable\"";
77      }
78  
79      public String toString() {
80          return "XDoc";
81      }
82  }