-
Notifications
You must be signed in to change notification settings - Fork 23
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
Feat: footnotes validation #702
base: master
Are you sure you want to change the base?
Changes from 1 commit
148a0e8
279726c
60968c7
3bc39b6
4f741da
86ff8d7
ae7f323
dc2fae0
bdf0c51
3424187
4975034
a7b0d29
ef95285
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,13 +22,14 @@ def data(self): | |
|
||
class BaseNoteGroups: | ||
def __init__(self, article_or_sub_article_node, fn_parent_tag_name, NoteGroupClass): | ||
self.article_or_sub_article_node = article_or_sub_article_node | ||
self.fn_parent_tag_name = fn_parent_tag_name | ||
self.parent = article_or_sub_article_node.tag | ||
self.parent_id = article_or_sub_article_node.get("id") | ||
self.parent_lang = article_or_sub_article_node.get("{http://www.w3.org/XML/1998/namespace}lang") | ||
self.parent_article_type = article_or_sub_article_node.get("article-type") | ||
self.NoteGroupClass = NoteGroupClass | ||
self.article_or_sub_article_node = article_or_sub_article_node \ | ||
if self.parent == "sub-article" else article_or_sub_article_node.find("./") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Rossi-Luciano só vai pegar o front In [27]: from lxml import etree
In [28]: root = etree.fromstring(xml)
In [29]: x = root.find('.').find("./")
In [30]: x
Out[30]: <Element front at 0x1125c6340> There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Rossi-Luciano No método if self.article_or_sub_article_node == "article":
xpath = f".//front//{self.fn_parent_tag_name} | .//body//{self.fn_parent_tag_name} | .//back//{self.fn_parent_tag_name}"
else:
xpath = f".//{self.fn_parent_tag_name}"
for fn_parent_node in self.article_or_sub_article_node.xpath(xpath):
data = self.NoteGroupClass(fn_parent_node).data
yield put_parent_context(data, self.parent_lang, self.parent_article_type, self.parent, self.parent_id)
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, @robertatakenaka |
||
|
||
@property | ||
def items(self): | ||
|
@@ -45,6 +46,7 @@ def __init__(self, node): | |
self.label = self.node.findtext("label") | ||
self.text = process_subtags(self.node) | ||
self.bold = self.node.findtext("bold") | ||
self.title = self.node.findtext("title") | ||
|
||
@property | ||
def data(self): | ||
|
@@ -53,7 +55,8 @@ def data(self): | |
"fn_type": self.type, | ||
"fn_label": self.label, | ||
"fn_text": self.text, | ||
"fn_bold": self.bold | ||
"fn_bold": self.bold, | ||
"fn_title": self.title | ||
} | ||
|
||
|
||
|
@@ -91,13 +94,23 @@ def corresp(self): | |
def corresp_label(self): | ||
return process_subtags(self.fn_parent_node.find("corresp/label")) | ||
|
||
@property | ||
def corresp_title(self): | ||
return process_subtags(self.fn_parent_node.find("corresp/title")) | ||
|
||
@property | ||
def corresp_bold(self): | ||
return process_subtags(self.fn_parent_node.find("corresp/bold")) | ||
|
||
@property | ||
def data(self): | ||
return { | ||
**super().data, | ||
"corresp": self.corresp, | ||
"corresp_label": self.corresp_label | ||
} | ||
"corresp_label": self.corresp_label, | ||
"corresp_title": self.corresp_title, | ||
"corresp_bold": self.corresp_bold | ||
} | ||
|
||
|
||
class AuthorNotes(BaseNoteGroups): | ||
|
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 estava correto antes... A instanciação deveria ocorrer antes
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