File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
zulip_bots/zulip_bots/bots/define Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 1
1
# See readme.md for instructions on running this code.
2
2
import logging
3
3
import string
4
+ import subprocess
4
5
from typing import Dict
5
6
6
- import html2text
7
7
import requests
8
8
9
9
from zulip_bots .lib import AbstractBotHandler
@@ -66,8 +66,11 @@ def get_bot_define_response(self, original_content: str) -> str:
66
66
# Show definitions line by line.
67
67
for d in definitions :
68
68
example = d ["example" ] if d ["example" ] else "*No example available.*"
69
+ example_text = subprocess .check_output (
70
+ ["html2text" , "--unicode-snob" ], input = example , text = True
71
+ )
69
72
response += "\n " + "* (**{}**) {}\n {}" .format (
70
- d ["type" ], d ["definition" ], html2text . html2text ( example )
73
+ d ["type" ], d ["definition" ], example_text
71
74
)
72
75
73
76
except Exception :
You can’t perform that action at this time.
0 commit comments