| 62 | } |
| 63 | |
| 64 | std::string handleLineSeparator(const std::string& original, const std::string& formatted, const Config& config) { |
| 65 | const auto line_separator_config = config.get<std::string>("line_separator"); |
| 66 | auto out = formatted; |
| 67 | if (line_separator_config == "os") { |
| 68 | out = convert_line_separator(out, getOSLineSeparator()); |
| 69 | } else if (line_separator_config == "input") { |
| 70 | auto line_sep = get_line_separator(original); |
| 71 | out = convert_line_separator(out, line_sep); |
| 72 | } else if (line_separator_config == "lf") { |
| 73 | out = convert_line_separator(out, "\n"); |
| 74 | } else if (line_separator_config == "cr") { |
| 75 | out = convert_line_separator(out, "\r"); |
| 76 | } else if (line_separator_config == "crlf") { |
| 77 | out = convert_line_separator(out, "\r\n"); |
| 78 | } else { |
| 79 | throw std::runtime_error("Should not reach here. Invalid line_separator config"); |
| 80 | } |
| 81 | return out; |
| 82 | } |
| 83 | |
| 84 | std::string resetContentInDisableFormatBlocks(const std::string& original, const std::string& formatted) { |
| 85 | std::vector<std::pair<size_t, size_t>> originalBlocks = findBlocksBetweenFormatSwitch(original); |
no test coverage detected