Skip to content

Commit

Permalink
Presentation XML refactor, terms: #630
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Jan 8, 2025
1 parent 12a5b3d commit f929deb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
8 changes: 6 additions & 2 deletions lib/isodoc/presentation_function/terms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
27 changes: 25 additions & 2 deletions spec/isodoc/terms_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@
<p id='_'>with adjustments</p>
</modification>
</termsource>
<termsource status='adapted'>
<origin citeas=''>
<termref base='IEV' target='xyz'>t1</termref>
</origin>
<modification>
<p id='_'/>
</modification>
</termsource>
</term>
<term id="paddy"><preferred><expression><name>paddy</name></expression></preferred>
<admitted><letter-symbol><name>paddy rice</name></letter-symbol>
Expand Down Expand Up @@ -333,6 +341,14 @@
<p original-id="_">with adjustments</p>
</modification>
</termsource>
<termsource status="adapted" id="_">
<origin citeas="">
<termref base="IEV" target="xyz">t1</termref>
</origin>
<modification>
<p original-id="_"/>
</modification>
</termsource>
<fmt-termsource status="identical">
[SOURCE:
<semx element="termsource" source="_">
Expand All @@ -347,6 +363,13 @@
<termref base="IEV" target="xyz"/>
</origin>
, modified — <semx element="modification" source="_">with adjustments</semx>
</semx>
;
<semx element="termsource" source="_">
<origin citeas="">
<termref base="IEV" target="xyz">t1</termref>
</origin>
, adapted
</semx>
]
</fmt-termsource>
Expand Down Expand Up @@ -568,7 +591,7 @@
</ul>
</div>
</div>
<p>[SOURCE: t1 — comment; Termbase IEV, term ID xyz, modified — with adjustments]</p>
<p>[SOURCE: t1 — comment; Termbase IEV, term ID xyz, modified — with adjustments; t1, adapted]</p>
<p class="TermNum" id="paddy">1.2.</p>
<p class="Terms" style="text-align:left;">
<b>paddy</b>
Expand Down Expand Up @@ -648,7 +671,7 @@
</ul>
</div>
</div>
<p>[SOURCE: t1 — comment; Termbase IEV, term ID xyz, modified — with adjustments]</p>
<p>[SOURCE: t1 — comment; Termbase IEV, term ID xyz, modified — with adjustments; t1, adapted]</p>
<p class="TermNum" id="paddy">1.2.</p>
<p class="Terms" style="text-align:left;">
<b>paddy</b>
Expand Down

0 comments on commit f929deb

Please sign in to comment.