From c6f2c2fd7e430ebb078a1a6ae06b9c282bfe32a8 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Sun, 2 Feb 2025 15:34:03 -0800 Subject: [PATCH] UI: style improvements --- modules/html_generator.py | 49 --------------------------------------- 1 file changed, 49 deletions(-) diff --git a/modules/html_generator.py b/modules/html_generator.py index 3edbef5e..6bad0f89 100644 --- a/modules/html_generator.py +++ b/modules/html_generator.py @@ -106,52 +106,6 @@ def replace_blockquote(m): return m.group().replace('\n', '\n> ').replace('\\begin{blockquote}', '').replace('\\end{blockquote}', '') -def add_long_list_class(html): - ''' - Adds a long-list class to
or
- def is_within_block(start_idx, end_idx, block_matches):
- return any(start < start_idx < end or start < end_idx < end for start, end in block_matches)
-
- # Find all ...
and ... blocks
- pre_blocks = [(m.start(), m.end()) for m in re.finditer(r'.*? ', html, re.DOTALL)]
- code_blocks = [(m.start(), m.end()) for m in re.finditer(r' or
-
- opening_tag = match.group(1)
- list_content = match.group(2)
- closing_tag = match.group(3)
-
- # Find all list items within this list
- li_matches = li_pattern.finditer(list_content)
- has_long_item = any(len(li_match.group(1).strip()) > 224 for li_match in li_matches)
-
- if has_long_item:
- # Add class="long-list" to the opening tag if it doesn't already have a class
- if 'class=' not in opening_tag:
- opening_tag = opening_tag[:-1] + ' class="long-list">'
- else:
- # If there's already a class, append long-list to it
- opening_tag = re.sub(r'class="([^"]*)"', r'class="\1 long-list"', opening_tag)
-
- return opening_tag + list_content + closing_tag
-
- # Process HTML and replace list blocks
- return list_pattern.sub(process_list, html)
-
-
@functools.lru_cache(maxsize=None)
def convert_to_markdown(string):
if not string:
@@ -251,9 +205,6 @@ def convert_to_markdown(string):
# Unescape backslashes
html_output = html_output.replace('\\\\', '\\')
- # Add "long-list" class to or containing a long - item
- html_output = add_long_list_class(html_output)
-
return html_output