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

single base tag in metanorma: https://github.com/metanorma/metanorma/… #332

Open
wants to merge 1 commit 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 "metanorma-standoc", git: "https://github.com/metanorma/metanorma-standoc", branch: "fix/single-root-tag"
gem "metanorma-generic", git: "https://github.com/metanorma/metanorma-generic", branch: "fix/single-root-tag"
4 changes: 2 additions & 2 deletions lib/metanorma/ribose/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ module Ribose
# schema encapsulation of the document for validation
#
class Converter < Metanorma::Generic::Converter
XML_ROOT_TAG = "rsd-standard".freeze
XML_NAMESPACE = "https://www.metanorma.org/ns/ribose".freeze
#XML_ROOT_TAG = "rsd-standard".freeze
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after #.

#XML_NAMESPACE = "https://www.metanorma.org/ns/ribose".freeze
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after #.


register_for "ribose"

Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/ribose/isodoc.rng
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ numbers</a:documentation>
</define>
<define name="standard-document">
<a:documentation>Representation of a standardisation document</a:documentation>
<element name="standard-document">
<element name="metanorma">
<ref name="Root-Attributes"/>
<ref name="bibdata">
<a:documentation>Bibliographic description of the document itself, expressed in the Relaton model</a:documentation>
Expand Down
57 changes: 27 additions & 30 deletions lib/metanorma/ribose/ribose.rng
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<grammar ns='https://www.metanorma.org/ns/ribose' xmlns="http://relaxng.org/ns/structure/1.0">
<grammar ns='https://www.metanorma.org/ns/standoc' xmlns="http://relaxng.org/ns/structure/1.0">
<!--
VERSION v1.2.1
Currently we inherit from a namespaced grammar, isostandard. Until we inherit from isodoc,
Expand All @@ -8,34 +8,31 @@
-->
<include href="relaton-ribose.rng"/>
<include href="isodoc.rng">
<start>
<ref name="rsd-standard"/>
</start>
<define name="standard-document">
<element name="metanorma">
<ref name="Root-Attributes"/>
<ref name="bibdata"/>
<zeroOrMore>
<ref name="termdocsource"/>
</zeroOrMore>
<optional>
<ref name="misccontainer"/>
</optional>
<optional>
<ref name="boilerplate"/>
</optional>
<ref name="preface"/>
<oneOrMore>
<ref name="sections"/>
</oneOrMore>
<zeroOrMore>
<ref name="annex"/>
</zeroOrMore>
<ref name="bibliography"/>
<zeroOrMore>
<ref name="indexsect"/>
</zeroOrMore>
</element>
</define>
</include>
<define name="rsd-standard">
<element name="rsd-standard">
<ref name="Root-Attributes"/>
<ref name="bibdata"/>
<zeroOrMore>
<ref name="termdocsource"/>
</zeroOrMore>
<optional>
<ref name="misccontainer"/>
</optional>
<optional>
<ref name="boilerplate"/>
</optional>
<ref name="preface"/>
<oneOrMore>
<ref name="sections"/>
</oneOrMore>
<zeroOrMore>
<ref name="annex"/>
</zeroOrMore>
<ref name="bibliography"/>
<zeroOrMore>
<ref name="indexsect"/>
</zeroOrMore>
</element>
</define>
</grammar>
16 changes: 8 additions & 8 deletions spec/metanorma/base_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
output = Xml::C14n.format(<<~"OUTPUT")
#{@blank_hdr}
<sections/>
</rsd-standard>
</metanorma>
OUTPUT

