| 146 | |
| 147 | |
| 148 | static const string _get_indent(const string &s) |
| 149 | { |
| 150 | size_t prefix = 0; |
| 151 | if (starts_with(s, "\"") // ASCII quotes |
| 152 | || starts_with(s, "“") // English quotes |
| 153 | || starts_with(s, "„") // Polish/German/... quotes |
| 154 | || starts_with(s, "«") // French quotes |
| 155 | || starts_with(s, "»") // Danish/... quotes |
| 156 | || starts_with(s, "•")) // bulleted lists |
| 157 | { |
| 158 | prefix = 1; |
| 159 | } |
| 160 | else if (starts_with(s, "「")) // Chinese/Japanese quotes |
| 161 | prefix = 2; |
| 162 | |
| 163 | size_t nspaces = s.find_first_not_of(' ', prefix); |
| 164 | if (nspaces == string::npos) |
| 165 | nspaces = 0; |
| 166 | if (!(prefix += nspaces)) |
| 167 | return ""; |
| 168 | return string(prefix, ' '); |
| 169 | } |
| 170 | |
| 171 | |
| 172 | // The provided string is consumed! |
no test coverage detected