Tweak how highlighter names are auto-generated
This commit is contained in:
parent
2e0e206951
commit
55a5ec3bbd
|
@ -763,7 +763,7 @@ const CommandDesc add_highlighter_cmd = {
|
||||||
throw runtime_error("no parent in path");
|
throw runtime_error("no parent in path");
|
||||||
|
|
||||||
auto auto_name = [](ConstArrayView<String> params) {
|
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()};
|
String name{slash.base(), path.end()};
|
||||||
|
|
|
@ -29,8 +29,6 @@ void HighlighterGroup::add_child(String name, std::unique_ptr<Highlighter>&& hl)
|
||||||
if ((hl->passes() & passes()) != hl->passes())
|
if ((hl->passes() & passes()) != hl->passes())
|
||||||
throw runtime_error{"cannot add that highlighter to this group, passes don't match"};
|
throw runtime_error{"cannot add that highlighter to this group, passes don't match"};
|
||||||
|
|
||||||
name = replace(name, "/", "<slash>");
|
|
||||||
|
|
||||||
if (m_highlighters.contains(name))
|
if (m_highlighters.contains(name))
|
||||||
throw runtime_error(format("duplicate id: '{}'", name));
|
throw runtime_error(format("duplicate id: '{}'", name));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user