This commit is contained in:
NAME
2022-07-03 03:57:23 -04:00
+7 -3
View File
@@ -1,5 +1,7 @@
import json import json
import sys import sys
import re
from urllib.request import urlopen from urllib.request import urlopen
Usage = """ Usage = """
@@ -11,6 +13,7 @@ try:
from rich.console import Console from rich.console import Console
from rich.panel import Panel from rich.panel import Panel
from rich.text import Text from rich.text import Text
from rich import print
HAS_RICH = 1 HAS_RICH = 1
except: except:
pass pass
@@ -63,11 +66,12 @@ def rich_paring(data):
for s in samples[:2]: for s in samples[:2]:
ens = s['en'].replace('"', '\"') ens = s['en'].replace('"', '\"')
panel = Panel(Text(ens, style="rgb(12,122,108)", justify="left")) ens = re.sub(r'\*\*([^ ]*?)\*\*', r'[/][red]\1[/][yellow4]', ens)
text = Text.from_markup("[yellow4]" + ens + "[/]", justify="left")
panel = Panel(text)
#console.print(ens, style="rgb(165,38,28)")
console.print(panel) console.print(panel)
#console.print(s['cn'], style="rgb(13,245,86)")
if __name__ == "__main__": if __name__ == "__main__":