@@ -31,84 +31,84 @@ public static void init() {
3131 Utils .init (RuntimeEnvironment .application );
3232 }
3333
34- @ Test
35- public void readme2Eng () throws Exception {
36- formatCN ();
37- File readmeCN = new File (new File (System .getProperty ("user.dir" )).getAbsolutePath () + FILE_SEP + "README-CN.md" );
38- File readmeEng = new File (new File (System .getProperty ("user.dir" )).getAbsolutePath () + FILE_SEP + "README.md" );
39- List <String > list = FileUtils .readFile2List (readmeCN , "UTF-8" );
40- StringBuilder sb = new StringBuilder ("# Android developers should collect the following utils" + LINE_SEP + LINE_SEP +
41- "[![auc][aucsvg]][auc] [![build][buildsvg]][build] [![api][apisvg]][api] [![License][licensesvg]][license]" + LINE_SEP + LINE_SEP +
42- "## [README of Chinese][readme-cn.md]" + LINE_SEP + LINE_SEP +
43- "## API" + LINE_SEP + LINE_SEP );
44- List <String > lines = list .subList (8 , list .size ());
45- for (String line : lines ) {
46- if (line .contains ("* ###" )) {
47- if (line .contains ("Utils" )) {
48- String utilsName = line .substring (line .indexOf ("[" ) + 1 , line .indexOf ("Utils" ));
49- sb .append ("* ### About " ).append (utilsName ).append (line .substring (line .indexOf ("→" )));
50- } else {
51- sb .append ("* ### About Log→[update_log.md][update_log.md]**" );
52- }
53- } else if (line .contains (": " ) && !line .contains ("[" )) {
54- sb .append (line .substring (0 , line .indexOf (':' )).trim ());
55- } else if (line .contains ("* 做" )) {
56- sb .append ("**I'm so sorry for that the code is annotated with Chinese.**" );
57- } else if (line .contains ("* QQ" ) || line .contains ("* 我的" )) {
58- continue ;
59- } else {
60- sb .append (line );
61- }
62- sb .append (LINE_SEP );
63- }
64- FileUtils .writeFileFromString (readmeEng , sb .toString (), false );
65- }
66-
67- @ Test
68- public void formatCN () throws Exception {
69- File readmeCN = new File (new File (System .getProperty ("user.dir" )).getAbsolutePath () + FILE_SEP + "README-CN.md" );
70- List <String > list = FileUtils .readFile2List (readmeCN , "UTF-8" );
71- StringBuilder sb = new StringBuilder ();
72- for (int i = 0 ; i < 4 ; i ++) {
73- sb .append (list .get (i )).append (LINE_SEP );
74- }
75- String space = " " ;
76- for (int i = 4 , len = list .size (); i < len ; ++i ) {
77- String line = list .get (i );
78- if (line .contains ("* ###" ) && line .contains ("Utils" )) {
79- sb .append (line ).append (LINE_SEP );
80- int maxLen = 0 ;
81- line = list .get (++i );
82- // 获取需填充最大空格数
83- for (int j = i ; !line .equals ("" ); line = list .get (++j )) {
84- if (line .equals ("```" )) continue ;
85- maxLen = Math .max (maxLen , line .replace (" " , "" ).replace ("," , ", " ).indexOf (':' ));
86- }
87- line = list .get (i );
88- for (; !line .equals ("" ); line = list .get (++i )) {
89- if (line .equals ("```" )) {
90- sb .append ("```" ).append (LINE_SEP );
91- continue ;
92- }
93- String noSpaceLine = line .replace (" " , "" );
94- int l = maxLen - line .replace (" " , "" ).replace ("," , ", " ).indexOf (':' );
95- String spaces = "" ;
96- for (int j = 0 ; j < l ; j ++) {
97- spaces += space ;
98- }
99- String temp = noSpaceLine .substring (0 , noSpaceLine .indexOf (':' )) + spaces + ": " + noSpaceLine .substring (noSpaceLine .indexOf (':' ) + 1 ) + LINE_SEP ;
100- sb .append (temp .replace ("," , ", " ));
101- }
102- } else {
103- sb .append (line );
104- }
105- sb .append (LINE_SEP );
106- }
107- FileUtils .writeFileFromString (readmeCN , sb .toString (), false );
108- }
109-
110- @ Test
111- public void test () throws Exception {
112- System .out .println (System .getProperty ("user.dir" ));
113- }
34+ // @Test
35+ // public void readme2Eng() throws Exception {
36+ // formatCN();
37+ // File readmeCN = new File(new File(System.getProperty("user.dir")).getAbsolutePath() + FILE_SEP + "README-CN.md");
38+ // File readmeEng = new File(new File(System.getProperty("user.dir")).getAbsolutePath() + FILE_SEP + "README.md");
39+ // List<String> list = FileUtils.readFile2List(readmeCN, "UTF-8");
40+ // StringBuilder sb = new StringBuilder("# Android developers should collect the following utils" + LINE_SEP + LINE_SEP +
41+ // "[![auc][aucsvg]][auc] [![build][buildsvg]][build] [![api][apisvg]][api] [![License][licensesvg]][license]" + LINE_SEP + LINE_SEP +
42+ // "## [README of Chinese][readme-cn.md]" + LINE_SEP + LINE_SEP +
43+ // "## API" + LINE_SEP + LINE_SEP);
44+ // List<String> lines = list.subList(8, list.size());
45+ // for (String line : lines) {
46+ // if (line.contains("* ###")) {
47+ // if (line.contains("Utils")) {
48+ // String utilsName = line.substring(line.indexOf("[") + 1, line.indexOf("Utils"));
49+ // sb.append("* ### About ").append(utilsName).append(line.substring(line.indexOf("→")));
50+ // } else {
51+ // sb.append("* ### About Log→[update_log.md][update_log.md]**");
52+ // }
53+ // } else if (line.contains(": ") && !line.contains("[")) {
54+ // sb.append(line.substring(0, line.indexOf(':')).trim());
55+ // } else if (line.contains("* 做")) {
56+ // sb.append("**I'm so sorry for that the code is annotated with Chinese.**");
57+ // } else if (line.contains("* QQ") || line.contains("* 我的")) {
58+ // continue;
59+ // } else {
60+ // sb.append(line);
61+ // }
62+ // sb.append(LINE_SEP);
63+ // }
64+ // FileUtils.writeFileFromString(readmeEng, sb.toString(), false);
65+ // }
66+ //
67+ // @Test
68+ // public void formatCN() throws Exception {
69+ // File readmeCN = new File(new File(System.getProperty("user.dir")).getAbsolutePath() + FILE_SEP + "README-CN.md");
70+ // List<String> list = FileUtils.readFile2List(readmeCN, "UTF-8");
71+ // StringBuilder sb = new StringBuilder();
72+ // for (int i = 0; i < 4; i++) {
73+ // sb.append(list.get(i)).append(LINE_SEP);
74+ // }
75+ // String space = " ";
76+ // for (int i = 4, len = list.size(); i < len; ++i) {
77+ // String line = list.get(i);
78+ // if (line.contains("* ###") && line.contains("Utils")) {
79+ // sb.append(line).append(LINE_SEP);
80+ // int maxLen = 0;
81+ // line = list.get(++i);
82+ // // 获取需填充最大空格数
83+ // for (int j = i; !line.equals(""); line = list.get(++j)) {
84+ // if (line.equals("```")) continue;
85+ // maxLen = Math.max(maxLen, line.replace(" ", "").replace(",", ", ").indexOf(':'));
86+ // }
87+ // line = list.get(i);
88+ // for (; !line.equals(""); line = list.get(++i)) {
89+ // if (line.equals("```")) {
90+ // sb.append("```").append(LINE_SEP);
91+ // continue;
92+ // }
93+ // String noSpaceLine = line.replace(" ", "");
94+ // int l = maxLen - line.replace(" ", "").replace(",", ", ").indexOf(':');
95+ // String spaces = "";
96+ // for (int j = 0; j < l; j++) {
97+ // spaces += space;
98+ // }
99+ // String temp = noSpaceLine.substring(0, noSpaceLine.indexOf(':')) + spaces + ": " + noSpaceLine.substring(noSpaceLine.indexOf(':') + 1) + LINE_SEP;
100+ // sb.append(temp.replace(",", ", "));
101+ // }
102+ // } else {
103+ // sb.append(line);
104+ // }
105+ // sb.append(LINE_SEP);
106+ // }
107+ // FileUtils.writeFileFromString(readmeCN, sb.toString(), false);
108+ // }
109+ //
110+ // @Test
111+ // public void test() throws Exception {
112+ // System.out.println(System.getProperty("user.dir"));
113+ // }
114114}
0 commit comments