From 2de592583cec1cac4f5d5a31b3afde54f06c061a Mon Sep 17 00:00:00 2001
From: ankraft <an.kraft@gmail.com>
Date: Sat, 17 Feb 2024 13:48:56 +0100
Subject: [PATCH] Improved <br/> regex. fixed wrong progress usage

---
 generateChangemarks/pandocFilter.py | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/generateChangemarks/pandocFilter.py b/generateChangemarks/pandocFilter.py
index 75e78be..19294e3 100644
--- a/generateChangemarks/pandocFilter.py
+++ b/generateChangemarks/pandocFilter.py
@@ -14,7 +14,7 @@ from rich.progress import Progress, TextColumn, TimeElapsedColumn
 def readMDFile(progress:Progress, document:str) -> list[str]:
 	"""	Read the markdown file and return a list of lines.
 	"""	
-	_taskID = progress.add_task('[blue]Reading document', start=False, total=0)
+	_taskID = progress.add_task('[blue]Reading document', total=0)
 
 	# Check if file exists
 	if not os.path.exists(document):
@@ -31,7 +31,7 @@ def writeMDFile(progress:Progress, mdLines:list[str], document:str, outDirectory
 	"""	Write the markdown file.
 
 	"""
-	_taskID = progress.add_task('[blue]Writing document', start=False, total=0)
+	_taskID = progress.add_task('[blue]Writing document', total=0)
 
 	# Write the file
 	with open(f'{outDirectory}/{os.path.basename(document)}', 'w', encoding='utf-8', errors = 'replace') as f:
@@ -42,7 +42,7 @@ def writeMDFile(progress:Progress, mdLines:list[str], document:str, outDirectory
 def correctTOC(progress:Progress, mdLines:list[str], tocSection:str = 'Contents') -> list[str]:
 	"""	Correct the TOC to be compatible with pandoc.
 	"""
-	_taskID = progress.add_task('[blue]Correcting TOC', start=False, total=0)
+	_taskID = progress.add_task('[blue]Correcting TOC', total=0)
 
 	_contents = f'# {tocSection}\n'
 	tocregex = re.compile('^(.*\[.*\])')
@@ -77,7 +77,7 @@ def correctTOC(progress:Progress, mdLines:list[str], tocSection:str = 'Contents'
 def replaceTableCaptions(progress:Progress, mdLines:list[str]) -> list[str]:
 	"""	Replace table captions with a pandoc table caption.
 	"""
-	_taskID = progress.add_task('[blue]Replacing table captions', start=False, total=0)
+	_taskID = progress.add_task('[blue]Replacing table captions', total=0)
 	# progress.update()
 	tableregex = re.compile('^\*\*(Table .*)\*\*')
 	
@@ -103,7 +103,7 @@ def replaceTableCaptions(progress:Progress, mdLines:list[str]) -> list[str]:
 def replaceFigureCaptions(progress:Progress, mdLines:list[str]) -> list[str]:
 	"""	Replace figure captions with a pandoc figure caption.
 	"""
-	_taskID = progress.add_task('[blue]Replacing figure captions', start=False, total=0)
+	_taskID = progress.add_task('[blue]Replacing figure captions', total=0)
 	# progress.update()
 	figureregex = re.compile('^\*\*(Figure .*)\*\*')
 	nocaptionfigureregex = re.compile('!\[~~CAPTION~~\].*')
@@ -130,9 +130,9 @@ def replaceFigureCaptions(progress:Progress, mdLines:list[str]) -> list[str]:
 def replaceLineBreaks(progress: Progress, mdLines: list[str]) -> list[str]:
 	"""	Replace <br /> linebreaks by pandoc escaped_line_breaks extension \(newline).
 	"""
-	_taskID = progress.add_task('[blue]Replacing linebreaks', start=False, total=0)
+	_taskID = progress.add_task('[blue]Replacing linebreaks', total=0)
 	# progress.update()
-	linebreaksregex = re.compile('<br\s*/?\s*>')
+	linebreaksregex = re.compile('<\s*br\s*/?\s*>')
 
 	_lines: list[str] = []
 	_inCodeBlock = False
-- 
GitLab