From f929deb353cd2a59e2aa0a510c9c07c2483b62ad Mon Sep 17 00:00:00 2001 From: Nick Nicholas Date: Wed, 8 Jan 2025 08:44:04 +0200 Subject: [PATCH] Presentation XML refactor, terms: https://github.com/metanorma/isodoc/issues/630 --- lib/isodoc/presentation_function/terms.rb | 8 +++++-- spec/isodoc/terms_spec.rb | 27 +++++++++++++++++++++-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/lib/isodoc/presentation_function/terms.rb b/lib/isodoc/presentation_function/terms.rb index beee35f0..4eebfe60 100644 --- a/lib/isodoc/presentation_function/terms.rb +++ b/lib/isodoc/presentation_function/terms.rb @@ -130,9 +130,13 @@ def termsource_modification(elem) def termsource_add_modification_text(mod) mod or return - mod.text.strip.empty? or mod.previous = " — " + if mod.text.strip.empty? + mod.remove + return + end + mod.previous = " — " mod.elements.size == 1 and mod.children = to_xml(mod.elements[0].children) - mod.text.strip.empty? or mod.replace(semx_fmt_dup(mod)) + mod.replace(semx_fmt_dup(mod)) end def termsource_status(status) diff --git a/spec/isodoc/terms_spec.rb b/spec/isodoc/terms_spec.rb index 5530259d..aa5eda00 100644 --- a/spec/isodoc/terms_spec.rb +++ b/spec/isodoc/terms_spec.rb @@ -136,6 +136,14 @@

with adjustments

+ + + t1 + + +

+ + paddy paddy rice @@ -333,6 +341,14 @@

with adjustments

+ + + t1 + + +

+ + [SOURCE: @@ -347,6 +363,13 @@ , modified — with adjustments + + ; + + + t1 + + , adapted ] @@ -568,7 +591,7 @@ -

[SOURCE: t1 — comment; Termbase IEV, term ID xyz, modified — with adjustments]

+

[SOURCE: t1 — comment; Termbase IEV, term ID xyz, modified — with adjustments; t1, adapted]

1.2.

paddy @@ -648,7 +671,7 @@ -

[SOURCE: t1 — comment; Termbase IEV, term ID xyz, modified — with adjustments]

+

[SOURCE: t1 — comment; Termbase IEV, term ID xyz, modified — with adjustments; t1, adapted]

1.2.

paddy