mirror of
https://github.com/kovidgoyal/kitty.git
synced 2026-08-04 06:36:24 +00:00
Also report submatch positions
This commit is contained in:
parent
dffb87ced9
commit
3078b9074a
2 changed files with 11 additions and 6 deletions
|
|
@ -51,9 +51,9 @@ func New(allow_escape_codes bool) *Context {
|
|||
|
||||
func replace_all_rst_roles(str string, repl func(rst_format_match) string) string {
|
||||
var m rst_format_match
|
||||
rf := func(full_match string, groupdict map[string]string) string {
|
||||
m.payload = groupdict["payload"]
|
||||
m.role = groupdict["role"]
|
||||
rf := func(full_match string, groupdict map[string]utils.SubMatch) string {
|
||||
m.payload = groupdict["payload"].Text
|
||||
m.role = groupdict["role"].Text
|
||||
return repl(m)
|
||||
}
|
||||
return utils.ReplaceAll(":(?P<role>[a-z]+):(?:(?:`(?P<payload>[^`]+)`)|(?:'(?P<payload>[^']+)'))", str, rf)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue