tablegen update
Some checks failed
build_docker / essential (pull_request) Successful in 0s
build_docker / build_cpu (pull_request) Successful in 3m48s
build_docker / build_gpu (pull_request) Successful in 16m57s
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 / build_easyocr (pull_request) Has been cancelled
Some checks failed
build_docker / essential (pull_request) Successful in 0s
build_docker / build_cpu (pull_request) Successful in 3m48s
build_docker / build_gpu (pull_request) Successful in 16m57s
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 / build_easyocr (pull_request) Has been cancelled
This commit is contained in:
@@ -285,7 +285,7 @@ python3 apply_content.py
|
||||
|
||||
### Contenido Generado Automáticamente
|
||||
|
||||
- **30 tablas** con formato APA (Tabla X. *Título* + Fuente: ...)
|
||||
- **53 tablas** con formato APA (Tabla X. *Título* + Fuente: ...)
|
||||
- **8 figuras** desde Mermaid (Figura X. *Título* + Fuente: Elaboración propia)
|
||||
- **25 referencias** en formato APA con sangría francesa
|
||||
- **Resumen/Abstract** con palabras clave
|
||||
|
||||
@@ -34,6 +34,8 @@ def md_to_html_para(text):
|
||||
text = re.sub(r'\*([^*]+)\*', r'<i>\1</i>', text)
|
||||
# Inline code
|
||||
text = re.sub(r'`([^`]+)`', r'<span style="font-family:Consolas;font-size:10pt">\1</span>', text)
|
||||
# Links [text](url) -> <a href="url">text</a>
|
||||
text = re.sub(r'\[([^\]]+)\]\(([^)]+)\)', r'<a href="\2">\1</a>', text)
|
||||
return text
|
||||
|
||||
def extract_table_title(lines, current_index):
|
||||
@@ -169,6 +171,7 @@ def parse_md_to_html_blocks(md_content):
|
||||
|
||||
# Check if previous line has table title (e.g., **Tabla 1.** *Title*)
|
||||
table_title = None
|
||||
alt_title = None # Alternative title from **bold text:** pattern
|
||||
table_source = "Elaboración propia"
|
||||
|
||||
# Look back for table title
|
||||
@@ -178,6 +181,9 @@ def parse_md_to_html_blocks(md_content):
|
||||
# Extract title text
|
||||
table_title = re.sub(r'\*+', '', prev_line).strip()
|
||||
break
|
||||
elif prev_line.startswith('**') and prev_line.endswith(':**'):
|
||||
# Alternative: **Bold title:** pattern (for informal tables)
|
||||
alt_title = re.sub(r'\*+', '', prev_line).rstrip(':').strip()
|
||||
elif prev_line and not prev_line.startswith('|'):
|
||||
break
|
||||
|
||||
@@ -198,26 +204,30 @@ def parse_md_to_html_blocks(md_content):
|
||||
# Word TOC looks for text with Caption style - anchor must be outside main caption text
|
||||
bookmark_id = f"_Ref_Tab{table_counter}"
|
||||
if table_title:
|
||||
clean_title = table_title.replace(f"Tabla {table_counter}.", "").strip()
|
||||
# Remove any "Tabla X." or "Tabla AX." pattern from the title
|
||||
clean_title = re.sub(r'^Tabla\s+[A-Z]?\d+\.\s*', '', table_title).strip()
|
||||
elif alt_title:
|
||||
# Use alternative title from **bold text:** pattern
|
||||
clean_title = alt_title
|
||||
else:
|
||||
clean_title = "Tabla de datos."
|
||||
html_blocks.append(f'''<a name="{bookmark_id}"></a><p class=MsoCaption><b><span lang=ES style="font-size:12.0pt;line-height:150%">Tabla <!--[if supportFields]><span style='mso-element:field-begin'></span> SEQ Tabla \\* ARABIC <span style='mso-element:field-separator'></span><![endif]-->{table_counter}<!--[if supportFields]><span style='mso-element:field-end'></span><![endif]-->.</span></b><span lang=ES style="font-size:12.0pt;line-height:150%"> </span><i><span lang=ES style="font-size:12.0pt;line-height:150%">{clean_title}</span></i></p>''')
|
||||
|
||||
# Build table HTML with APA style (horizontal lines only, no vertical)
|
||||
table_html = '<table class=MsoTableGrid border=0 cellspacing=0 cellpadding=0 style="border-collapse:collapse;border:none">'
|
||||
table_html = '<table class=MsoTableGrid border=1 cellspacing=0 cellpadding=0 style="border-collapse:collapse;margin-left:auto;margin-right:auto;mso-table-style-name:\'Plain Table 1\'">'
|
||||
for j, tline in enumerate(table_lines):
|
||||
cells = [c.strip() for c in tline.split('|')[1:-1]]
|
||||
table_html += '<tr>'
|
||||
for cell in cells:
|
||||
if j == 0:
|
||||
# Header row: top and bottom border, bold text
|
||||
table_html += f'<td style="border-top:solid windowtext 1.0pt;border-bottom:solid windowtext 1.0pt;border-left:none;border-right:none;padding:5px"><p class=MsoNormal style="margin:0"><b><span lang=ES>{md_to_html_para(cell)}</span></b></p></td>'
|
||||
table_html += f'<td style="border-top:solid windowtext 1.0pt;border-bottom:solid windowtext 1.0pt;border-left:none;border-right:none;padding:5px"><p class=MsoNormal style="margin:0;text-align:center"><b><span lang=ES>{md_to_html_para(cell)}</span></b></p></td>'
|
||||
elif j == len(table_lines) - 1:
|
||||
# Last row: bottom border only
|
||||
table_html += f'<td style="border-top:none;border-bottom:solid windowtext 1.0pt;border-left:none;border-right:none;padding:5px"><p class=MsoNormal style="margin:0"><span lang=ES>{md_to_html_para(cell)}</span></p></td>'
|
||||
table_html += f'<td style="border-top:none;border-bottom:solid windowtext 1.0pt;border-left:none;border-right:none;padding:5px"><p class=MsoNormal style="margin:0;text-align:center"><span lang=ES>{md_to_html_para(cell)}</span></p></td>'
|
||||
else:
|
||||
# Middle rows: no borders
|
||||
table_html += f'<td style="border:none;padding:5px"><p class=MsoNormal style="margin:0"><span lang=ES>{md_to_html_para(cell)}</span></p></td>'
|
||||
table_html += f'<td style="border:none;padding:5px"><p class=MsoNormal style="margin:0;text-align:center"><span lang=ES>{md_to_html_para(cell)}</span></p></td>'
|
||||
table_html += '</tr>'
|
||||
table_html += '</table>'
|
||||
html_blocks.append(table_html)
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user