upgrade hyperlink: can now CONTAIN and be interlaced with other syntaxes
This commit is contained in:
parent
428cc0945e
commit
943e61119c
|
@ -10,7 +10,7 @@ type export string
|
||||||
var Export = export("hyperlink")
|
var Export = export("hyperlink")
|
||||||
|
|
||||||
func (syn export) Regex() *regexp.Regexp {
|
func (syn export) Regex() *regexp.Regexp {
|
||||||
return regexp.MustCompile(`(?m)\[([^\[]+)\]\(([^\)]+)\)`)
|
return regexp.MustCompile(`(?m)([^\033])\[([^(?:\]()]+)\]\(([^\)]+)\)`)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (syn export) Transform(args ...string) (string, error) {
|
func (syn export) Transform(args ...string) (string, error) {
|
||||||
|
@ -19,5 +19,8 @@ func (syn export) Transform(args ...string) (string, error) {
|
||||||
return "", nil
|
return "", nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Sprintf("\x1b]8;;%s\x1b\\%s\x1b]8;;\x1b\\", args[1], args[0]), nil
|
linkstart := fmt.Sprintf("\x1b]8;;%s\x1b\\", args[2])
|
||||||
|
linkend := fmt.Sprintf("\x1b]8;;\x1b\\")
|
||||||
|
|
||||||
|
return fmt.Sprintf("%s%s%s%s", args[0], linkstart, args[1], linkend), nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue