Skip to content

Commit

Permalink
Refactor Presentation XML, terms: metanorma/isodoc#630
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Jan 8, 2025
1 parent 425077f commit 001dbcf
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 19 deletions.
3 changes: 3 additions & 0 deletions Gemfile.devel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gem "isodoc", git: "https://github.com/metanorma/isodoc", 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: 8 additions & 1 deletion lib/isodoc/ribose/presentation_xml_convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,19 @@ def annex_delim(_elem)

def middle_title(docxml); end

def termsource1(elem)
# KILL
def termsource1xx(elem)
elem.children = l10n("<strong>#{@i18n.source}:</strong> " \
"#{to_xml(elem.children).strip}")
elem&.next_element&.name == "termsource" and elem.next = "; "
end

def termsource_label(elem, sources)
elem.replace(l10n("<strong>#{@i18n.source}</strong>: #{sources}"))
end

def designation_boldface(desgn); end

def preface_rearrange(doc)
preface_move(doc.xpath(ns("//preface/abstract")),
%w(foreword executivesummary introduction clause acknowledgements), doc)
Expand Down
100 changes: 83 additions & 17 deletions spec/isodoc/html_convert_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
<terms id="I" obligation="normative">
<title>Normal Terms</title>
<term id="J">
<preferred>Term2</preferred>
<preferred><expression><name>Term2</name></expression></preferred>
</term>
</terms>
<definitions id="K">
Expand Down Expand Up @@ -308,7 +308,16 @@
<span class="fmt-autonum-delim">.</span>
<semx element="autonum" source="J">1</semx>
</fmt-xref-label>
<preferred>Term2</preferred>
<preferred id="_">
<expression>
<name>Term2</name>
</expression>
</preferred>
<fmt-preferred>
<p>
<semx element="preferred" source="_">Term2</semx>
</p>
</fmt-preferred>
</term>
</terms>
<definitions id="K">
Expand Down Expand Up @@ -910,11 +919,11 @@
<sections>
<terms id="H" obligation="normative"><title>Terms, Definitions, Symbols and Abbreviated Terms</title>
<term id="J">
<preferred>Term2</preferred>
<admitted>Term2A</admitted>
<admitted>Term2B</admitted>
<deprecates>Term2C</deprecates>
<deprecates>Term2D</deprecates>
<preferred><expression><name>Term2</name></expression></preferred>
<admitted><expression><name>Term2A</name></expression></admitted>
<admitted><expression><name>Term2B</name></expression></admitted>
<deprecates><expression><name>Term2C</name></expression></deprecates>
<deprecates><expression><name>Term2D</name></expression></deprecates>
<termsource status="modified">
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011"><locality type="clause"><referenceFrom>3.1</referenceFrom></locality></origin>
<modification>
Expand Down Expand Up @@ -965,21 +974,78 @@
<span class="fmt-autonum-delim">.</span>
<semx element="autonum" source="J">1</semx>
</fmt-xref-label>
<preferred>Term2</preferred>
<admitted>Term2A</admitted>
<admitted>Term2B</admitted>
<deprecates>DEPRECATED: Term2C</deprecates>
<deprecates>DEPRECATED: Term2D</deprecates>
<termsource status="modified">
<strong>SOURCE:</strong>
<preferred id="_">
<expression>
<name>Term2</name>
</expression>
</preferred>
<fmt-preferred>
<p>
<semx element="preferred" source="_">Term2</semx>
</p>
</fmt-preferred>
<admitted id="_">
<expression>
<name>Term2A</name>
</expression>
</admitted>
<admitted id="_">
<expression>
<name>Term2B</name>
</expression>
</admitted>
<fmt-admitted>
<p>
<semx element="admitted" source="_">Term2A</semx>
</p>
<p>
<semx element="admitted" source="_">Term2B</semx>
</p>
</fmt-admitted>
<deprecates id="_">
<expression>
<name>Term2C</name>
</expression>
</deprecates>
<deprecates id="_">
<expression>
<name>Term2D</name>
</expression>
</deprecates>
<fmt-deprecates>
<p>
DEPRECATED:
<semx element="deprecates" source="_">Term2C</semx>
</p>
<p>
DEPRECATED:
<semx element="deprecates" source="_">Term2D</semx>
</p>
</fmt-deprecates>
<termsource status="modified" id="_">
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011">
<locality type="clause">
<referenceFrom>3.1</referenceFrom>
</locality>
ISO 7301:2011, Clause 3.1
</origin>
, modified — The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here
<modification>
<p original-id="_e73a417d-ad39-417d-a4c8-20e4e2529489">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</p>
</modification>
</termsource>
<fmt-termsource status="modified">
<strong>SOURCE</strong>
:
<semx element="termsource" source="_">
<origin bibitemid="ISO7301" type="inline" citeas="ISO 7301:2011">
<locality type="clause">
<referenceFrom>3.1</referenceFrom>
</locality>
ISO 7301:2011, Clause 3.1
</origin>
, modified —
<semx element="modification" source="_">The term "cargo rice" is shown as deprecated, and Note 1 to entry is not included here</semx>
</semx>
</fmt-termsource>
</term>
</terms>
</sections>
Expand All @@ -994,7 +1060,7 @@
<p class='AltTerms' style='text-align:left;'>Term2B</p>
<p class='DeprecatedTerms' style='text-align:left;'>DEPRECATED: Term2C</p>
<p class='DeprecatedTerms' style='text-align:left;'>DEPRECATED: Term2D</p>
<p><b>SOURCE:</b>
<p><b>SOURCE</b>:
ISO&#xa0;7301:2011, Clause 3.1, modified &#x2014; The term "cargo rice" is shown as deprecated, and Note 1
to entry is not included here
</p>
Expand Down
2 changes: 1 addition & 1 deletion spec/metanorma/processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<fmt-title>1<tab/>Terms, Definitions, Symbols and Abbreviated Terms</fmt-title>
<term id="J">
<fmt-name>1.1</fmt-name>
<preferred>Term2</preferred>
<fmt-preferred><p>Term2</p></mt-preferred>
</term>
</terms>
</sections>
Expand Down

0 comments on commit 001dbcf

Please sign in to comment.