Skip to content

Commit

Permalink
boxes: Use pygments:w style for inline code.
Browse files Browse the repository at this point in the history
This comment introduces the same style used for plain codeblocks
for inline code.

Tests amended.
  • Loading branch information
Rohitth007 committed Jul 15, 2021
1 parent 71ff4f7 commit 01ea552
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/ui/test_ui_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1324,7 +1324,7 @@ def test_private_message_to_self(self, mocker):
[("msg_mention", "@A Group")],
id="group-mention",
),
case("<code>some code", [("msg_code", "some code")], id="code"),
case("<code>some code", [("pygments:w", "some code")], id="inline-code"),
case(
'<div class="codehilite" data-code-language="python">'
"<pre><span></span>"
Expand Down
1 change: 0 additions & 1 deletion zulipterminal/config/themes.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
'msg_link' : '',
'msg_link_index' : 'bold',
'msg_quote' : 'underline',
'msg_code' : 'bold',
'msg_bold' : 'bold',
'msg_time' : 'bold',
'footer' : 'standout',
Expand Down
1 change: 0 additions & 1 deletion zulipterminal/themes/gruvbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ class GruvBoxColor(Enum):
'msg_link' : (Color.BRIGHT_BLUE, Color.DARK0_HARD),
'msg_link_index' : (Color.BRIGHT_BLUE__BOLD, Color.DARK0_HARD),
'msg_quote' : (Color.FADED_YELLOW, Color.DARK0_HARD),
'msg_code' : (Color.DARK0_HARD, Color.LIGHT2),
'msg_bold' : (Color.LIGHT2__BOLD, Color.DARK0_HARD),
'msg_time' : (Color.DARK0_HARD, Color.LIGHT2),
'footer' : (Color.DARK0_HARD, Color.LIGHT4),
Expand Down
1 change: 0 additions & 1 deletion zulipterminal/themes/zt_blue.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
'msg_link' : (Color.DARK_BLUE, Color.LIGHT_GRAY),
'msg_link_index' : (Color.DARK_BLUE__BOLD, Color.LIGHT_GRAY),
'msg_quote' : (Color.BROWN, Color.DARK_BLUE),
'msg_code' : (Color.DARK_BLUE, Color.WHITE),
'msg_bold' : (Color.WHITE__BOLD, Color.DARK_BLUE),
'msg_time' : (Color.DARK_BLUE, Color.WHITE),
'footer' : (Color.WHITE, Color.DARK_GRAY),
Expand Down
1 change: 0 additions & 1 deletion zulipterminal/themes/zt_dark.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
'msg_link' : (Color.LIGHT_BLUE, Color.BLACK),
'msg_link_index' : (Color.LIGHT_BLUE__BOLD, Color.BLACK),
'msg_quote' : (Color.BROWN, Color.BLACK),
'msg_code' : (Color.BLACK, Color.WHITE),
'msg_bold' : (Color.WHITE__BOLD, Color.BLACK),
'msg_time' : (Color.BLACK, Color.WHITE),
'footer' : (Color.BLACK, Color.LIGHT_GRAY),
Expand Down
1 change: 0 additions & 1 deletion zulipterminal/themes/zt_light.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
'msg_link' : (Color.DARK_BLUE, Color.WHITE),
'msg_link_index' : (Color.DARK_BLUE__BOLD, Color.WHITE),
'msg_quote' : (Color.BLACK, Color.BROWN),
'msg_code' : (Color.BLACK, Color.LIGHT_GRAY),
'msg_bold' : (Color.WHITE__BOLD, Color.DARK_GRAY),
'msg_time' : (Color.WHITE, Color.DARK_GRAY),
'footer' : (Color.WHITE, Color.DARK_GRAY),
Expand Down
9 changes: 7 additions & 2 deletions zulipterminal/ui_tools/boxes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1212,8 +1212,13 @@ def soup2markup(
# BLOCKQUOTE TEXT
markup.append(("msg_quote", cls.soup2markup(element, metadata)[0]))
elif tag == "code":
# CODE (INLINE?)
markup.append(("msg_code", tag_text))
"""
CODE INLINE
-----------
Uses the same style as plain text codeblocks
which is the `whitespace` token of pygments.
"""
markup.append(("pygments:w", tag_text))
elif tag == "div" and "codehilite" in tag_classes:
"""
CODE BLOCK
Expand Down

0 comments on commit 01ea552

Please sign in to comment.