| 12 | } |
| 13 | |
| 14 | std::string repair(const std::string& str) { |
| 15 | std::string result; |
| 16 | result.reserve(str.size()); |
| 17 | bool isLeft = true; |
| 18 | bool inCode = false; |
| 19 | bool inTip = false; |
| 20 | int XingCounter = 0; |
| 21 | int dddCounter = 0; |
| 22 | for (int i = 0; i < str.size(); i++) { |
| 23 | result = result + str[i]; |
| 24 | if (result.back() == '`') { |
| 25 | dddCounter++; |
| 26 | } |
| 27 | else { |
| 28 | if (dddCounter == 3) { |
| 29 | inCode = !inCode; |
| 30 | } |
| 31 | if (dddCounter == 1) { |
| 32 | inTip = !inTip; |
| 33 | } |
| 34 | dddCounter = 0; |
| 35 | } |
| 36 | |
| 37 | if (result.back() == '*' && !inCode && !inTip) { |
| 38 | XingCounter++; |
| 39 | } |
| 40 | else { |
| 41 | if (XingCounter == 2) { |
| 42 | if (isLeft) { |
| 43 | if (result.size() > 3 && !isSeparator(result[result.size() - 4])) { |
| 44 | result.insert(result.size() - 3, " "); |
| 45 | } |
| 46 | isLeft = false; |
| 47 | } |
| 48 | else { |
| 49 | if (!isSeparator(result.back())) { |
| 50 | result.insert(result.size() - 1, " "); |
| 51 | } |
| 52 | isLeft = true; |
| 53 | } |
| 54 | } |
| 55 | XingCounter = 0; |
| 56 | } |
| 57 | } |
| 58 | return result; |
| 59 | } |
| 60 | |
| 61 | void traverse(directory_iterator trans, string str = " ") { |
| 62 | while (!trans._At_end()) { |
no test coverage detected