1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.maven.tools.plugin.extractor.annotations.converter.tag.block;
20
21 import javax.inject.Named;
22 import javax.inject.Singleton;
23
24 import org.apache.maven.tools.plugin.extractor.annotations.converter.ConverterContext;
25 import org.apache.maven.tools.plugin.extractor.annotations.converter.tag.LinkUtils;
26
27
28
29
30
31 @Named("see")
32 @Singleton
33 public class SeeTagConverter extends JavadocBlockTagToHtmlConverter {
34 private static final String ATTRIBUTE_NAME_IS_FIRST_REFERENCE = "SeeTagletConverter.isFirstReference";
35
36 @Override
37 public String convert(String value, ConverterContext context) {
38 StringBuilder htmlBuilder = new StringBuilder();
39 Boolean isFirstReference = context.getAttribute(ATTRIBUTE_NAME_IS_FIRST_REFERENCE, Boolean.class, Boolean.TRUE);
40 if (Boolean.TRUE.equals(isFirstReference)) {
41
42 htmlBuilder.append("<br/><strong>See also:</strong>\n");
43 context.setAttribute(ATTRIBUTE_NAME_IS_FIRST_REFERENCE, Boolean.FALSE);
44 } else {
45
46 htmlBuilder.append(", ");
47 }
48
49 if (value.startsWith("<a href")) {
50 return htmlBuilder.append(value).toString();
51 }
52
53 if (value.startsWith("\"")) {
54 return htmlBuilder.append(value).toString();
55 }
56 String link = LinkUtils.createLink(value, context);
57 htmlBuilder.append(link);
58 return htmlBuilder.toString();
59 }
60 }