-
Notifications
You must be signed in to change notification settings - Fork 24
Corrige validação para SupplementaryMaterial e testes #947
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
Corrige validação para SupplementaryMaterial e testes #947
Conversation
data=self.data, | ||
) | ||
|
||
def validate_prohibited_inline(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rossi-Luciano este método pode ser de uma classe que seja instanciada com xml_tree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, @robertatakenaka
advice=None, | ||
data=supp, | ||
error_level="OK", | ||
def __init__(self, data, xml_tree, params, node=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rossi-Luciano excluir xml_tree. Tenha uma classe para validar o elemento individualmente e outra para validar no nível do XML
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, @robertatakenaka
data=None, | ||
error_level=error_level, | ||
|
||
def validate_position(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rossi-Luciano método de uma classe que é instanciada com xml_tree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, @robertatakenaka
…leSupplementaryMaterialValidation'
advice=None, | ||
data=supp, | ||
error_level="OK", | ||
def __init__(self, data, params, node=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rossi-Luciano Em data
não há dados de média ou de graphic? Deveria para evitar que você tenha que passar o node.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, @robertatakenaka
for media in self.node.xpath(".//media"): | ||
if media.data: | ||
yield from MediaValidation(media.data, self.params).validate() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rossi-Luciano não daria para fazer algo como:
if data.get("alguma chave que indica que é media"):
yield from MediaValidation(data, self.params).validate()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, @robertatakenaka
""" | ||
Ensures that <supplementary-material> does not occur inside <app-group> and <app>. | ||
""" | ||
valid = self.data.get("parent_suppl_mat") not in ["app-group", "app"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rossi-Luciano colocar em params o item é "parent_suppl_mat_expected": ["app-group", "app"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, @robertatakenaka
""" | ||
Verifies if the supplementary materials section is in the last position of <body> or inside <back>. | ||
""" | ||
article_body = self.xml_tree.find("body") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rossi-Luciano acho que primeiro tem que saber se há pelo menos 1 material suplementar antes de seguir a validação
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, @robertatakenaka
…aterial_validation
…lementary-material>
@@ -82,11 +86,11 @@ def items_by_id(self): | |||
considera esse elemento, apesar de ele poder existir. | |||
""" | |||
supp_dict = {} | |||
for node in self.xml_tree.xpath(". | sub-article"): | |||
for node in self.xml_tree.xpath("./front | ./body | ./back | .//sub-article"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rossi-Luciano: troque self.xml_tree.xpath("./front | ./body | ./back | .//sub-article"):
por self.xml_tree.xpath(". | .//sub-article"):
node_id = node.get("id") if node.get("id") else "main_article" | ||
supp_dict.setdefault(node_id, []) | ||
full_text = Fulltext(node) | ||
for supp_node in full_text.node.xpath(".//supplementary-material"): | ||
for supp_node in full_text.node.xpath(".//supplementary-material") or []: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
troque full_text.node.xpath(".//supplementary-material")
por full_text.node.xpath("./front//supplementary-material | ./body//supplementary-material | ./back//supplementary-material")
@@ -124,6 +124,10 @@ def validate_position(self): | |||
""" | |||
Verifies if the supplementary materials section is in the last position of <body> or inside <back>. | |||
""" | |||
sections = self.xml_tree.findall(".//sec") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
troque sections = self.xml_tree.findall(".//sec")...
por
sections = self.xml_tree.xpath('.//sec[@sec-type="supplementary-material"]')
if not sections:
return
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rossi-Luciano corrigir
node_id = node.get("id") if node.get("id") else "main_article" | ||
supp_dict.setdefault(node_id, []) | ||
full_text = Fulltext(node) | ||
for supp_node in full_text.node.xpath(".//supplementary-material"): | ||
for supp_node in full_text.node.xpath("./front//supplementary-material | ./body//supplementary-material | ./back//supplementary-material") or []: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Rossi-Luciano adicionar front-stub
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, @robertatakenaka
O que esse PR faz?
Corrige validação para
SupplementaryMaterial
e testes.Onde a revisão poderia começar?
NA
Como este poderia ser testado manualmente?
NA
Algum cenário de contexto que queira dar?
NA
Screenshots
NA
Quais são tickets relevantes?
Substitui o PR #915
Referências
NA