From 315da95a16d0f86bf60798d79eb6a47704576a3c Mon Sep 17 00:00:00 2001 From: Roberta Takenaka Date: Fri, 27 Jan 2023 10:21:51 -0300 Subject: [PATCH 01/13] =?UTF-8?q?Corrige=20texto=20sobre=20v=C3=ADnculo=20?= =?UTF-8?q?de=20adendo=20com=20o=20documento=20relacionado?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../htmlgenerator/v2.0/article-meta-related-article.xsl | 1 + packtools/catalogs/htmlgenerator/v2.0/config-labels.xml | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packtools/catalogs/htmlgenerator/v2.0/article-meta-related-article.xsl b/packtools/catalogs/htmlgenerator/v2.0/article-meta-related-article.xsl index 463e8cc8e..d2773829f 100644 --- a/packtools/catalogs/htmlgenerator/v2.0/article-meta-related-article.xsl +++ b/packtools/catalogs/htmlgenerator/v2.0/article-meta-related-article.xsl @@ -45,6 +45,7 @@ do site. --> + This addendum adds information to the following document This erratum corrects This retraction retracts This document comments diff --git a/packtools/catalogs/htmlgenerator/v2.0/config-labels.xml b/packtools/catalogs/htmlgenerator/v2.0/config-labels.xml index 96107acb7..46e100b53 100644 --- a/packtools/catalogs/htmlgenerator/v2.0/config-labels.xml +++ b/packtools/catalogs/htmlgenerator/v2.0/config-labels.xml @@ -488,9 +488,9 @@ Este documento fue comentado por - This document has an addendum - This document has an addendum - Este documento tem um adendo - Este documento tiene una addenda + This addendum adds information to the following document + This addendum adds information to the following document + Este adendo adiciona informação ao documento + Esta addenda agrega información al documento \ No newline at end of file From 6a7446db391069edca530d5ff7bf6ca2381f7d67 Mon Sep 17 00:00:00 2001 From: Roberta Takenaka Date: Fri, 27 Jan 2023 11:02:06 -0300 Subject: [PATCH 02/13] Muda o modo de instancia FundingGroup. Troca str por xmltree --- packtools/sps/models/funding_group.py | 6 ++---- tests/test_funding_group.py | 10 +++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/packtools/sps/models/funding_group.py b/packtools/sps/models/funding_group.py index 2975f9f6f..8488b3710 100644 --- a/packtools/sps/models/funding_group.py +++ b/packtools/sps/models/funding_group.py @@ -1,7 +1,5 @@ import logging -from packtools.sps.utils import xml_utils - logger = logging.getLogger(__name__) @@ -23,8 +21,8 @@ class FundingGroup: Arrangement containing a dictionary that correlates funding-source and award-id or values of one of the attributes. """ - def __init__(self, xml): - self._xmltree = xml_utils.get_xml_tree(xml) + def __init__(self, xmltree): + self._xmltree = xmltree @property def award_groups(self): diff --git a/tests/test_funding_group.py b/tests/test_funding_group.py index d9f75e157..24a340ced 100644 --- a/tests/test_funding_group.py +++ b/tests/test_funding_group.py @@ -1,12 +1,12 @@ # coding: utf-8 from __future__ import unicode_literals import unittest - try: from unittest import mock except: import mock +from lxml import etree from packtools.sps.models.funding_group import FundingGroup @@ -30,7 +30,7 @@ def setUp(self): """ ) - self.funding_group = FundingGroup(xml) + self.funding_group = FundingGroup(etree.fromstring(xml)) def test_funding_sources(self): expected = ['CNPQ', 'FAPESP'] @@ -60,7 +60,7 @@ def setUp(self): """ ) - self.funding_group = FundingGroup(xml) + self.funding_group = FundingGroup(etree.fromstring(xml)) def test_funding_sources(self): expected = ['CNPq'] @@ -90,7 +90,7 @@ def setUp(self): """ ) - self.funding_group = FundingGroup(xml) + self.funding_group = FundingGroup(etree.fromstring(xml)) def test_funding_sources(self): expected = ['CNPq', 'FAPESP'] @@ -124,7 +124,7 @@ def setUp(self): """ ) - self.funding_group = FundingGroup(xml) + self.funding_group = FundingGroup(etree.fromstring(xml)) def test_funding_sources(self): expected = ['Coordenação de Aperfeiçoamento de Pessoal de Nível Superior', From 6120bd7a4a7466de4cbdf0fd799a3ca05dc0434c Mon Sep 17 00:00:00 2001 From: Roberta Takenaka Date: Fri, 27 Jan 2023 11:34:06 -0300 Subject: [PATCH 03/13] Adiciona fixture para documento do tipo adendo --- .../related-article/addendum.pt.html | 78 +++++++++++++++++++ .../related-article/addendum.xml | 60 ++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 tests/fixtures/htmlgenerator/related-article/addendum.pt.html create mode 100644 tests/fixtures/htmlgenerator/related-article/addendum.xml diff --git a/tests/fixtures/htmlgenerator/related-article/addendum.pt.html b/tests/fixtures/htmlgenerator/related-article/addendum.pt.html new file mode 100644 index 000000000..85cc776ce --- /dev/null +++ b/tests/fixtures/htmlgenerator/related-article/addendum.pt.html @@ -0,0 +1,78 @@ + + + + + + + + + + + +
+
+ +
+
Este adendo adiciona informação ao documento: +
+ +
+

+Adendo +

+ +
+
+ +
+

+

No artigo Educação Bilíngue para alunos surdos: notas sobre a construção da linguagem argumentativa no aprendizado de Ciências, com número de DOI: http://dx.doi.org/10.1590/1678-460X202257175, publicado no periódico D.E.L.T.A., 38-1, 2022:202257175, deve-se considerar a adição da informação:

+

+

Artigo em Libras: https://youtu.be/frfspa_XnoE

+

+

A adição da informação se faz necessária por mais de um motivo: (1) trata-se de um número temático sobre educação inclusiva e não seria realmente inclusiva se não incluíssemos ao menos um texto acessível aos surdos; e (2) temos autores surdos no grupo que atuou na escrita do número temático e esse texto é especificamente de um dos grupos de estudos surdos.

+
+
+

Datas de Publicação

+
    +
  • +Publicação nesta coleção
    22 Abr 2022
  • +
  • +Data do Fascículo
    2022
  • +
+
+
+
+
+ +
+ + + diff --git a/tests/fixtures/htmlgenerator/related-article/addendum.xml b/tests/fixtures/htmlgenerator/related-article/addendum.xml new file mode 100644 index 000000000..75992e9c0 --- /dev/null +++ b/tests/fixtures/htmlgenerator/related-article/addendum.xml @@ -0,0 +1,60 @@ + + +
+ + + delta + + DELTA: Documentação de Estudos em Lingüística Teórica e Aplicada + DELTA + + 0102-4450 + 1678-460X + + Pontifícia Universidade Católica de São Paulo - PUC-SP + + + + s8JQvV57hfnwnMSFWS38G8S + S0102-44502022000101000 + 10.1590/1678-460X202257175video + 01000 + + + Adendo + + + + Adendo + + + 22 + 04 + 2022 + + + 2022 + + 38 + 1 + 202257175video + + + Este é um artigo publicado em acesso aberto sob uma licença Creative Commons + + + 10.1590/1678-460X202257175 + + + + + + + + + +

No artigo Educação Bilíngue para alunos surdos: notas sobre a construção da linguagem argumentativa no aprendizado de Ciências, com número de DOI: http://dx.doi.org/10.1590/1678-460X202257175, publicado no periódico D.E.L.T.A., 38-1, 2022:202257175, deve-se considerar a adição da informação:

+

Artigo em Libras: https://youtu.be/frfspa_XnoE

+

A adição da informação se faz necessária por mais de um motivo: (1) trata-se de um número temático sobre educação inclusiva e não seria realmente inclusiva se não incluíssemos ao menos um texto acessível aos surdos; e (2) temos autores surdos no grupo que atuou na escrita do número temático e esse texto é especificamente de um dos grupos de estudos surdos.

+ +
\ No newline at end of file From 758b8843d8f94b85d90669b679a7b138725560f8 Mon Sep 17 00:00:00 2001 From: Roberta Takenaka Date: Thu, 2 Feb 2023 08:34:29 -0300 Subject: [PATCH 04/13] =?UTF-8?q?Remove=20a=20depend=C3=AAncia=20de=20pyth?= =?UTF-8?q?on-magic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packtools/file_utils_mimetype.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packtools/file_utils_mimetype.py b/packtools/file_utils_mimetype.py index 428a1785c..a67cf9e1c 100644 --- a/packtools/file_utils_mimetype.py +++ b/packtools/file_utils_mimetype.py @@ -1,5 +1,5 @@ import os -import magic +import mimetypes def is_valid_file(file_path, check_mimetype=False): @@ -14,5 +14,4 @@ def is_valid_file(file_path, check_mimetype=False): def get_mimetype(file_path): - with open(file_path, 'rb') as fin: - return magic.from_buffer(fin.read(2048), mime=True) + return mimetypes.guess_type(file_path, strict=True) From fa60207d13f99e02ae61849fc3bb9e69afce2ac8 Mon Sep 17 00:00:00 2001 From: Roberta Takenaka Date: Thu, 2 Feb 2023 08:46:02 -0300 Subject: [PATCH 05/13] =?UTF-8?q?Corrige=20atribui=C3=A7=C3=A3o=20de=20Art?= =?UTF-8?q?icleIds.v2=20e=20amplia=20os=20testes=20para=20ArticleIds?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packtools/sps/models/article_ids.py | 21 ++++++++++++-- tests/sps/test_article_ids.py | 43 ++++++++++++++++++++++++++++- 2 files changed, 60 insertions(+), 4 deletions(-) diff --git a/packtools/sps/models/article_ids.py b/packtools/sps/models/article_ids.py index 5a83bed3f..1c47cd945 100644 --- a/packtools/sps/models/article_ids.py +++ b/packtools/sps/models/article_ids.py @@ -64,16 +64,28 @@ def v2(self, value): node = self._get_node( './/article-id[@specific-use="scielo-v2"]' ) + if node is not None and node.text: + raise AttributeError( + "can't set attribute ArticleIds.v2. It is already set: %s" % + node.text + ) + if not value: + raise ValueError( + "can't set attribute ArticleIds.v2. " + "Given value %s is not valid" % value) if node is None: node = etree.Element("article-id") node.set("pub-id-type", "publisher-id") node.set("specific-use", "scielo-v2") self.am.insert(1, node) - if node is not None: - node.text = value + node.text = value @v3.setter def v3(self, value): + if not value: + raise ValueError( + "can't set attribute ArticleIds.v3. " + "Given value %s is not valid" % value) node = self._get_node( './/article-id[@specific-use="scielo-v3"]' ) @@ -87,6 +99,10 @@ def v3(self, value): @aop_pid.setter def aop_pid(self, value): + if not value: + raise ValueError( + "can't set attribute ArticleIds.aop_pid. " + "Given value %s is not valid" % value) node = self._get_node( './/article-id[@specific-use="previous-pid" and ' '@pub-id-type="publisher-id"]' @@ -110,4 +126,3 @@ def _get_node_text(self, xpath): return self._get_node(xpath).text except AttributeError: return None - diff --git a/tests/sps/test_article_ids.py b/tests/sps/test_article_ids.py index ae7a4f94a..d53b95c3a 100644 --- a/tests/sps/test_article_ids.py +++ b/tests/sps/test_article_ids.py @@ -75,7 +75,7 @@ def test_absent_other(self): def test_absent_doi(self): article_id = ArticleIds(_get_xmltree()) self.assertIsNone(article_id.doi) - + def test_update_v3(self): self.article_id.v3 = "novo_v3" self.assertEqual("novo_v3", self.article_id.v3) @@ -95,3 +95,44 @@ def test_update_doi_raises_AttributeError(self): def test_update_other_raises_AttributeError(self): with self.assertRaises(AttributeError): self.article_id.other = "xxxx" + + def test_update_v3_raises_ValueError(self): + with self.assertRaises(ValueError): + self.article_id.v3 = "" + + def test_update_aop_pid_raises_ValueError(self): + with self.assertRaises(ValueError): + self.article_id.aop_pid = "" + + +class TestArticleIdsOriginalXMLHasNoArticleId(TestCase): + """ + Estes testes são para explicitar a saída de + parse_issue usando o contéudo de + """ + def setUp(self): + self.article_id = ArticleIds(_get_xmltree('')) + + def test_update_v2(self): + self.article_id.v2 = "novo_v2" + self.assertEqual("novo_v2", self.article_id.v2) + + def test_update_v3(self): + self.article_id.v3 = "novo_v3" + self.assertEqual("novo_v3", self.article_id.v3) + + def test_update_aop_pid(self): + self.article_id.aop_pid = "novo_aop_pid" + self.assertEqual("novo_aop_pid", self.article_id.aop_pid) + + def test_update_v2_raises_ValueError(self): + with self.assertRaises(ValueError): + self.article_id.v2 = "" + + def test_update_v3_raises_ValueError(self): + with self.assertRaises(ValueError): + self.article_id.v3 = "" + + def test_update_aop_pid_raises_ValueError(self): + with self.assertRaises(ValueError): + self.article_id.aop_pid = "" From 323219928ae508af2fd335a4e3972897be4df7e9 Mon Sep 17 00:00:00 2001 From: Roberta Takenaka Date: Thu, 2 Feb 2023 09:18:13 -0300 Subject: [PATCH 06/13] Volta trecho que traduz `This document has an addendum` --- packtools/catalogs/htmlgenerator/v2.0/config-labels.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packtools/catalogs/htmlgenerator/v2.0/config-labels.xml b/packtools/catalogs/htmlgenerator/v2.0/config-labels.xml index 46e100b53..3d6790e0e 100644 --- a/packtools/catalogs/htmlgenerator/v2.0/config-labels.xml +++ b/packtools/catalogs/htmlgenerator/v2.0/config-labels.xml @@ -487,10 +487,17 @@ Este documento foi comentado por Este documento fue comentado por + + This document has an addendum + This document has an addendum + Este documento tem um adendo + Este documento tiene una addenda + This addendum adds information to the following document This addendum adds information to the following document Este adendo adiciona informação ao documento Esta addenda agrega información al documento + \ No newline at end of file From 608d46d989f5032e0ca30d09f73fca9ec1535ea7 Mon Sep 17 00:00:00 2001 From: Roberta Takenaka Date: Fri, 3 Feb 2023 16:42:10 -0300 Subject: [PATCH 07/13] =?UTF-8?q?Remove=20template=20que=20estava=20sobres?= =?UTF-8?q?crevendo=20outros=20indevidamente,=20removendo=20os=20estilos?= =?UTF-8?q?=20da=20caixa=20que=20apresenta=20o=20texto=20de=20notas=20e/ou?= =?UTF-8?q?=20de=20refer=C3=AAncias=20bibliogr=C3=A1ficas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../catalogs/htmlgenerator/v2.0/article-text-xref.xsl | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/packtools/catalogs/htmlgenerator/v2.0/article-text-xref.xsl b/packtools/catalogs/htmlgenerator/v2.0/article-text-xref.xsl index 510748d39..e8726a439 100644 --- a/packtools/catalogs/htmlgenerator/v2.0/article-text-xref.xsl +++ b/packtools/catalogs/htmlgenerator/v2.0/article-text-xref.xsl @@ -140,15 +140,11 @@ - + - - - - - + From cc7e085ab7166c30d4fafe7812fb71b47a78b322 Mon Sep 17 00:00:00 2001 From: Roberta Takenaka Date: Fri, 3 Feb 2023 17:56:06 -0300 Subject: [PATCH 08/13] =?UTF-8?q?Acrescenta=20elementos=20ocultos=20com=20?= =?UTF-8?q?dados=20de=20afilia=C3=A7=C3=A3o=20para=20inserir=20link=20para?= =?UTF-8?q?=20scimago?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../v2.0/html-modals-contribs.xsl | 60 ++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/packtools/catalogs/htmlgenerator/v2.0/html-modals-contribs.xsl b/packtools/catalogs/htmlgenerator/v2.0/html-modals-contribs.xsl index 08aa362d3..8d2c12323 100644 --- a/packtools/catalogs/htmlgenerator/v2.0/html-modals-contribs.xsl +++ b/packtools/catalogs/htmlgenerator/v2.0/html-modals-contribs.xsl @@ -101,9 +101,67 @@
+
- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + , , + +
  • From 44b156060fd14804b47d63a34c3d1e64fa4d22f3 Mon Sep 17 00:00:00 2001 From: Roberta Takenaka Date: Fri, 3 Feb 2023 17:58:52 -0300 Subject: [PATCH 09/13] =?UTF-8?q?Gera=20os=20HTML=20com=20os=20dados=20ocu?= =?UTF-8?q?ltos=20de=20afilia=C3=A7=C3=B5es=20para=20inserir=20link=20para?= =?UTF-8?q?=20o=20scimago?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../0006-8705-brag-81-e2022.en.html | 30 +++++++---- .../WMyxJrMNHhVKWnJSxgXwMGN.pt.html | 9 ++-- .../alternatives/imagens_fora_de_fig.en.html | 18 ++++--- .../alternatives/imagens_fora_de_fig.es.html | 18 ++++--- .../alternatives/imagens_fora_de_fig.pt.html | 18 ++++--- .../anonymous/artigo_fake.pt.html | 6 +-- .../anonymous/parecer_fake.pt.html | 6 +-- .../0104-5970-hcsm-27-01-0275.pt.html | 12 +++-- .../hxcB3n9hzmSGz4v6dgzDsxp.en.html | 30 +++++++---- .../hxcB3n9hzmSGz4v6dgzDsxp.pt.html | 30 +++++++---- .../htmlgenerator/dot_in_id/arquivo.pt.html | 33 +++++++----- .../htmlgenerator/dot_in_id/tabelas.pt.html | 15 +++--- .../1807-0205-paz-62-e202262026.en.html | 15 +++--- .../1982-7849-rac-26-06-e190379.en.html | 15 +++--- .../1982-7849-rac-26-06-e190379.pt.html | 15 +++--- .../2236-8906-hoehnea-49-e1112020.pt.html | 30 +++++++---- .../2236-8906-hoehnea-49-e762021.pt.html | 12 +++-- .../howtocite.en.html | 21 +++++--- ...eparator_between_authors_and_title.pt.html | 15 +++--- .../image_in_table/img_in_table.en.html | 18 ++++--- .../latex/7f8rqRq4vSnJ7B738VKMKqF.pt.html | 18 ++++--- .../htmlgenerator/matsuppl/ms.en.html | 15 +++--- .../fixtures/htmlgenerator/mmlmath/f.en.html | 15 +++--- .../96fDfzSqzxPF9cPxxPNYFmk.en.html | 15 +++--- .../96fDfzSqzxPF9cPxxPNYFmk.pt.html | 15 +++--- .../related-article/related_article.pt.html | 9 ++-- .../related_article_fake_preprint.pt.html | 9 ++-- .../related_article_fake_print.pt.html | 9 ++-- .../htmlgenerator/related-article/x.pt.html | 9 ++-- .../htmlgenerator/related-article/y.es.html | 12 +++-- .../GZYfdY6BDfMGKwrXQYxsZFd.en.html | 51 ++++++++++++------- .../GZYfdY6BDfMGKwrXQYxsZFd.pt.html | 51 ++++++++++++------- .../MNHpJQpnjvSX6pkKCg37yTJ.en.html | 18 ++++--- .../MNHpJQpnjvSX6pkKCg37yTJ.pt.html | 18 ++++--- .../2236-8906-hoehnea-49-e1082020.pt.html | 15 +++--- .../LMhWjxn9S8cVjDRDqFw8Zst.pt.html | 15 +++--- .../QMyWZTMgngWRCDtVJfJH9Cn.pt.html | 21 +++++--- .../dqR6y8bPFVVQnxnFHY66ZZK.pt.html | 9 ++-- 38 files changed, 422 insertions(+), 268 deletions(-) diff --git a/tests/fixtures/htmlgenerator/affiliations/0006-8705-brag-81-e2022.en.html b/tests/fixtures/htmlgenerator/affiliations/0006-8705-brag-81-e2022.en.html index f87f9543f..a6c86d743 100644 --- a/tests/fixtures/htmlgenerator/affiliations/0006-8705-brag-81-e2022.en.html +++ b/tests/fixtures/htmlgenerator/affiliations/0006-8705-brag-81-e2022.en.html @@ -4,8 +4,8 @@ - - + + @@ -324,42 +324,50 @@

    History

  • - - + diff --git a/tests/fixtures/htmlgenerator/alternatives/imagens_fora_de_fig.es.html b/tests/fixtures/htmlgenerator/alternatives/imagens_fora_de_fig.es.html index a75671725..bee1defb7 100644 --- a/tests/fixtures/htmlgenerator/alternatives/imagens_fora_de_fig.es.html +++ b/tests/fixtures/htmlgenerator/alternatives/imagens_fora_de_fig.es.html @@ -4,8 +4,8 @@ - - + + @@ -148,18 +148,22 @@

    Fechas de Publicación

    - + diff --git a/tests/fixtures/htmlgenerator/app_group_supplementary_material/0104-5970-hcsm-27-01-0275.pt.html b/tests/fixtures/htmlgenerator/app_group_supplementary_material/0104-5970-hcsm-27-01-0275.pt.html index 43a01ab96..c5bb86042 100644 --- a/tests/fixtures/htmlgenerator/app_group_supplementary_material/0104-5970-hcsm-27-01-0275.pt.html +++ b/tests/fixtures/htmlgenerator/app_group_supplementary_material/0104-5970-hcsm-27-01-0275.pt.html @@ -4,8 +4,8 @@ - - + + @@ -163,12 +163,14 @@

    Histórico