Skip to content

Commit

Permalink
Merge pull request #290 from samuelveigarangel/issue-283
Browse files Browse the repository at this point in the history
Verifica a existência de resumo traduzido na classe XMLArticleAbstracttPipe;
  • Loading branch information
robertatakenaka authored Dec 17, 2024
2 parents b2c81bb + dd38019 commit c6562aa
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions articlemeta/export_crossref.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ def precond(data):

raw, xml = data

if not raw.original_abstract() or not raw.translated_abstracts():
if not raw.original_abstract():
raise plumber.UnmetPrecondition()

@plumber.precondition(precond)
Expand All @@ -519,13 +519,14 @@ def transform(self, data):
abstract.append(paragraph)
abstracts = {raw.original_language(): abstract}

for language, body in raw.translated_abstracts().items():
paragraph = ET.Element('{http://www.ncbi.nlm.nih.gov/JATS1}p')
paragraph.text = body
abstract = ET.Element('{http://www.ncbi.nlm.nih.gov/JATS1}abstract')
abstract.set('{http://www.w3.org/XML/1998/namespace}lang', language)
abstract.append(paragraph)
abstracts[language] = abstract
if raw.translated_abstracts():
for language, body in raw.translated_abstracts().items():
paragraph = ET.Element('{http://www.ncbi.nlm.nih.gov/JATS1}p')
paragraph.text = body
abstract = ET.Element('{http://www.ncbi.nlm.nih.gov/JATS1}abstract')
abstract.set('{http://www.w3.org/XML/1998/namespace}lang', language)
abstract.append(paragraph)
abstracts[language] = abstract

for journal_article in xml.findall('./body/journal//journal_article'):
language = journal_article.get("language")
Expand Down

0 comments on commit c6562aa

Please sign in to comment.