-
Notifications
You must be signed in to change notification settings - Fork 219
/
CiteTaglet.java
78 lines (61 loc) · 1.52 KB
/
CiteTaglet.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/**
* Copyright (C) 2001-2019 RapidMiner GmbH
*/
package com.rapidminer.doc;
import java.util.Map;
import com.sun.javadoc.Tag;
import com.sun.tools.doclets.Taglet;
/**
* A taglet with name "@rapidminer.cite" can be used in the Javadoc comments of an operator to produce a reference
* to literature. Example: "@rapidminer.cite Mierswa/etal/2003a". This will include a LaTeX cite command to your
* document.
*
* @author Simon Fischer, Ingo Mierswa
*/
public class CiteTaglet implements TexTaglet {
private static final String NAME = "rapidminer.cite";
public String getName() {
return NAME;
}
public boolean inField() {
return true;
}
public boolean inConstructor() {
return true;
}
public boolean inMethod() {
return true;
}
public boolean inOverview() {
return true;
}
public boolean inPackage() {
return true;
}
public boolean inType() {
return true;
}
public boolean isInlineTag() {
return true;
}
public static void register(Map<String, Taglet> tagletMap) {
CiteTaglet tag = new CiteTaglet();
Taglet t = tagletMap.get(tag.getName());
if (t != null) {
tagletMap.remove(tag.getName());
}
tagletMap.put(tag.getName(), tag);
}
public String toString(Tag tag) {
return "[" + tag.text() + "]";
}
public String toString(Tag[] tags) {
return null;
}
public String toTex(Tag tag) {
return "\\cite{" + tag.text() + "}";
}
public String toTex(Tag[] tag) {
return null;
}
}