Skip to content

Commit

Permalink
Presentation XML refactor, terms: metanorma/isodoc#630
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Jan 9, 2025
1 parent 93d4e3f commit 7d83202
Show file tree
Hide file tree
Showing 6 changed files with 241 additions and 92 deletions.
4 changes: 4 additions & 0 deletions Gemfile.devel
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
gem "isodoc", git: "https://github.com/metanorma/isodoc", branch: "feature/presentation-terms"
gem "metanorma-iso", git: "https://github.com/metanorma/metanorma-iso", branch: "feature/presentation-terms"
gem "metanorma-generic", git: "https://github.com/metanorma/metanorma-generic", branch: "feature/presentation-terms"
gem "mn-requirements", git: "https://github.com/metanorma/mn-requirements", branch: "main"
9 changes: 7 additions & 2 deletions lib/isodoc/bipm/presentation_xml_convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def jcgm_eref(docxml, xpath)
def extract_brackets(node)
start = node.at("./text()[1]")
finish = node.at("./text()[last()]")
(/^\[/.match?(start.text) && /\]$/.match?(finish.text)) or return
(/^\[/.match?(start&.text) && /\]$/.match?(finish&.text)) or return
start.replace(start.text[1..-1])
node.previous = "["
finish = node.at("./text()[last()]")
Expand All @@ -143,7 +143,8 @@ def quotedtitles(docxml)
end
end

def termsource1(elem)
# KILL
def termsource1_xx(elem)
# elem["status"] == "modified" and return super
while elem&.next_element&.name == "termsource"
elem << "; #{to_xml(elem.next_element.remove.children)}"
Expand All @@ -152,6 +153,10 @@ def termsource1(elem)
"#{to_xml(elem.children).strip}]")
end

def termsource_label(elem, sources)
elem.replace(l10n("[#{termsource_adapt(elem['status'])} #{sources}]"))
end

def termsource_adapt(status)
case status
when "adapted" then @i18n.adapted_from
Expand Down
Loading

0 comments on commit 7d83202

Please sign in to comment.