1 /* |
1 /* |
2 * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
59 * New line to be added to the documentation. |
59 * New line to be added to the documentation. |
60 */ |
60 */ |
61 private static final String NEW_LINE = DocletConstants.NL; |
61 private static final String NEW_LINE = DocletConstants.NL; |
62 |
62 |
63 private final ConfigurationImpl configuration; |
63 private final ConfigurationImpl configuration; |
|
64 private final Utils utils; |
64 |
65 |
65 private final RootDoc rootDoc; |
66 private final RootDoc rootDoc; |
66 |
67 |
67 private DocPath outputdir; |
68 private DocPath outputdir; |
68 |
69 |
73 private DocPath relativePath = DocPath.empty; |
74 private DocPath relativePath = DocPath.empty; |
74 |
75 |
75 private SourceToHTMLConverter(ConfigurationImpl configuration, RootDoc rd, |
76 private SourceToHTMLConverter(ConfigurationImpl configuration, RootDoc rd, |
76 DocPath outputdir) { |
77 DocPath outputdir) { |
77 this.configuration = configuration; |
78 this.configuration = configuration; |
|
79 this.utils = configuration.utils; |
78 this.rootDoc = rd; |
80 this.rootDoc = rd; |
79 this.outputdir = outputdir; |
81 this.outputdir = outputdir; |
80 } |
82 } |
81 |
83 |
82 /** |
84 /** |
96 return; |
98 return; |
97 } |
99 } |
98 for (PackageDoc pd : rootDoc.specifiedPackages()) { |
100 for (PackageDoc pd : rootDoc.specifiedPackages()) { |
99 // If -nodeprecated option is set and the package is marked as deprecated, |
101 // If -nodeprecated option is set and the package is marked as deprecated, |
100 // do not convert the package files to HTML. |
102 // do not convert the package files to HTML. |
101 if (!(configuration.nodeprecated && Util.isDeprecated(pd))) |
103 if (!(configuration.nodeprecated && utils.isDeprecated(pd))) |
102 convertPackage(pd, outputdir); |
104 convertPackage(pd, outputdir); |
103 } |
105 } |
104 for (ClassDoc cd : rootDoc.specifiedClasses()) { |
106 for (ClassDoc cd : rootDoc.specifiedClasses()) { |
105 // If -nodeprecated option is set and the class is marked as deprecated |
107 // If -nodeprecated option is set and the class is marked as deprecated |
106 // or the containing package is deprecated, do not convert the |
108 // or the containing package is deprecated, do not convert the |
107 // package files to HTML. |
109 // package files to HTML. |
108 if (!(configuration.nodeprecated && |
110 if (!(configuration.nodeprecated && |
109 (Util.isDeprecated(cd) || Util.isDeprecated(cd.containingPackage())))) |
111 (utils.isDeprecated(cd) || utils.isDeprecated(cd.containingPackage())))) |
110 convertClass(cd, outputdir); |
112 convertClass(cd, outputdir); |
111 } |
113 } |
112 } |
114 } |
113 |
115 |
114 /** |
116 /** |
124 for (ClassDoc cd : pd.allClasses()) { |
126 for (ClassDoc cd : pd.allClasses()) { |
125 // If -nodeprecated option is set and the class is marked as deprecated, |
127 // If -nodeprecated option is set and the class is marked as deprecated, |
126 // do not convert the package files to HTML. We do not check for |
128 // do not convert the package files to HTML. We do not check for |
127 // containing package deprecation since it is already check in |
129 // containing package deprecation since it is already check in |
128 // the calling method above. |
130 // the calling method above. |
129 if (!(configuration.nodeprecated && Util.isDeprecated(cd))) |
131 if (!(configuration.nodeprecated && utils.isDeprecated(cd))) |
130 convertClass(cd, outputdir); |
132 convertClass(cd, outputdir); |
131 } |
133 } |
132 } |
134 } |
133 |
135 |
134 /** |
136 /** |
258 * @param line the string to format. |
260 * @param line the string to format. |
259 * @param currentLineNo the current number. |
261 * @param currentLineNo the current number. |
260 */ |
262 */ |
261 private void addLine(Content pre, String line, int currentLineNo) { |
263 private void addLine(Content pre, String line, int currentLineNo) { |
262 if (line != null) { |
264 if (line != null) { |
263 pre.addContent(Util.replaceTabs(configuration, line)); |
265 pre.addContent(utils.replaceTabs(configuration, line)); |
264 Content anchor = HtmlTree.A_NAME("line." + Integer.toString(currentLineNo)); |
266 Content anchor = HtmlTree.A_NAME("line." + Integer.toString(currentLineNo)); |
265 pre.addContent(anchor); |
267 pre.addContent(anchor); |
266 pre.addContent(NEW_LINE); |
268 pre.addContent(NEW_LINE); |
267 } |
269 } |
268 } |
270 } |