Skip to content

Commit fae0078

Browse files
committed
Move markdown escaping to Misc.pm6
Because this way we will be able to reuse this terrible hack later.
1 parent fa442f1 commit fae0078

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Greppable.p6

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ sub process-line($line) { # 🙈
4949
$path # not a module
5050
}
5151
$text = shorten $text, 300; # do not print too long lines
52-
$text .= trans: (<, >, &, \, `, *, _, ~) =>
53-
(\<, \>, \&, \\, \`, \*, \_, \~); # 」; # TODO is it correct? No, that's an ugly hack…
52+
$text = markdown-escape($text);
5453
$text ~~ s:g/ “\c[ESC][1;31m” (.*?) [ “\c[ESC][m” | $ ] /<b>{$0}<\/b>/; # TODO get rid of \/ ?
5554

5655
$start <code>{$text}</code> ~ <br>

Misc.pm6

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,9 @@ sub fuzzy-nick($nick, $distance) is export {
3636
sub signal-to-text($signal) is export {
3737
$signal ({Signal($signal) // None})
3838
}
39+
40+
sub markdown-escape($text) is export {
41+
# TODO is it correct? No, that's an ugly hack…
42+
$text.trans: (<, >, &, \, `, *, _, ~) =>
43+
(\<, \>, \&, \\, \`, \*, \_, \~); # 」);
44+
}

0 commit comments

Comments
 (0)