Skip to content

Commit

Permalink
refactor preface, ToC: metanorma/metanorma-jis#13
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Apr 25, 2023
1 parent 23d1e15 commit b533db4
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 30 deletions.
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: "fix/preface-toc"

1 change: 0 additions & 1 deletion lib/isodoc/cc/html/html_cc_intro.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<nav>
<h1 id="content">Contents</h1>
<div id="toc"></div>

</nav>
Expand Down
3 changes: 0 additions & 3 deletions lib/isodoc/cc/html/word_cc_intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,3 @@

</div>

<p class="zzContents" style='margin-top:0cm'><span lang="EN-GB">Contents</span></p>

WORDTOC
11 changes: 3 additions & 8 deletions lib/metanorma/cc/cc.rng
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar ns="https://www.metanorma.org/ns/csd" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<grammar ns='https://www.metanorma.org/ns/cc' xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<!--
VERSION v1.2.1
default namespace = "http://riboseinc.com/csd"
Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
we cannot have a new default namespace: we will end up with a grammar with two different
Expand Down Expand Up @@ -60,13 +61,7 @@
</include>
<define name="csd-standard">
<element name="csd-standard">
<attribute name="version"/>
<attribute name="type">
<choice>
<value>semantic</value>
<value>presentation</value>
</choice>
</attribute>
<ref name="Root-Attributes"/>
<ref name="bibdata"/>
<zeroOrMore>
<ref name="termdocsource"/>
Expand Down
19 changes: 12 additions & 7 deletions lib/metanorma/cc/isodoc.rng
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
these elements; we just want one namespace for any child grammars
of this.
-->
<!-- VERSION v1.2.1 -->
<grammar xmlns:a="http://relaxng.org/ns/compatibility/annotations/1.0" xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
<include href="reqt.rng"/>
<include href="basicdoc.rng">
Expand Down Expand Up @@ -1349,15 +1350,19 @@
</choice>
</element>
</define>
<define name="Root-Attributes">
<attribute name="version"/>
<attribute name="schema-version"/>
<attribute name="type">
<choice>
<value>semantic</value>
<value>presentation</value>
</choice>
</attribute>
</define>
<define name="standard-document">
<element name="standard-document">
<attribute name="version"/>
<attribute name="type">
<choice>
<value>semantic</value>
<value>presentation</value>
</choice>
</attribute>
<ref name="Root-Attributes"/>
<ref name="bibdata"/>
<optional>
<ref name="misccontainer"/>
Expand Down
25 changes: 14 additions & 11 deletions spec/isodoc/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -316,29 +316,32 @@
</csd-standard>
INPUT

expect(xmlpp(IsoDoc::CC::PresentationXMLConvert.new(presxml_options)
expect(xmlpp(strip_guid(IsoDoc::CC::PresentationXMLConvert.new(presxml_options)
.convert("test", input, true)
.gsub(%r{^.*<body}m, "<body")
.gsub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to xmlpp(<<~"OUTPUT")
.gsub(%r{</body>.*$}m, "</body>")))).to be_equivalent_to xmlpp(<<~"OUTPUT")
<csd-standard xmlns="http://riboseinc.com/isoxml" type="presentation">
<preface>
<foreword obligation="informative" displayorder="1">
<clause type="toc" id="_" displayorder="1">
<title depth="1">Table of contents</title>
</clause>
<foreword obligation="informative" displayorder="2">
<title>Foreword</title>
<p id="A">This is a preamble</p>
</foreword>
<introduction id="B" obligation="informative" displayorder="2">
<introduction id="B" obligation="informative" displayorder="3">
<title>Introduction</title>
<clause id="C" inline-header="false" obligation="informative">
<title depth="2">Introduction Subsection</title>
</clause>
</introduction>
</preface>
<sections>
<clause id="D" obligation="normative" displayorder="6">
<clause id="D" obligation="normative" displayorder="7">
<title depth="1">4.<tab/>Scope</title>
<p id="E">Text</p>
</clause>
<clause id="H" obligation="normative" displayorder="4">
<clause id="H" obligation="normative" displayorder="5">
<title depth="1">2.<tab/>Terms, Definitions, Symbols and Abbreviated Terms</title>
<terms id="I" obligation="normative">
<title depth="2">2.1.<tab/>Normal Terms</title>
Expand All @@ -353,13 +356,13 @@
</dl>
</definitions>
</clause>
<definitions id="L" displayorder="5"><title>3.</title>
<definitions id="L" displayorder="6"><title>3.</title>
<dl>
<dt>Symbol</dt>
<dd>Definition</dd>
</dl>
</definitions>
<clause id="M" inline-header="false" obligation="normative" displayorder="7">
<clause id="M" inline-header="false" obligation="normative" displayorder="8">
<title depth="1">5.<tab/>Clause 4</title>
<clause id="N" inline-header="false" obligation="normative">
<title depth="2">5.1.<tab/>Introduction</title>
Expand All @@ -369,7 +372,7 @@
</clause>
</clause>
</sections>
<annex id="P" inline-header="false" obligation="normative" displayorder="8">
<annex id="P" inline-header="false" obligation="normative" displayorder="9">
<title><strong>Appendix A</strong><br/>(normative)<br/><strong>Annex</strong></title>
<clause id="Q" inline-header="false" obligation="normative">
<title depth="2">A.1.<tab/>Annex A.1</title>
Expand All @@ -379,10 +382,10 @@
</clause>
</annex>
<bibliography>
<references id="R" normative="true" obligation="informative" displayorder="3">
<references id="R" normative="true" obligation="informative" displayorder="4">
<title depth="1">1.<tab/>Normative References</title>
</references>
<clause id="S" obligation="informative" displayorder="9">
<clause id="S" obligation="informative" displayorder="10">
<title depth="1">Bibliography</title>
<references id="T" normative="false" obligation="informative">
<title depth="2">Bibliography Subsection</title>
Expand Down

0 comments on commit b533db4

Please sign in to comment.