Skip to content

Commit

Permalink
Fixed preamble.final element
Browse files Browse the repository at this point in the history
  • Loading branch information
AlessioNar committed Dec 28, 2024
1 parent d2a0a0c commit cbf1c17
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 26 deletions.
5 changes: 1 addition & 4 deletions tulit/parsers/akomantoso.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,8 @@ def get_preamble_final(self):
Concatenated text from the final preamble element.
Returns None if no final preamble is found.
"""
preamble_final = self.preamble.find(".//akn:block", namespaces=self.namespaces).text
self.preamble_final = preamble_final
return self.preamble_final
return super().get_preamble_final(preamble_final_xpath='.//akn:block[@name="preamble.final"]')

#return super().get_preamble_final(preamble_final_xpath='.//block[@name="preamble.final"]')

def get_body(self):
return super().get_body('.//akn:body')
Expand Down
13 changes: 1 addition & 12 deletions tulit/parsers/formex.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,18 +100,7 @@ def extract_eId(recital):
)

def get_preamble_final(self):
"""
Extracts the final preamble text from the document.
Returns
-------
str or None
Concatenated text from the final preamble element.
Returns None if no final preamble is found.
"""
self.preamble_final = self.preamble.findtext('PREAMBLE.FINAL')

return self.preamble_final
return super().get_preamble_final(preamble_final_xpath='.//PREAMBLE.FINAL')

def get_body(self):
return super().get_body('.//ENACTING.TERMS')
Expand Down
12 changes: 2 additions & 10 deletions tulit/parsers/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,25 +356,17 @@ def get_recitals(self, recitals_xpath, recital_xpath, text_xpath, extract_intro=

self.recitals = recitals

def get_preamble_final(self) -> str:
def get_preamble_final(self, preamble_final_xpath) -> str:
"""
Extracts the final preamble text from the document.
Parameters
----------
preamble_final_xpath : str
XPath expression to locate the final preamble element.
Returns
-------
str or None
Concatenated text from the final preamble element.
Returns None if no final preamble is found.
"""
preamble_final = self.preamble.findtext('.//block', namespaces=self.namespaces)
if preamble_final is None:
return None

preamble_final = self.preamble.findtext(preamble_final_xpath, namespaces=self.namespaces)
self.preamble_final = preamble_final
return self.preamble_final

Expand Down

0 comments on commit cbf1c17

Please sign in to comment.