Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -67,6 +67,8 @@ def correctTOC(progress:Progress, mdLines:list[str], tocSection:str = 'Contents' ...@@ -67,6 +67,8 @@ def correctTOC(progress:Progress, mdLines:list[str], tocSection:str = 'Contents'
continue continue
else: else:
_lines.append(line) _lines.append(line)
else:
_lines.append(line)
progress.stop_task(_taskID) progress.stop_task(_taskID)
return _lines return _lines
...@@ -112,11 +114,10 @@ def replaceFigureCaptions(progress:Progress, mdLines:list[str]) -> list[str]: ...@@ -112,11 +114,10 @@ def replaceFigureCaptions(progress:Progress, mdLines:list[str]) -> list[str]:
if matches: if matches:
# Replace the previous figure markdown name with the captions # Replace the previous figure markdown name with the captions
_idx = len(_lines) - 1 _idx = len(_lines) - 1
while _idx >= 0 and not _lines[_idx].startswith('!['): while _idx >= 0 and _lines[_idx].count('![') == 0:
_idx -= 1 _idx -= 1
if _idx > 0: 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): elif re.findall(nocaptionfigureregex, line):
_lines.append(re.sub(r'^.*?]', f'![]', line)) _lines.append(re.sub(r'^.*?]', f'![]', line))
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment