37 * If you write code that depends on this, you do so at your own risk. |
36 * If you write code that depends on this, you do so at your own risk. |
38 * This code and its internal interfaces are subject to change or |
37 * This code and its internal interfaces are subject to change or |
39 * deletion without notice.</b> |
38 * deletion without notice.</b> |
40 * |
39 * |
41 */ |
40 */ |
42 public class ExpertTaglet implements Taglet { |
41 public class ExpertTaglet extends BaseTaglet { |
43 |
42 |
44 private static final String NAME = "expert"; |
43 private static final String NAME = "expert"; |
45 private static final String START_TAG = "<sub id=\"expert\">"; |
|
46 private static final String END_TAG = "</sub>"; |
|
47 |
44 |
48 /** |
45 /** |
49 * {@inheritDoc} |
46 * {@inheritDoc} |
50 */ |
47 */ |
51 public boolean inField() { |
48 public boolean inField() { |
83 public static void register(Map<String, Taglet> map) { |
80 public static void register(Map<String, Taglet> map) { |
84 map.remove(NAME); |
81 map.remove(NAME); |
85 map.put(NAME, new ExpertTaglet()); |
82 map.put(NAME, new ExpertTaglet()); |
86 } |
83 } |
87 |
84 |
88 public String toString(Tag tag) { |
85 /** |
89 return (tag.text() == null || tag.text().length() == 0) ? null : |
86 * {@inheritDoc} |
90 START_TAG + LiteralTaglet.textToString(tag.text()) + END_TAG; |
87 */ |
|
88 public TagletOutput getTagletOutput(Tag tag, TagletWriter writer) { |
|
89 return writer.expertTagOutput(tag); |
91 } |
90 } |
92 |
|
93 |
|
94 public String toString(Tag[] tags) { |
|
95 if (tags == null || tags.length == 0) return null; |
|
96 |
|
97 StringBuffer sb = new StringBuffer(START_TAG); |
|
98 |
|
99 for(Tag t:tags) { |
|
100 sb.append(LiteralTaglet.textToString(t.text())); |
|
101 } |
|
102 sb.append(END_TAG); |
|
103 return sb.toString(); |
|
104 } |
|
105 |
|
106 } |
91 } |