mirror of
https://github.com/markqvist/NomadNet.git
synced 2025-12-30 13:14:40 +01:00
Markup handling improvements
This commit is contained in:
@@ -1040,7 +1040,8 @@ class Browser:
|
||||
fg = self.markup[fgpos+5:endpos]
|
||||
self.page_foreground_color = fg
|
||||
|
||||
self.attr_maps = markup_to_attrmaps(strip_modifiers(self.markup), url_delegate=self, fg_color=self.page_foreground_color, bg_color=self.page_background_color)
|
||||
try: self.attr_maps = markup_to_attrmaps(strip_modifiers(self.markup), url_delegate=self, fg_color=self.page_foreground_color, bg_color=self.page_background_color)
|
||||
except Exception as e: self.attr_maps = [urwid.AttrMap(urwid.Text(f"Could not render page: {e}"), "inactive_text")]
|
||||
|
||||
self.response_progress = 0
|
||||
self.response_speed = None
|
||||
@@ -1107,7 +1108,8 @@ class Browser:
|
||||
fg = self.markup[fgpos+5:endpos]
|
||||
self.page_foreground_color = fg
|
||||
|
||||
self.attr_maps = markup_to_attrmaps(strip_modifiers(self.markup), url_delegate=self, fg_color=self.page_foreground_color, bg_color=self.page_background_color)
|
||||
try: self.attr_maps = markup_to_attrmaps(strip_modifiers(self.markup), url_delegate=self, fg_color=self.page_foreground_color, bg_color=self.page_background_color)
|
||||
except Exception as e: self.attr_maps = [urwid.AttrMap(urwid.Text(f"Could not render page: {e}"), "inactive_text")]
|
||||
|
||||
self.response_progress = 0
|
||||
self.response_speed = None
|
||||
@@ -1259,7 +1261,9 @@ class Browser:
|
||||
fg = self.markup[fgpos+5:endpos]
|
||||
self.page_foreground_color = fg
|
||||
|
||||
self.attr_maps = markup_to_attrmaps(strip_modifiers(self.markup), url_delegate=self, fg_color=self.page_foreground_color, bg_color=self.page_background_color)
|
||||
try: self.attr_maps = markup_to_attrmaps(strip_modifiers(self.markup), url_delegate=self, fg_color=self.page_foreground_color, bg_color=self.page_background_color)
|
||||
except Exception as e: self.attr_maps = [urwid.AttrMap(urwid.Text(f"Could not render page: {e}"), "inactive_text")]
|
||||
|
||||
self.response_progress = 0
|
||||
self.response_speed = None
|
||||
self.progress_updated_at = None
|
||||
|
||||
@@ -146,6 +146,12 @@ def parse_line(line, state, url_delegate):
|
||||
|
||||
# Only parse content if not in literal state
|
||||
if not state["literal"]:
|
||||
# Apply markup sanitization
|
||||
if first_char == ">" and "`<" in line:
|
||||
# Remove heading status from lines containing fields
|
||||
line = line.lstrip(">")
|
||||
first_char = line[0]
|
||||
|
||||
# Check if the command is an escape
|
||||
if first_char == "\\":
|
||||
line = line[1:]
|
||||
|
||||
Reference in New Issue
Block a user