Tweak how highlighter names are auto-generated

This commit is contained in:
Maxime Coste 2018-07-02 21:09:31 +10:00
parent 2e0e206951
commit 55a5ec3bbd
2 changed files with 1 additions and 3 deletions

View File

@ -763,7 +763,7 @@ const CommandDesc add_highlighter_cmd = {
throw runtime_error("no parent in path");
auto auto_name = [](ConstArrayView<String> params) {
return join(params | transform([](StringView s) { return replace(s, "/", "_"); }), "_");
return join(params | transform([](StringView s) { return replace(s, "/", "<slash>"); }), "<slash>");
};
String name{slash.base(), path.end()};

View File

@ -29,8 +29,6 @@ void HighlighterGroup::add_child(String name, std::unique_ptr<Highlighter>&& hl)
if ((hl->passes() & passes()) != hl->passes())
throw runtime_error{"cannot add that highlighter to this group, passes don't match"};
name = replace(name, "/", "<slash>");
if (m_highlighters.contains(name))
throw runtime_error(format("duplicate id: '{}'", name));