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