1170 * @param element the Element for which the summary will be generated |
1182 * @param element the Element for which the summary will be generated |
1171 * @param firstSentenceTags the first sentence tags for the doc |
1183 * @param firstSentenceTags the first sentence tags for the doc |
1172 * @param htmltree the documentation tree to which the summary will be added |
1184 * @param htmltree the documentation tree to which the summary will be added |
1173 */ |
1185 */ |
1174 public void addSummaryComment(Element element, List<? extends DocTree> firstSentenceTags, Content htmltree) { |
1186 public void addSummaryComment(Element element, List<? extends DocTree> firstSentenceTags, Content htmltree) { |
1175 addCommentTags(element, firstSentenceTags, false, true, htmltree); |
1187 addCommentTags(element, firstSentenceTags, false, true, true, htmltree); |
1176 } |
1188 } |
1177 |
1189 |
1178 public void addSummaryDeprecatedComment(Element element, DocTree tag, Content htmltree) { |
1190 public void addSummaryDeprecatedComment(Element element, DocTree tag, Content htmltree) { |
1179 CommentHelper ch = utils.getCommentHelper(element); |
1191 CommentHelper ch = utils.getCommentHelper(element); |
1180 List<? extends DocTree> body = ch.getBody(configuration, tag); |
1192 List<? extends DocTree> body = ch.getBody(configuration, tag); |
1181 addCommentTags(element, ch.getFirstSentenceTrees(configuration, body), true, true, htmltree); |
1193 addCommentTags(element, ch.getFirstSentenceTrees(configuration, body), true, true, true, htmltree); |
1182 } |
1194 } |
1183 |
1195 |
1184 /** |
1196 /** |
1185 * Adds the inline comment. |
1197 * Adds the inline comment. |
1186 * |
1198 * |
1187 * @param element the Element for which the inline comments will be generated |
1199 * @param element the Element for which the inline comments will be generated |
1188 * @param htmltree the documentation tree to which the inline comments will be added |
1200 * @param htmltree the documentation tree to which the inline comments will be added |
1189 */ |
1201 */ |
1190 public void addInlineComment(Element element, Content htmltree) { |
1202 public void addInlineComment(Element element, Content htmltree) { |
1191 addCommentTags(element, utils.getFullBody(element), false, false, htmltree); |
1203 addCommentTags(element, utils.getFullBody(element), false, false, false, htmltree); |
1192 } |
1204 } |
1193 |
1205 |
1194 /** |
1206 /** |
1195 * Adds the comment tags. |
1207 * Adds the comment tags. |
1196 * |
1208 * |
1197 * @param element the Element for which the comment tags will be generated |
1209 * @param element the Element for which the comment tags will be generated |
1198 * @param tags the first sentence tags for the doc |
1210 * @param tags the first sentence tags for the doc |
1199 * @param depr true if it is deprecated |
1211 * @param depr true if it is deprecated |
1200 * @param first true if the first sentence tags should be added |
1212 * @param first true if the first sentence tags should be added |
|
1213 * @param inSummary true if the comment tags are added into the summary section |
1201 * @param htmltree the documentation tree to which the comment tags will be added |
1214 * @param htmltree the documentation tree to which the comment tags will be added |
1202 */ |
1215 */ |
1203 private void addCommentTags(Element element, List<? extends DocTree> tags, boolean depr, |
1216 private void addCommentTags(Element element, List<? extends DocTree> tags, boolean depr, |
1204 boolean first, Content htmltree) { |
1217 boolean first, boolean inSummary, Content htmltree) { |
1205 addCommentTags(element, null, tags, depr, first, htmltree); |
1218 addCommentTags(element, null, tags, depr, first, inSummary, htmltree); |
1206 } |
1219 } |
1207 |
1220 |
1208 /** |
1221 /** |
1209 * Adds the comment tags. |
1222 * Adds the comment tags. |
1210 * |
1223 * |
1211 * @param element for which the comment tags will be generated |
1224 * @param element for which the comment tags will be generated |
1212 * @param holderTag the block tag context for the inline tags |
1225 * @param holderTag the block tag context for the inline tags |
1213 * @param tags the first sentence tags for the doc |
1226 * @param tags the first sentence tags for the doc |
1214 * @param depr true if it is deprecated |
1227 * @param depr true if it is deprecated |
1215 * @param first true if the first sentence tags should be added |
1228 * @param first true if the first sentence tags should be added |
|
1229 * @param inSummary true if the comment tags are added into the summary section |
1216 * @param htmltree the documentation tree to which the comment tags will be added |
1230 * @param htmltree the documentation tree to which the comment tags will be added |
1217 */ |
1231 */ |
1218 private void addCommentTags(Element element, DocTree holderTag, List<? extends DocTree> tags, boolean depr, |
1232 private void addCommentTags(Element element, DocTree holderTag, List<? extends DocTree> tags, boolean depr, |
1219 boolean first, Content htmltree) { |
1233 boolean first, boolean inSummary, Content htmltree) { |
1220 if(configuration.nocomment){ |
1234 if(configuration.nocomment){ |
1221 return; |
1235 return; |
1222 } |
1236 } |
1223 Content div; |
1237 Content div; |
1224 Content result = commentTagsToContent(null, element, tags, first); |
1238 Content result = commentTagsToContent(null, element, tags, first, inSummary); |
1225 if (depr) { |
1239 if (depr) { |
1226 div = HtmlTree.DIV(HtmlStyle.deprecationComment, result); |
1240 div = HtmlTree.DIV(HtmlStyle.deprecationComment, result); |
1227 htmltree.addContent(div); |
1241 htmltree.addContent(div); |
1228 } |
1242 } |
1229 else { |
1243 else { |
1265 |
1279 |
1266 // Notify the next DocTree handler to take necessary action |
1280 // Notify the next DocTree handler to take necessary action |
1267 private boolean commentRemoved = false; |
1281 private boolean commentRemoved = false; |
1268 |
1282 |
1269 /** |
1283 /** |
1270 * Converts inline tags and text to text strings, expanding the |
1284 * Converts inline tags and text to Content, expanding the |
1271 * inline tags along the way. Called wherever text can contain |
1285 * inline tags along the way. Called wherever text can contain |
1272 * an inline tag, such as in comments or in free-form text arguments |
1286 * an inline tag, such as in comments or in free-form text arguments |
1273 * to non-inline tags. |
1287 * to block tags. |
1274 * |
1288 * |
1275 * @param holderTag specific tag where comment resides |
1289 * @param holderTag specific tag where comment resides |
1276 * @param element specific element where comment resides |
1290 * @param element specific element where comment resides |
1277 * @param tags array of text tags and inline tags (often alternating) |
1291 * @param tags array of text tags and inline tags (often alternating) |
1278 present in the text of interest for this element |
1292 present in the text of interest for this element |
1279 * @param isFirstSentence true if text is first sentence |
1293 * @param isFirstSentence true if text is first sentence |
1280 * @return a Content object |
1294 * @return a Content object |
1281 */ |
1295 */ |
1282 public Content commentTagsToContent(DocTree holderTag, Element element, |
1296 public Content commentTagsToContent(DocTree holderTag, Element element, |
1283 List<? extends DocTree> tags, boolean isFirstSentence) { |
1297 List<? extends DocTree> tags, boolean isFirstSentence) { |
|
1298 return commentTagsToContent(holderTag, element, tags, isFirstSentence, false); |
|
1299 } |
|
1300 |
|
1301 /** |
|
1302 * Converts inline tags and text to text strings, expanding the |
|
1303 * inline tags along the way. Called wherever text can contain |
|
1304 * an inline tag, such as in comments or in free-form text arguments |
|
1305 * to block tags. |
|
1306 * |
|
1307 * @param holderTag specific tag where comment resides |
|
1308 * @param element specific element where comment resides |
|
1309 * @param tags array of text tags and inline tags (often alternating) |
|
1310 present in the text of interest for this element |
|
1311 * @param isFirstSentence true if text is first sentence |
|
1312 * @param inSummary if the comment tags are added into the summary section |
|
1313 * @return a Content object |
|
1314 */ |
|
1315 public Content commentTagsToContent(DocTree holderTag, Element element, |
|
1316 List<? extends DocTree> tags, boolean isFirstSentence, boolean inSummary) { |
1284 |
1317 |
1285 final Content result = new ContentBuilder() { |
1318 final Content result = new ContentBuilder() { |
1286 @Override |
1319 @Override |
1287 public void addContent(CharSequence text) { |
1320 public void addContent(CharSequence text) { |
1288 super.addContent(utils.normalizeNewlines(text)); |
1321 super.addContent(utils.normalizeNewlines(text)); |