librime icon indicating copy to clipboard operation
librime copied to clipboard

配置的 key 是 / 的时候,.custom.yaml 中如何书写路径?

Open Streamlet opened this issue 1 year ago • 8 comments

例如 原配置 (luna_pinyin.schema.yaml)

punctuator:
  half_shape:
    # ...
    "/": ["、", "、", "/", "/", "÷"]
    # ...

我想改成 "/": "/",但不想把 half_shape 下的所有内容都抄一遍, 那么我理论上应该写成: (luna_pinyin.custom.yaml)

patch:
  punctuator/half_shape/<斜杠>: "/"

此处 <斜杠> 该如何表达?

我看到 config_data.cc 里都是直接 SplitPath、JoinPath 的:

vector<string> ConfigData::SplitPath(const string& path) {
  vector<string> keys;
  auto is_separator = boost::is_any_of("/");
  auto trimmed_path = boost::trim_left_copy_if(path, is_separator);
  boost::split(keys, trimmed_path, is_separator);
  return keys;
}

string ConfigData::JoinPath(const vector<string>& keys) {
  return boost::join(keys, "/");
}

并没有对 / 做转义

Streamlet avatar Jul 12 '23 11:07 Streamlet