Commit 005db9f4 authored by Miguel Angel Reina Ortega's avatar Miguel Angel Reina Ortega
Browse files

Do not modify any text in code blocks

parent 59cd9a53
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -94,6 +94,10 @@ def replaceTableCaptions(progress:Progress, mdLines:list[str]) -> list[str]:
	_lines:list[str] = []
	for line in mdLines:
		matches = re.findall(tableregex, line)
		_inCodeBlock = checkInCodeBlock(line)
		if _inCodeBlock:
			_lines.append(line)
			continue
		if matches:
			# move the caption to the beginning of the table and add a "Table:" prefix
			_idx = len(_lines) - 1
@@ -121,6 +125,10 @@ def replaceFigureCaptions(progress:Progress, mdLines:list[str]) -> list[str]:
	_lines:list[str] = []
	for line in mdLines:
		matches = re.findall(figureregex, line)
		_inCodeBlock = checkInCodeBlock(line)
		if _inCodeBlock:
			_lines.append(line)
			continue
		if matches:
			# Replace the previous figure markdown name with the captions
			_idx = len(_lines) - 1
@@ -147,6 +155,11 @@ def replaceFiguresPathSvgToPng(progress: Progress, mdLines: list[str]) -> list[s
	_lines: list[str] = []
	for line in mdLines:
		matches = re.findall(figurePathRegex, line)
		_inCodeBlock = checkInCodeBlock(line)
		if _inCodeBlock:
			_lines.append(line)
			continue
		
		if matches:
			# Replace figure path to png
			_lines.append(re.sub(r'\.svg', f'.png', line))