Skip to content

Commit 61d30fd

Browse files
authored
Preserve whitespaces
1 parent 72de2d9 commit 61d30fd

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎tcl/emphasys.tcl‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ set SCRIPT_DESC "Replaces *text* whith bold and /text/ with italic (or reverse)"
1313
::weechat::register $SCRIPT_NAME $SCRIPT_AUTHOR $SCRIPT_VERSION $SCRIPT_LICENSE $SCRIPT_DESC {} {}
1414
::weechat::hook_modifier irc_out1_privmsg cmd_emphasys {}
1515

16-
set rebold {\s\*(.+)\*\s}
17-
set reital {\s\/(.+)\/\s}
16+
set rebold {(\s)\*(.+)\*(\s)}
17+
set reital {(\s)\/(.+)\/(\s)}
1818

1919
proc cmd_emphasys {data modifier modifier_data irc_msg} {
2020
set parts [split $irc_msg {:}]
2121
set input [lindex $parts end]
22-
regsub -all -- $::rebold $input "\002\\1\002" input
23-
regsub -all -- $::reital $input "\026\\1\026" input
22+
regsub -all -- $::rebold $input "\\1\002\\2\002\\3" input
23+
regsub -all -- $::reital $input "\\1\026\\2\026\\3" input
2424
return [join [lreplace $parts end end $input] {:}]
2525
return $::weechat::WEECHAT_RC_OK
2626
}

0 commit comments

Comments
 (0)