Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #102 from austinmatherne-wk/lxml-absolute-paths
Browse files Browse the repository at this point in the history
Use relative paths with lxml ElementTree find methods
  • Loading branch information
derekgengenbacher-wf authored Apr 2, 2024
2 parents b40a367 + 167ef3d commit 2f238a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1148,7 +1148,7 @@ def copyResourceToReportFolder(filename):
if redactTgtElts: # if any redacted continued at elements
for ixdsHtmlRootElt in getattr(modelXbrl, "ixdsHtmlElements", ()):
hasEditedCont = False
for e in ixdsHtmlRootElt.getroottree().iterfind("//{http://www.xbrl.org/2013/inlineXBRL}*[@continuedAt]"):
for e in ixdsHtmlRootElt.getroottree().iterfind(".//{http://www.xbrl.org/2013/inlineXBRL}*[@continuedAt]"):
contAt = e.get("continuedAt", None)
while contAt in redactTgtElts: # may be multiple continuations in redacted sections
nextContAtElt = redactTgtElts[contAt]
Expand Down Expand Up @@ -1864,7 +1864,7 @@ def edgarRendererDetectRedlining(modelDocument, *args, **kwargs):
cntlr = modelDocument.modelXbrl.modelManager.cntlr
foundMatchInDoc = False
if modelDocument.type == ModelDocument.Type.INLINEXBRL and (not cntlr.hasGui or cntlr.redlineMode.get()):
for e in modelDocument.xmlRootElement.getroottree().iterfind("//{http://www.w3.org/1999/xhtml}*[@style]"):
for e in modelDocument.xmlRootElement.getroottree().iterfind(".//{http://www.w3.org/1999/xhtml}*[@style]"):
rlMatch = redliningPattern.match(e.get("style",""))
if rlMatch:
if not hasattr(cntlr, "editedIxDocs"):
Expand All @@ -1882,7 +1882,7 @@ def edgarRendererDetectRedlining(modelDocument, *args, **kwargs):
def edgarRendererRemoveRedlining(modelDocument, *args, **kwargs):
# strip redlining from modelDocument
matchedElts = []
for e in modelDocument.xmlRootElement.getroottree().iterfind("//{http://www.w3.org/1999/xhtml}*[@style]"):
for e in modelDocument.xmlRootElement.getroottree().iterfind(".//{http://www.w3.org/1999/xhtml}*[@style]"):
rlMatch = redliningPattern.match(e.get("style",""))
if rlMatch:
matchedElts.append(e) # can't prune tree while iterating through it
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
lxml>=4.6.3
matplotlib>=3.4.2
openpyxl>==3.0.7
openpyxl>=3.0.7

0 comments on commit 2f238a8

Please sign in to comment.