Skip to content

Commit

Permalink
Merge pull request #248 from hakonhagland/fix_kwstatus_script
Browse files Browse the repository at this point in the history
Fixed a bug in the fodt-set-keyword-status script
  • Loading branch information
gdfldm authored May 24, 2024
2 parents 5146f65 + dd4f893 commit 1fc62ed
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
13 changes: 8 additions & 5 deletions parts/appendices/A.fodt
Original file line number Diff line number Diff line change
Expand Up @@ -6826,7 +6826,8 @@ Updated with AFR/TSA Rev-D comments and new keywords.</dc:description><meta:init
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:table-cell table:style-name="Table38.H21" office:value-type="string">
<text:p text:style-name="P2480"/> </table:table-cell>
<text:p text:style-name="P2480"/>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="Table35.2">
<table:table-cell table:style-name="Table35.A48" table:number-columns-spanned="7" office:value-type="string">
Expand All @@ -6838,8 +6839,9 @@ Updated with AFR/TSA Rev-D comments and new keywords.</dc:description><meta:init
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:table-cell table:style-name="Table35.H9" office:value-type="string">
<text:p text:style-name="P2480"/> </table:table-cell>
<table:table-cell table:style-name="Table47.H7" office:value-type="string">
<text:p text:style-name="P2480"></text:p>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="Table35.2">
<table:table-cell table:style-name="Table35.A48" table:number-columns-spanned="7" office:value-type="string">
Expand All @@ -6852,7 +6854,8 @@ Updated with AFR/TSA Rev-D comments and new keywords.</dc:description><meta:init
<table:covered-table-cell/>
<table:covered-table-cell/>
<table:table-cell table:style-name="Table40.H8" office:value-type="string">
<text:p text:style-name="P2480"/> </table:table-cell>
<text:p text:style-name="P2480"/>
</table:table-cell>
</table:table-row>
<table:table-row table:style-name="Table35.2">
<table:table-cell table:style-name="Table35.A48" table:number-columns-spanned="7" office:value-type="string">
Expand Down Expand Up @@ -28788,4 +28791,4 @@ Updated with AFR/TSA Rev-D comments and new keywords.</dc:description><meta:init
</text:section>
</office:text>
</office:body>
</office:document>
</office:document>
9 changes: 5 additions & 4 deletions scripts/python/src/fodt/add_keyword_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,16 @@ def endElement(self, name: str):
self.in_table_cell = False
elif self.in_table_cell_style and name == "style:style":
self.in_table_cell_style = False
if self.in_table_cell_p and name == "text:p" and self.start_tag_open and self.opm_flow:
if self.in_table_cell_p and name == "text:p" and self.start_tag_open:
self.content.write(">")
self.start_tag_open = False
content = "OPM Flow"
self.keyword_handled = True
self.current_keyword = None
self.in_table_cell_p = False
self.found_table_cell = False
self.content.write(XMLHelper.escape(content))
if self.opm_flow:
content = "OPM Flow"
self.content.write(XMLHelper.escape(content))
if self.start_tag_open:
self.content.write("/>")
self.start_tag_open = False
Expand Down Expand Up @@ -229,7 +230,7 @@ def set_keyword_status(
try:
color = KeywordStatus[color.upper()]
except ValueError:
raise ValueError(f"Invalid status value: {status}.")
raise ValueError(f"Invalid color value: {color}.")
logging.info(f"Updating parameters for keyword {keyword}: Color: {color}, flow-specific keyword: {opm_flow}.")
UpdateKeywordStatus(maindir, keyword, color, opm_flow).update()

Expand Down

0 comments on commit 1fc62ed

Please sign in to comment.