-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathTablePlugin.java
More file actions
41 lines (34 loc) · 847 Bytes
/
TablePlugin.java
File metadata and controls
41 lines (34 loc) · 847 Bytes
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
package org.markdown4j;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;
public class TablePlugin extends Plugin {
public TablePlugin() {
super("table");
}
private int findSeparatorLine(int beginIndex, List<String> lines) {
for(int i = beginIndex;i<lines.size();i++) {
String line = lines.get(i);
if(Pattern.matches("- ", line)) {
return i;
}
}
return -1;
}
@Override
public void emit(StringBuilder out, List<String> lines,
Map<String, String> params) {
StringBuffer sb2;
String lparams;
int ioh = findSeparatorLine(0, lines);
String headerLine;
String footerLine;
if(ioh != -1) {
headerLine = lines.get(ioh);
int iof = findSeparatorLine(ioh, lines);
if(iof != -1) {
footerLine = lines.get(iof);
}
}
}
}