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 11# See readme.md for instructions on running this code.
22import logging
33import string
4+ import subprocess
45from typing import Dict
56
6- import html2text
77import requests
88
99from zulip_bots .lib import AbstractBotHandler
@@ -66,8 +66,11 @@ def get_bot_define_response(self, original_content: str) -> str:
6666 # Show definitions line by line.
6767 for d in definitions :
6868 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+ )
6972 response += "\n " + "* (**{}**) {}\n {}" .format (
70- d ["type" ], d ["definition" ], html2text . html2text ( example )
73+ d ["type" ], d ["definition" ], example_text
7174 )
7275
7376 except Exception :
You can’t perform that action at this time.
0 commit comments