adjust
Some checks failed
build_docker / build_cpu (pull_request) Has been cancelled
build_docker / build_gpu (pull_request) Has been cancelled
build_docker / build_easyocr (pull_request) Has been cancelled
build_docker / build_easyocr_gpu (pull_request) Has been cancelled
build_docker / build_doctr (pull_request) Has been cancelled
build_docker / build_doctr_gpu (pull_request) Has been cancelled
build_docker / build_raytune (pull_request) Has been cancelled
build_docker / essential (pull_request) Successful in 1s

This commit is contained in:
2026-01-20 12:01:05 +01:00
parent f5d1032e41
commit 7a3a47923b
2 changed files with 22 additions and 22 deletions

View File

@@ -121,13 +121,13 @@ def parse_md_to_html_blocks(md_content):
mermaid_lines.append(lines[i])
i += 1
# Try to extract title from mermaid content (YAML format: title: "...")
# Try to extract title from mermaid content (YAML format)
mermaid_content = '\n'.join(mermaid_lines)
# Match YAML format: title: "Title" or title: 'Title'
# Match title with quotes: title: "Something" or title: 'Something'
title_match = re.search(r'title:\s*["\']([^"\']+)["\']', mermaid_content)
if not title_match:
# Fallback to non-YAML format: title "Title"
title_match = re.search(r'title\s+["\']?([^"\'"\n]+)["\']?', mermaid_content)
# Match title without quotes: title: Something
title_match = re.search(r'title:\s*([^"\'\n]+)', mermaid_content)
if title_match:
fig_title = title_match.group(1).strip()
else:
@@ -145,7 +145,7 @@ def parse_md_to_html_blocks(md_content):
if os.path.exists(fig_path):
# Use Word-compatible width in cm (A4 text area is ~16cm wide, use ~12cm max)
html_blocks.append(f'''<p class=MsoNormal style="text-align:center"><span lang=ES><img style="max-width:16cm;max-height:20cm;width:auto;height:auto" src="{fig_file}" alt="{fig_title}"/></span></p>''')
html_blocks.append(f'''<p class=MsoNormal style="text-align:center"><span lang=ES><img width="604" style="width:16cm;display:block;margin:0 auto" src="{fig_file}" alt="{fig_title}"/></span></p>''')
else:
# Fallback to placeholder
html_blocks.append(f'''<p class=MsoNormal style="text-align:center;border:1px dashed #999;padding:20px;margin:10px 40px;background:#f9f9f9"><span lang=ES style="color:#666">[Insertar diagrama Mermaid aquí]</span></p>''')