GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — AndroidUtilCode/readme.gradle at master · 1191102363/AndroidUtilCode Expand file tree/ Copy pathreadme.gradleMore file actions 92 lines (86 loc) · 3.42 KB / Copy pathreadme.gradleFile metadata and controls92 lines (86 loc) · 3.42 KB 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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 import groovy.transform.Field @Field LINE_SEP = System.getProperty("line.separator") @Field LONG_SPACE = " " task readmeTask { doLast { def readmeCN = file("./utilcode/README-CN.md") def readmeEng = file("./utilcode/README.md") readmeOfUtilCode2Eng(readmeCN, readmeEng) readmeCN = file("./subutil/README-CN.md") readmeEng = file("./subutil/README.md") readmeOfSubUtil2Eng(readmeCN, readmeEng) } } def readmeOfUtilCode2Eng(File readmeCN, File readmeEng) { format(readmeCN) def lines = readmeCN.readLines("UTF-8") def sb = new StringBuilder() readmeCN.eachLine { line -> if (line.contains("* ###")) { String utilsName = line.substring(line.indexOf("[") + 1, line.indexOf("Utils")) sb.append("* ### About ").append(utilsName).append(line.substring(line.indexOf(" -> "))) } else if (line.contains(": ") && !line.contains("[")) { sb.append(line.substring(0, line.indexOf(':')).trim()) } else { sb.append(line) } sb.append(LINE_SEP) } readmeEng.write(sb.toString(), "UTF-8") } def readmeOfSubUtil2Eng(File readmeCN, File readmeEng) { format(readmeCN) def lines = readmeCN.readLines("UTF-8"), sb = new StringBuilder("## How to use" + LINE_SEP + LINE_SEP + "You should copy the following classes which you want to use in your project." + LINE_SEP), i = 3, size = lines.size() for (; i < size; ++i) { String line = lines.get(i) if (line.contains("* ###")) { String utilsName = line.substring(line.indexOf("[") + 1, line.indexOf("Utils")) sb.append("* ### About ").append(utilsName).append(line.substring(line.indexOf(" -> "))) } else if (line.contains(": ") && !line.contains("[")) { sb.append(line.substring(0, line.indexOf(':')).trim()) } else { sb.append(line) } sb.append(LINE_SEP) } readmeEng.write(sb.toString(), "UTF-8") } def format(File readmeCN) { def sb = new StringBuilder(), lines = readmeCN.readLines("UTF-8"), i = 0, size = lines.size() for (; i < size; ++i) { String line = lines.get(i) if (line.contains("* ###")) { sb.append(line).append(LINE_SEP) .append("```").append(LINE_SEP) def maxLen = 0 line = lines.get(i += 2) // get the max length of space for (def j = i; !line.equals("```"); line = lines.get(++j)) { maxLen = Math.max(maxLen, line.replace(" ", "").replace(",", ", ").indexOf(':')) } line = lines.get(i) for (; !line.equals("```"); line = lines.get(++i)) { def noSpaceLine = line.replace(" ", "") def spaceLen = maxLen - line.replace(" ", "").replace(",", ", ").indexOf(':') sb.append(noSpaceLine.substring(0, noSpaceLine.indexOf(':')).replace(",", ", ")) .append(LONG_SPACE.substring(0, spaceLen))// add the space .append(': ') .append(line.substring(line.indexOf(':') + 1).trim()) .append(LINE_SEP) } sb.append("```") } else { sb.append(line) } sb.append(LINE_SEP) } readmeCN.write(sb.toString(), "UTF-8") } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |