1313public class Main {
1414private static final Pattern PATTERN =Pattern .compile ("\\ r?\\ n" );
1515
16+ private enum Type {
17+ JAVA ,
18+ KOTLIN
19+ }
20+
1621private static void fillFilesRecursively (Path directory ,final List <File >resultFiles )
1722throws IOException {
1823Files .walkFileTree (
@@ -58,7 +63,7 @@ public static void main(String[] args) throws IOException {
5863"\n - [" ,
5964" board = [[" ,
6065" grid = [[" ,
61- " = [[" ,
66+ "[[" ,
6267"**," ,
6368"**]" ,
6469"(**" ,
@@ -86,7 +91,7 @@ public static void main(String[] args) throws IOException {
8691"\n -\\ [" ,
8792" board = [ [" ,
8893" grid = [ [" ,
89- " = \\ [\\ [" ,
94+ "\\ [\\ [" ,
9095"** ," ,
9196"** ]" ,
9297"( **" ,
@@ -108,6 +113,12 @@ public static void main(String[] args) throws IOException {
108113"<code>" ,"</code>" ,"<sub>" ,"</sub>" ,"<sup>" ,"</sup>" ,"<ins>" ,
109114"</ins>" ,
110115 };
116+ Type type =
117+ (javaFile .getAbsolutePath ().endsWith (".java" )
118+ ?Type .JAVA
119+ :javaFile .getAbsolutePath ().endsWith (".kt" )
120+ ?Type .KOTLIN
121+ :null );
111122String readmeMdJavadoc =
112123"/**\n "
113124 +StringUtils .replaceEach (
@@ -117,7 +128,8 @@ public static void main(String[] args) throws IOException {
117128line ->
118129getString (
119130line ,
120- index ))
131+ index ,
132+ type ))
121133 .collect (
122134Collectors .joining (
123135"\n " )),
@@ -145,8 +157,8 @@ public static void main(String[] args) throws IOException {
145157 }
146158 }
147159
148- private static String getString (String line ,int []index ) {
149- String firstLine =line .replace ("\\ ." ," -" ) +"\\ ." ;
160+ private static String getString (String line ,int []index , Type type ) {
161+ String firstLine =line .replace ("\\ ." ," -" ) +( type == Type . JAVA ? "\\ ." : "." ) ;
150162String str =index [0 ]++ ==0 ?firstLine :line ;
151163return line .isEmpty () ?" *" :" * " +str ;
152164 }