Make indentation in Clash profile consistent (#559)

This commit is contained in:
flosacca 2023-03-22 14:46:43 +08:00 committed by GitHub
parent a60551ac11
commit d3fa05a8fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -177,7 +177,7 @@ std::string rulesetToClashStr(YAML::Node &base_rule, std::vector<RulesetContent>
if(!overwrite_original_rules && base_rule[field_name].IsDefined()) if(!overwrite_original_rules && base_rule[field_name].IsDefined())
{ {
for(size_t i = 0; i < base_rule[field_name].size(); i++) for(size_t i = 0; i < base_rule[field_name].size(); i++)
output_content += " - " + safe_as<std::string>(base_rule[field_name][i]) + "\n"; output_content += " - " + safe_as<std::string>(base_rule[field_name][i]) + "\n";
} }
base_rule.remove(field_name); base_rule.remove(field_name);
@ -200,7 +200,7 @@ std::string rulesetToClashStr(YAML::Node &base_rule, std::vector<RulesetContent>
strLine += "," + rule_group; strLine += "," + rule_group;
if(count_least(strLine, ',', 3)) if(count_least(strLine, ',', 3))
strLine = regReplace(strLine, "^(.*?,.*?)(,.*)(,.*)$", "$1$3$2"); strLine = regReplace(strLine, "^(.*?,.*?)(,.*)(,.*)$", "$1$3$2");
output_content += " - " + strLine + "\n"; output_content += " - " + strLine + "\n";
total_rules++; total_rules++;
continue; continue;
} }
@ -228,7 +228,7 @@ std::string rulesetToClashStr(YAML::Node &base_rule, std::vector<RulesetContent>
strLine += "," + rule_group; strLine += "," + rule_group;
if(count_least(strLine, ',', 3)) if(count_least(strLine, ',', 3))
strLine = regReplace(strLine, "^(.*?,.*?)(,.*)(,.*)$", "$1$3$2"); strLine = regReplace(strLine, "^(.*?,.*?)(,.*)(,.*)$", "$1$3$2");
output_content += " - " + strLine + "\n"; output_content += " - " + strLine + "\n";
total_rules++; total_rules++;
} }
} }