Skip to content

Commit 2d9cb26

Browse files
Rossi-Lucianoclaude
andcommitted
Corrige KeyError em reftype/refid nos blocos book e thesis de xml.py
Dois acessos diretos a values["reftype"] sobreviveram à resolução de conflito do rebase. Substituídos por values.get("reftype") para não lançar KeyError quando o LLM não parseia o tipo da referência. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 5fd4849 commit 2d9cb26

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

markup_doc/xml.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ def get_xml(article_docx, data_front, data, data_back, xref_map=None):
916916
node_elem = etree.SubElement(
917917
node_ref,
918918
"element-citation",
919-
attrib={"publication-type": values["reftype"]},
919+
attrib={"publication-type": values.get("reftype")},
920920
)
921921
node_person = etree.SubElement(
922922
node_elem, "person-group", attrib={"person-group-type": "author"}
@@ -1060,11 +1060,11 @@ def get_xml(article_docx, data_front, data, data_back, xref_map=None):
10601060
)
10611061
append_fragment(etree.SubElement(node_ref, "page"), values["pages"])
10621062

1063-
if values["reftype"] == "thesis":
1063+
if values.get("reftype") == "thesis":
10641064
node_elem = etree.SubElement(
10651065
node_ref,
10661066
"element-citation",
1067-
attrib={"publication-type": values["reftype"]},
1067+
attrib={"publication-type": values.get("reftype")},
10681068
)
10691069
node_person = etree.SubElement(
10701070
node_elem, "person-group", attrib={"person-group-type": "author"}

0 commit comments

Comments
 (0)