-
Notifications
You must be signed in to change notification settings - Fork 219
/
MathTaglet.java
77 lines (60 loc) · 1.5 KB
/
MathTaglet.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
/**
* 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.math" can be used in the Javadoc comments of an operator to produce mathematical
* code. Example: "@rapidminer.math 1/(n+1)". This will include a LaTeX math environment to you documentation.
*
* @author Simon Fischer, Ingo Mierswa
*/
public class MathTaglet implements TexTaglet {
private static final String NAME = "rapidminer.math";
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) {
MathTaglet tag = new MathTaglet();
Taglet t = tagletMap.get(tag.getName());
if (t != null) {
tagletMap.remove(tag.getName());
}
tagletMap.put(tag.getName(), tag);
}
public String toString(Tag tag) {
return "<i>" + tag.text() + "</i>";
}
public String toString(Tag[] tags) {
return null;
}
public String toTex(Tag tag) {
return "$" + tag.text() + "$";
}
public String toTex(Tag[] tag) {
return null;
}
}