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

Some fixes:

- the complete ToC clause is analysed (between clause marks)
- figura caption regexp to catch figure caption in any part of the line
parent e2b9c0b2
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -67,6 +67,8 @@ def correctTOC(progress:Progress, mdLines:list[str], tocSection:str = 'Contents'
				continue
			else:
				_lines.append(line)
		else:
			_lines.append(line)

	progress.stop_task(_taskID)
	return _lines
@@ -112,11 +114,10 @@ def replaceFigureCaptions(progress:Progress, mdLines:list[str]) -> list[str]:
		if matches:
			# Replace the previous figure markdown name with the captions
			_idx = len(_lines) - 1
			while _idx >= 0 and not _lines[_idx].startswith('!['):
			while _idx >= 0 and _lines[_idx].count('![') == 0:
				_idx -= 1
			if _idx > 0:
				_lines[_idx] = re.sub(r'^.*?]', f'![{matches[0]}]', _lines[_idx])

				_lines[_idx] = re.sub(r'!.*]', f'![{matches[0]}]', _lines[_idx])
		elif re.findall(nocaptionfigureregex, line):
			_lines.append(re.sub(r'^.*?]', f'![]', line))
		else: