Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Separar a extração de dados da tag <contrib-group> nas seções <article-meta> e <sub-article> #751

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions packtools/sps/models/article_authors.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ def collab(self):
except IndexError:
return None

@property
def contribs(self):
def _extract_contribs(self, xpath_contrib):
_data = []
for node in self.node.xpath(".//contrib"):
for node in self.node.xpath(xpath_contrib):
_author = _get_collab(node)
for tag in ("surname", "prefix", "suffix"):
data = node.findtext(f".//{tag}")
Expand Down Expand Up @@ -69,6 +68,19 @@ def contribs(self):
_data.append(_author)
return _data


@property
def contribs_in_article_meta(self):
return self._extract_contribs(".//article-meta//contrib")

@property
def contribs_in_sub_article(self):
return self._extract_contribs(".//sub-article//contrib")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samuelveigarangel o problema aqui é que você não está distinguindo de que sub-article é cada contrib. Altere de forma que seja possível selecionar contrib por sub-article.


@property
def contribs(self):
return self._extract_contribs(".//contrib")

@property
def contribs_with_affs(self):
affs = Affiliation(self.node)
Expand Down