16
16
public class Main {
17
17
private static final Pattern PATTERN =Pattern .compile ("\\ r?\\ n" );
18
18
19
- private static void fillFilesRecursively (
20
- Path directory ,final List <File >resultFiles )
19
+ private static void fillFilesRecursively (Path directory ,final List <File >resultFiles )
21
20
throws IOException {
22
21
Files .walkFileTree (
23
22
directory ,
@@ -66,6 +65,21 @@ public static void main(String[] args) throws IOException {
66
65
"(**" ,
67
66
"**)" ,
68
67
"[[]" ,
68
+ "<code>" ,
69
+ "</code>" ,
70
+ "<sub>" ,
71
+ "</sub>" ,
72
+ "<sup>" ,
73
+ "</sup>" ,
74
+ "<ins>" ,
75
+ "</ins>" ,
76
+ "<" ,
77
+ ">" ,
78
+ "&"
79
+ };
80
+ String []fromStr2 = {
81
+ "[code]" ,"[/code]" ,"[sub]" ,"[/sub]" ,"[sup]" ,"[/sup]" ,"[ins]" ,
82
+ "[/ins]" ,
69
83
};
70
84
String []toStr = {
71
85
"(\" { {" ,
@@ -78,30 +92,54 @@ public static void main(String[] args) throws IOException {
78
92
"** ]" ,
79
93
"( **" ,
80
94
"** )" ,
81
- "[ []"
95
+ "[ []" ,
96
+ "[code]" ,
97
+ "[/code]" ,
98
+ "[sub]" ,
99
+ "[/sub]" ,
100
+ "[sup]" ,
101
+ "[/sup]" ,
102
+ "[ins]" ,
103
+ "[/ins]" ,
104
+ "<" ,
105
+ ">" ,
106
+ "&"
107
+ };
108
+ String []toStr2 = {
109
+ "<code>" ,"</code>" ,"<sub>" ,"</sub>" ,"<sup>" ,"</sup>" ,"<ins>" ,
110
+ "</ins>" ,
82
111
};
83
112
String readmeMdJavadoc =
84
113
"/**\n "
85
114
+StringUtils .replaceEach (
86
- PATTERN .splitAsStream (readmeMdText )
87
- .map (
88
- line -> {
89
- String firstLine =
90
- line .replace (
91
- "\\ ." ,
92
- " -" )
93
- +"\\ ." ;
94
- String str =
95
- index [0 ]++ ==0
96
- ?firstLine
97
- :line ;
98
- return line .isEmpty ()
99
- ?" *"
100
- :" * " +str ;
101
- })
102
- .collect (Collectors .joining ("\n " )),
103
- fromStr ,
104
- toStr )
115
+ StringUtils .replaceEach (
116
+ PATTERN .splitAsStream (readmeMdText )
117
+ .map (
118
+ line -> {
119
+ String firstLine =
120
+ line
121
+ .replace (
122
+ "\\ ." ,
123
+ " -" )
124
+ +"\\ ." ;
125
+ String str =
126
+ index [0 ]++
127
+ ==0
128
+ ?firstLine
129
+ :line ;
130
+ return line
131
+ .isEmpty ()
132
+ ?" *"
133
+ :" * "
134
+ +str ;
135
+ })
136
+ .collect (
137
+ Collectors .joining (
138
+ "\n " )),
139
+ fromStr ,
140
+ toStr ),
141
+ fromStr2 ,
142
+ toStr2 )
105
143
.replace ("`**" ,"` **" )
106
144
.replace (",**" ,", **" )
107
145
.replace ("<ins>**" ,"<ins> **" )