Delete utils
Browse files- utils/ignore.txt +0 -0
- utils/preprocessor.py +0 -48
utils/ignore.txt
DELETED
|
File without changes
|
utils/preprocessor.py
DELETED
|
@@ -1,48 +0,0 @@
|
|
| 1 |
-
import re
|
| 2 |
-
|
| 3 |
-
class Preprocessor:
|
| 4 |
-
"""
|
| 5 |
-
Provides methods to preprocess markdown content:
|
| 6 |
-
- extract a section after a specific keyword
|
| 7 |
-
- extract directories from markdown links
|
| 8 |
-
- extract file paths from markdown links
|
| 9 |
-
"""
|
| 10 |
-
|
| 11 |
-
@staticmethod
|
| 12 |
-
def extract_section(markdown_content, keyword="Latest commit"):
|
| 13 |
-
"""
|
| 14 |
-
Extract lines starting from the line after the one containing
|
| 15 |
-
'keyword' up to the next empty line.
|
| 16 |
-
"""
|
| 17 |
-
lines = markdown_content.splitlines()
|
| 18 |
-
extract = []
|
| 19 |
-
found = False
|
| 20 |
-
for i, line in enumerate(lines):
|
| 21 |
-
if not found and keyword in line:
|
| 22 |
-
found = True
|
| 23 |
-
# Start collecting from the next line
|
| 24 |
-
start_idx = i + 1
|
| 25 |
-
while start_idx < len(lines):
|
| 26 |
-
next_line = lines[start_idx]
|
| 27 |
-
if next_line.strip() == "":
|
| 28 |
-
break
|
| 29 |
-
extract.append(next_line)
|
| 30 |
-
start_idx += 1
|
| 31 |
-
break
|
| 32 |
-
return "\n".join(extract) if extract else f"No content found after '{keyword}'."
|
| 33 |
-
|
| 34 |
-
@staticmethod
|
| 35 |
-
def extract_dirs_from_text(text):
|
| 36 |
-
"""
|
| 37 |
-
Extract unique directory paths from markdown links in text.
|
| 38 |
-
Only the path part before the filename is kept.
|
| 39 |
-
"""
|
| 40 |
-
pattern = r'\((/[^ )]+)\s+"([^"]+)"\)'
|
| 41 |
-
matches = re.findall(pattern, text)
|
| 42 |
-
dirs = set()
|
| 43 |
-
files = set()
|
| 44 |
-
for match in matches:
|
| 45 |
-
dirs.add(match[0])
|
| 46 |
-
if not match[1].startswith("."):
|
| 47 |
-
files.add(match[1])
|
| 48 |
-
return dirs, files
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|