expect(Xml::C14n.format(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
Expand All @@ -38,7 +38,7 @@
output = Xml::C14n.format(<<~"OUTPUT")
#{@blank_hdr}
<sections/>
</rsd-standard>
</metanorma>
OUTPUT

expect(Xml::C14n.format(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
Expand Down Expand Up @@ -84,7 +84,7 @@

output = Xml::C14n.format(<<~"OUTPUT")
<?xml version="1.0" encoding="UTF-8"?>
<rsd-standard xmlns="https://www.metanorma.org/ns/ribose" type="semantic" version="#{Metanorma::Ribose::VERSION}">
<metanorma xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Ribose::VERSION}">
<bibdata type="standard">
<title language="en" format="text/plain">Main Title</title>
<docidentifier primary="true" type="Ribose">1000(wd)</docidentifier>
Expand Down Expand Up @@ -153,7 +153,7 @@
</presentation-metadata>
</metanorma-extension>
<sections/>
</rsd-standard>
</metanorma>
OUTPUT

output = output
Expand All @@ -180,7 +180,7 @@
:pub-uri: me.example.com
INPUT
output = Xml::C14n.format(<<~"OUTPUT")
<rsd-standard xmlns='https://www.metanorma.org/ns/ribose' type='semantic' version='#{Metanorma::Ribose::VERSION}'>
<metanorma xmlns='https://www.metanorma.org/ns/standoc' type='semantic' version='#{Metanorma::Ribose::VERSION}'>
<bibdata type="standard">
<title language="en" format="text/plain">Document title</title>
<docidentifier primary="true" type="Ribose">Code 1000</docidentifier>
Expand Down Expand Up @@ -273,7 +273,7 @@
</feedback-statement>
</boilerplate>
<sections/>
</rsd-standard>
</metanorma>
OUTPUT
expect(Xml::C14n.format(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
.to be_equivalent_to output
Expand Down Expand Up @@ -502,7 +502,7 @@
<title>Section 1</title>
</clause>
</sections>
</rsd-standard>
</metanorma>
OUTPUT

expect(Xml::C14n.format(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
Expand Down Expand Up @@ -621,7 +621,7 @@
</clause>
</preface>
<sections> </sections>
</rsd-standard>
</metanorma>
OUTPUT

expect(Xml::C14n.format(strip_guid(Asciidoctor.convert(input, *OPTIONS))))
Expand Down
6 changes: 3 additions & 3 deletions spec/metanorma/processor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
output = Xml::C14n.format(strip_guid(<<~"OUTPUT"))
#{blank_hdr_gen}
<sections/>
</rsd-standard>
</metanorma>
OUTPUT

expect(Xml::C14n.format(strip_guid(Nokogiri::XML(processor
Expand All @@ -40,7 +40,7 @@

it "generates HTML from IsoDoc XML" do
input = <<~INPUT
<rsd-standard xmlns="http://riboseinc.com/isoxml">
<metanorma xmlns="http://riboseinc.com/isoxml">
<sections>
<terms id="H" obligation="normative" displayorder="1">
<fmt-title>1<tab/>Terms, Definitions, Symbols and Abbreviated Terms</fmt-title>
Expand All @@ -50,7 +50,7 @@
</term>
</terms>
</sections>
</rsd-standard>
</metanorma>
INPUT

output = Xml::C14n.format(strip_guid(<<~OUTPUT))
Expand Down
8 changes: 0 additions & 8 deletions spec/metanorma/ribose_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,27 @@
subject(:config) { Metanorma::Ribose.configuration }
let(:default_organization_name_short) { "Ribose" }
let(:default_organization_name_long) { "Ribose Asia Limited" }
let(:default_document_namespace) do
"https://www.metanorma.org/ns/ribose"
end

it "sets default atrributes" do
expect(config.organization_name_short)
.to(eq(default_organization_name_short))
expect(config.organization_name_long)
.to(eq(default_organization_name_long))
expect(config.document_namespace)
.to(eq(default_document_namespace))
end
end

context "attribute setters" do
subject(:config) { Metanorma::Ribose.configuration }
let(:organization_name_short) { "Test" }
let(:organization_name_long) { "Test Corp." }
let(:document_namespace) { "https://example.com/" }

it "sets atrributes" do
Metanorma::Ribose.configure do |config|
config.organization_name_short = organization_name_short
config.organization_name_long = organization_name_long
config.document_namespace = document_namespace
end
expect(config.organization_name_short).to eq(organization_name_short)
expect(config.organization_name_long).to eq(organization_name_long)
expect(config.document_namespace).to eq(document_namespace)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def boilerplate(xmldoc)

BLANK_HDR = <<~"HDR".freeze
<?xml version="1.0" encoding="UTF-8"?>
<rsd-standard xmlns="https://www.metanorma.org/ns/ribose" type="semantic" version="#{Metanorma::Ribose::VERSION}">
<metanorma xmlns="https://www.metanorma.org/ns/standoc" type="semantic" version="#{Metanorma::Ribose::VERSION}">
<bibdata type="standard">
<title language="en" format="text/plain">Document title</title>
<contributor>
Expand Down
Loading