Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rspec: https://github.com/metanorma/isodoc/issues/630 #1271

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gemfile.devel
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
gem "isodoc", git: "https://github.com/metanorma/isodoc", branch: "feature/presentation-terms"
gem "mn-requirements", git: "https://github.com/metanorma/mn-requirements", branch: "main"
6 changes: 5 additions & 1 deletion lib/isodoc/iso/presentation_terms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
def concept(docxml)
concept_term(docxml)
docxml.xpath(ns("//concept")).each do |node|
node.ancestors("definition, termsource, related").empty? and
concept_render(node, ital: "false", ref: "false",
linkref: "true", linkmention: "false")
end
Expand All @@ -19,7 +20,10 @@ def concept_term(docxml)
docxml.xpath(ns("//term")).each do |f|
m = {}
(f.xpath(ns(".//concept")) - f.xpath(ns(".//term//concept")))
.each { |c| concept_term1(c, m) }
.each do |c|
c.ancestors("definition, termsource, related").empty? and
concept_term1(c, m)
end
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/isodoc/blocks_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1525,7 +1525,7 @@
<span class="stddocNumber">712</span>
, Section 1
</xref>
— with adjustments ;
<semx element="modification" source="_">with adjustments</semx>;
<xref type="inline" target="ISO712">
<span class="stdpublisher">ISO </span>
<span class="stddocNumber">712</span>
Expand Down
3,003 changes: 1,520 additions & 1,483 deletions spec/isodoc/i18n_spec.rb

Large diffs are not rendered by default.

673 changes: 444 additions & 229 deletions spec/isodoc/inline_spec.rb

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions spec/isodoc/postproc_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -145,15 +145,15 @@
Terms and Definitions</fmt-title>
<term id="paddy1">
<fmt-name>1.1</fmt-name>
<preferred>paddy</preferred>
<definition>
<fmt-preferred><p>paddy</p></fmt-preferred>
<fmt-definition>
<p id="_eb29b35e-123e-4d1c-b50b-2714d41e747f">rice retaining its husk after threshing</p>
</definition>
<termsource status="modified">[SOURCE:
</fmt-definition>
<fmt-termsource status="modified">[SOURCE:
<origin bibitemid="ISO7301" citeas="ISO 7301:2011" type="inline"><locality type="clause">
<referenceFrom>3.1</referenceFrom></locality>ISO 7301:2011, 3.1</origin>, modified &#x2013;
The term &quot;cargo rice&quot; is shown as deprecated, and Note 1 to entry is not included here]
</termsource>
</fmt-termsource>
</term>
</terms>
</sections>
Expand Down
95 changes: 52 additions & 43 deletions spec/isodoc/section_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
INPUT

presxml = <<~OUTPUT
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
<iso-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
<preface>
<clause type="toc" id="_" displayorder="1">
<fmt-title depth="1">Contents</fmt-title>
Expand Down Expand Up @@ -196,9 +196,18 @@
<span class="fmt-autonum-delim">.</span>
<semx element="autonum" source="J">1</semx>
</fmt-xref-label>
<preferred>
<strong>Term2</strong>
<preferred id="_">
<expression>
<name>Term2</name>
</expression>
</preferred>
<fmt-preferred>
<p>
<semx element="preferred" source="_">
<strong>Term2</strong>
</semx>
</p>
</fmt-preferred>
</term>
</terms>
<definitions id="K">
Expand Down Expand Up @@ -440,44 +449,44 @@
<span class="fmt-autonum-delim">.</span>
<semx element="autonum" source="Q2a">1</semx>
</fmt-xref-label>
<clause id="Q2b" inline-header="false" obligation="normative">
<title id="_">Appendix subsubclause</title>
<fmt-title depth="4">
<span class="fmt-caption-label">
<span class="fmt-element-name">Appendix</span>
<semx element="autonum" source="Q2">1</semx>
<span class="fmt-autonum-delim">.</span>
<semx element="autonum" source="Q2a">1</semx>
<span class="fmt-autonum-delim">.</span>
<semx element="autonum" source="Q2b">1</semx>
</span>
<span class="fmt-caption-delim">
<tab/>
</span>
<semx element="title" source="_">Appendix subsubclause</semx>
</fmt-title>
<fmt-xref-label>
<span class="fmt-element-name">Appendix</span>
<semx element="autonum" source="Q2">1</semx>
<span class="fmt-autonum-delim">.</span>
<semx element="autonum" source="Q2a">1</semx>
<span class="fmt-autonum-delim">.</span>
<semx element="autonum" source="Q2b">1</semx>
</fmt-xref-label>
<fmt-xref-label container="P">
<span class="fmt-xref-container">
<span class="fmt-element-name">Annex</span>
<semx element="autonum" source="P">A</semx>
</span>
<span class="fmt-comma">,</span>
<span class="fmt-element-name">Appendix</span>
<semx element="autonum" source="Q2">1</semx>
<span class="fmt-autonum-delim">.</span>
<semx element="autonum" source="Q2a">1</semx>
<span class="fmt-autonum-delim">.</span>
<semx element="autonum" source="Q2b">1</semx>
</fmt-xref-label>
</clause>
<clause id="Q2b" inline-header="false" obligation="normative">
<title id="_">Appendix subsubclause</title>
<fmt-title depth="4">
<span class="fmt-caption-label">
<span class="fmt-element-name">Appendix</span>
<semx element="autonum" source="Q2">1</semx>
<span class="fmt-autonum-delim">.</span>
<semx element="autonum" source="Q2a">1</semx>
<span class="fmt-autonum-delim">.</span>
<semx element="autonum" source="Q2b">1</semx>
</span>
<span class="fmt-caption-delim">
<tab/>
</span>
<semx element="title" source="_">Appendix subsubclause</semx>
</fmt-title>
<fmt-xref-label>
<span class="fmt-element-name">Appendix</span>
<semx element="autonum" source="Q2">1</semx>
<span class="fmt-autonum-delim">.</span>
<semx element="autonum" source="Q2a">1</semx>
<span class="fmt-autonum-delim">.</span>
<semx element="autonum" source="Q2b">1</semx>
</fmt-xref-label>
<fmt-xref-label container="P">
<span class="fmt-xref-container">
<span class="fmt-element-name">Annex</span>
<semx element="autonum" source="P">A</semx>
</span>
<span class="fmt-comma">,</span>
<span class="fmt-element-name">Appendix</span>
<semx element="autonum" source="Q2">1</semx>
<span class="fmt-autonum-delim">.</span>
<semx element="autonum" source="Q2a">1</semx>
<span class="fmt-autonum-delim">.</span>
<semx element="autonum" source="Q2b">1</semx>
</fmt-xref-label>
</clause>
</clause>
</appendix>
<references id="Q3" normative="false">
Expand Down Expand Up @@ -1034,7 +1043,7 @@
<fmt-title>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></fmt-preferred>
</term>
</terms>
</sections>
Expand Down Expand Up @@ -1105,7 +1114,7 @@
<substage>60</substage>
</status>
<copyright>
<from>2024</from>
<from>#{Date.today.year}</from>
<owner>
<organization>
<name>International Organization for Standardization</name>
Expand Down
2 changes: 1 addition & 1 deletion spec/isodoc/table_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
</localityStack>
, Section 1
</origin>
— with adjustments]
<semx element="modification" source="_">with adjustments</semx>]
</source>
<note>
<fmt-name>
Expand Down
Loading
Loading