Implementar função para corrigir inline-graphic mal posicionados em caption e label #1040
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Descrição
Este PR implementa uma função utilitária para corrigir automaticamente elementos
inline-graphicincorretamente posicionados dentro delabeloucaption, movendo-os para a posição correta e renomeando-os paragraphic, conforme especificação SPS (SciELO Publishing Schema).Problema
Durante a migração de plataforma, diversos XMLs apresentam elementos
inline-graphicposicionados incorretamente dentro decaptionoulabel, o que não está conforme com o padrão SPS e causa problemas no processamento pelos sistemas SciELO.Exemplo de XML incorreto:
Exemplo de XML corrigido:
Solução Implementada
Foi criada a função
fix_inline_graphic_in_caption_and_label()no módulo/packtools/sps/utils/xml_fixer.pyque:inline-graphicdentro delabeloucaptionusando XPathgraphicno elemento pai (fig, table-wrap, boxed-text, etc.)inline-graphicparagraphicapenas quando não existirgraphicno paiUso da Função
Características
graphicjá existir no paiTestes
Foram implementados 11 testes abrangentes que validam:
Resultado dos testes:
Arquivos Modificados
packtools/sps/utils/xml_fixer.py- Módulo com função de correçãotests/sps/utils/test_xml_fixer.py- Suite de testes unitáriosReferências
Closes #[número do issue]
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.