1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.jboss.maven.plugins.jdocbook.gen.util;
17
18
19
20
21
22
23 public class StandardDocBookFormatSpecification {
24 public static final StandardDocBookFormatSpecification ECLIPSE =
25 new HtmlBasedStandardDocBookFormat( "eclipse", "/eclipse/eclipse.xsl" );
26
27 public static final StandardDocBookFormatSpecification HTML =
28 new HtmlBasedStandardDocBookFormat( "html", "/html/chunk.xsl" );
29
30 public static final StandardDocBookFormatSpecification HTML_SINGLE =
31 new HtmlBasedStandardDocBookFormat( "html_single", "/html/docbook.xsl", false );
32
33 public static final StandardDocBookFormatSpecification HTMLHELP =
34 new HtmlBasedStandardDocBookFormat( "htmlhelp", "/htmlhelp/htmlhelp.xsl" );
35
36 public static final StandardDocBookFormatSpecification JAVAHELP =
37 new HtmlBasedStandardDocBookFormat( "javahelp", "/javahelp/javahelp.xsl" );
38
39 public static final StandardDocBookFormatSpecification MAN =
40 new HtmlBasedStandardDocBookFormat( "man", "/manpages/docbook.xsl", false );
41
42 public static final StandardDocBookFormatSpecification PDF =
43 new StandardDocBookFormatSpecification( "pdf", "pdf", "/fo/docbook.xsl", true, false, false );
44
45 public static final StandardDocBookFormatSpecification WEBSITE =
46 new HtmlBasedStandardDocBookFormat( "website", "/website/website.xsl", false );
47
48
49
50
51
52 public static final StandardDocBookFormatSpecification XHTML =
53 new StandardDocBookFormatSpecification( "xhtml", "xhtml", "/xhtml/docbook.xsl", false, true, false );
54
55 private final String name;
56 private final String standardFileExtension;
57 private final String stylesheetResource;
58 private final boolean imagePathSettingRequired;
59 private final boolean imageCopyingRequired;
60 private final boolean doingChunking;
61
62 public StandardDocBookFormatSpecification(
63 String name,
64 String standardFileExtension,
65 String stylesheetResource,
66 boolean imagePathSettingRequired,
67 boolean imageCopyingRequired,
68 boolean doingChunking) {
69 this.name = name;
70 this.standardFileExtension = standardFileExtension;
71 this.stylesheetResource = stylesheetResource;
72 this.imagePathSettingRequired = imagePathSettingRequired;
73 this.imageCopyingRequired = imageCopyingRequired;
74 this.doingChunking = doingChunking;
75 }
76
77 public String getName() {
78 return name;
79 }
80
81 public String getStandardFileExtension() {
82 return standardFileExtension;
83 }
84
85 public String getStylesheetResource() {
86 return stylesheetResource;
87 }
88
89 public boolean isImagePathSettingRequired() {
90 return imagePathSettingRequired;
91 }
92
93 public boolean isImageCopyingRequired() {
94 return imageCopyingRequired;
95 }
96
97 public boolean isDoingChunking() {
98 return doingChunking;
99 }
100
101 public static StandardDocBookFormatSpecification parse(String name) {
102 if ( ECLIPSE.name.equals( name ) ) {
103 return ECLIPSE;
104 }
105 else if ( HTML.name.equals( name ) ) {
106 return HTML;
107 }
108 else if ( HTML_SINGLE.name.equals( name ) ) {
109 return HTML_SINGLE;
110 }
111 else if ( HTMLHELP.name.equals( name ) ) {
112 return HTMLHELP;
113 }
114 else if ( JAVAHELP.name.equals( name ) ) {
115 return JAVAHELP;
116 }
117 else if ( MAN.name.equals( name ) ) {
118 return MAN;
119 }
120 else if ( PDF.name.equals( name ) ) {
121 return PDF;
122 }
123 else if ( WEBSITE.name.equals( name ) ) {
124 return WEBSITE;
125 }
126
127
128
129 else if ( XHTML.name.equals( name ) ) {
130 return XHTML;
131 }
132 else {
133 return null;
134 }
135 }
136
137
138
139
140 private static class HtmlBasedStandardDocBookFormat extends StandardDocBookFormatSpecification {
141 private HtmlBasedStandardDocBookFormat(String name, String stylesheetResource) {
142 this( name, stylesheetResource, true );
143 }
144 private HtmlBasedStandardDocBookFormat(String name, String stylesheetResource, boolean doingChunking) {
145 super( name, "html", stylesheetResource, false, true, doingChunking );
146 }
147 }
148 }