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

Consistent Module naming: https://github.com/metanorma/metanorma/issu… #318

Merged
merged 1 commit into from
Oct 11, 2024
Merged
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
1 change: 1 addition & 0 deletions Gemfile.devel
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gem "metanorma-standoc", git: "https://github.com/metanorma/metanorma-standoc", branch: "feature/ext-flavor"
4 changes: 2 additions & 2 deletions lib/isodoc/cc/base_convert.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
require "isodoc"

module IsoDoc
module CC
module Cc
module BaseConvert
def configuration
Metanorma::CC.configuration
Metanorma::Cc.configuration
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/cc/html_convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require "isodoc"

module IsoDoc
module CC
module Cc
# A {Converter} implementation that generates CC output, and a document
# schema encapsulation of the document for validation
class HtmlConvert < IsoDoc::Generic::HtmlConvert
Expand Down
4 changes: 2 additions & 2 deletions lib/isodoc/cc/i18n.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module IsoDoc
module CC
module Cc
class I18n < IsoDoc::Generic::I18n
def configuration
Metanorma::CC.configuration
Metanorma::Cc.configuration
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/cc/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require_relative "i18n"

module IsoDoc
module CC
module Cc
module Init
def metadata_init(lang, script, locale, i18n)
@meta = Metadata.new(lang, script, locale, i18n)
Expand Down
4 changes: 2 additions & 2 deletions lib/isodoc/cc/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
require "metanorma/cc"

module IsoDoc
module CC
module Cc
class Metadata < IsoDoc::Generic::Metadata
def configuration
Metanorma::CC.configuration
Metanorma::Cc.configuration
end

def initialize(lang, script, locale, labels)
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/cc/pdf_convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "isodoc"

module IsoDoc
module CC
module Cc
class PdfConvert < IsoDoc::Generic::PdfConvert
def initialize(options)
@libdir = File.dirname(__FILE__)
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/cc/presentation_xml_convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "isodoc"

module IsoDoc
module CC
module Cc
class PresentationXMLConvert < IsoDoc::Generic::PresentationXMLConvert
def annex1(elem)
lbl = @xrefs.anchor(elem["id"], :label)
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/cc/word_convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require "isodoc"

module IsoDoc
module CC
module Cc
# A {Converter} implementation that generates CSD output, and a document
# schema encapsulation of the document for validation
class WordConvert < IsoDoc::Generic::WordConvert
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/cc/xref.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module IsoDoc
module CC
module Cc
class Xref < IsoDoc::Generic::Xref
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma-cc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@

if defined? Metanorma::Registry
require_relative "metanorma/cc"
Metanorma::Registry.instance.register(Metanorma::CC::Processor)
Metanorma::Registry.instance.register(Metanorma::Cc::Processor)
end
4 changes: 2 additions & 2 deletions lib/metanorma/cc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require_relative "./cc/processor"

module Metanorma
module CC
module Cc
class Configuration < Metanorma::Generic::Configuration
def initialize(*args)
super
Expand All @@ -28,5 +28,5 @@ def configure
configure {}
end
end
Metanorma::Registry.instance.register(Metanorma::CC::Processor)
Metanorma::Registry.instance.register(Metanorma::Cc::Processor)

13 changes: 13 additions & 0 deletions lib/metanorma/cc/biblio-standoc.rng
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ standards defining organization, and that is rendered in a distinct manner</a:do
from other documents in the same doctype</a:documentation>
</ref>
</optional>
<ref name="flavor">
<a:documentation>Flavour of Metanorma used to process this document</a:documentation>
</ref>
<optional>
<ref name="editorialgroup">
<a:documentation>Groups associated with the production of the standards document, typically within
Expand Down Expand Up @@ -113,6 +116,16 @@ a standards definition organization</a:documentation>
<define name="DocumentSubtype">
<text/>
</define>
<define name="flavor">
<element name="flavor">
<ref name="MetanormaFlavor"/>
</element>
</define>
<define name="MetanormaFlavor">
<a:documentation>This is in fact an enum, as of this writing: standoc iso generic ietf ieee itu nist ogc csa cc iho ribose jis iec bsi bipm plateau.
However we prefer not to hardcode it, given ongoing extension.</a:documentation>
<text/>
</define>
<define name="editorialgroup">
<a:documentation>A group associated with the production of the standards document, typically within
a standards definition organization</a:documentation>
Expand Down
31 changes: 19 additions & 12 deletions lib/metanorma/cc/biblio.rng
Original file line number Diff line number Diff line change
Expand Up @@ -1382,18 +1382,7 @@ Applies whether the resource has already been created or not, and whether it is
<define name="bdate">
<a:documentation>Significant date in the lifecycle of the bibliographic item, including its production and its access</a:documentation>
<element name="date">
<attribute name="type">
<a:documentation>The phase of the production of or access to a bibliographic item</a:documentation>
<choice>
<ref name="BibliographicDateType"/>
<text/>
</choice>
</attribute>
<optional>
<attribute name="text">
<a:documentation>An optional textual description of the date, especially when a Gregorian date is not applicable</a:documentation>
</attribute>
</optional>
<ref name="bDateAttributes"/>
<optional>
<choice>
<group>
Expand All @@ -1416,6 +1405,20 @@ Applies whether the resource has already been created or not, and whether it is
</optional>
</element>
</define>
<define name="bDateAttributes">
<attribute name="type">
<a:documentation>The phase of the production of or access to a bibliographic item</a:documentation>
<choice>
<ref name="BibliographicDateType"/>
<text/>
</choice>
</attribute>
<optional>
<attribute name="text">
<a:documentation>An optional textual description of the date, especially when a Gregorian date is not applicable</a:documentation>
</attribute>
</optional>
</define>
<define name="docidentifier">
<a:documentation>An identifier of a bibliographic item in an international standard scheme</a:documentation>
<element name="docidentifier">
Expand Down Expand Up @@ -1884,6 +1887,10 @@ Detailed in https://www.relaton.org/model/relations/</a:documentation>
<value>hasAnnotation</value>
<value>draftOf</value>
<value>hasDraft</value>
<value>preliminaryDraftOf</value>
<value>hasPreliminaryDraft</value>
<value>revisionDraftOf</value>
<value>hasRevisionDraft</value>
<value>editionOf</value>
<value>hasEdition</value>
<value>updates</value>
Expand Down
14 changes: 7 additions & 7 deletions lib/metanorma/cc/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
require_relative "validate_section"

module Metanorma
module CC
module Cc
class Converter < Metanorma::Generic::Converter
register_for "cc"

def configuration
Metanorma::CC.configuration
Metanorma::Cc.configuration
end

def metadata_committee(node, xml)
Expand Down Expand Up @@ -43,23 +43,23 @@ def outputs(node, ret)
end

def html_converter(node)
IsoDoc::CC::HtmlConvert.new(html_extract_attributes(node))
IsoDoc::Cc::HtmlConvert.new(html_extract_attributes(node))
end

def pdf_converter(node)
return if node.attr("no-pdf")

IsoDoc::CC::PdfConvert.new(pdf_extract_attributes(node))
IsoDoc::Cc::PdfConvert.new(pdf_extract_attributes(node))
end

def doc_converter(node)
IsoDoc::CC::WordConvert.new(doc_extract_attributes(node))
IsoDoc::Cc::WordConvert.new(doc_extract_attributes(node))
end

def presentation_xml_converter(node)
IsoDoc::CC::PresentationXMLConvert
IsoDoc::Cc::PresentationXMLConvert
.new(doc_extract_attributes(node)
.merge(output_formats: ::Metanorma::CC::Processor.new.output_formats))
.merge(output_formats: ::Metanorma::Cc::Processor.new.output_formats))
end
end
end
Expand Down
14 changes: 7 additions & 7 deletions lib/metanorma/cc/processor.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
require "metanorma/processor"

module Metanorma
module CC
module Cc
class Processor < Metanorma::Generic::Processor
def configuration
Metanorma::CC.configuration
Metanorma::Cc.configuration
end

def initialize
Expand All @@ -22,20 +22,20 @@ def output_formats
end

def version
"Metanorma::CC #{Metanorma::CC::VERSION}"
"Metanorma::Cc #{Metanorma::Cc::VERSION}"
end

def output(isodoc_node, inname, outname, format, options={})
options_preprocess(options)
case format
when :html
IsoDoc::CC::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
IsoDoc::Cc::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname)
Copy link

Choose a reason for hiding this comment

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

Line is too long. [89/80]

when :doc
IsoDoc::CC::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
IsoDoc::Cc::WordConvert.new(options).convert(inname, isodoc_node, nil, outname)
Copy link

Choose a reason for hiding this comment

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

Line is too long. [89/80]

when :pdf
IsoDoc::CC::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname)
IsoDoc::Cc::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname)
Copy link

Choose a reason for hiding this comment

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

Line is too long. [88/80]

when :presentation
IsoDoc::CC::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
IsoDoc::Cc::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname)
Copy link

Choose a reason for hiding this comment

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

Line is too long. [100/80]

else
super
end
Expand Down
1 change: 1 addition & 0 deletions lib/metanorma/cc/relaton-cc.rng
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<optional>
<ref name="docsubtype"/>
</optional>
<ref name="flavor"/>
<ref name="editorialgroup"/>
<zeroOrMore>
<ref name="ics"/>
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/cc/validate_section.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require "metanorma-generic"

module Metanorma
module CC
module Cc
class Converter < Metanorma::Generic::Converter
def section_validate(doc)
advisory = doc.root.at("//bibdata/ext[doctype = 'advisory']")
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/cc/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Metanorma
module CC
module Cc
VERSION = "2.5.3".freeze
end
end
2 changes: 1 addition & 1 deletion metanorma-cc.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require "metanorma/cc/version"

Gem::Specification.new do |spec|
spec.name = "metanorma-cc"
spec.version = Metanorma::CC::VERSION
spec.version = Metanorma::Cc::VERSION
spec.authors = ["Ribose Inc."]
spec.email = ["[email protected]"]

Expand Down
14 changes: 7 additions & 7 deletions spec/isodoc/base_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
require "spec_helper"
require "fileutils"

RSpec.describe Metanorma::CC do
RSpec.describe Metanorma::Cc do
it "processes default metadata" do
csdc = IsoDoc::CC::HtmlConvert.new({})
csdc = IsoDoc::Cc::HtmlConvert.new({})
docxml, = csdc.convert_init(<<~INPUT, "test", true)
<csd-standard xmlns="https://www.calconnect.org/standards/csd">
<bibdata type="standard">
Expand Down Expand Up @@ -128,7 +128,7 @@
</preface>
</csd-standard>
INPUT
expect(Xml::C14n.format(IsoDoc::CC::HtmlConvert.new({})
expect(Xml::C14n.format(IsoDoc::Cc::HtmlConvert.new({})
.convert("test", input, true)
.gsub(%r{^.*<body}m, "<body")
.gsub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to Xml::C14n.format(<<~"OUTPUT")
Expand All @@ -151,7 +151,7 @@
</foreword></preface>
</csd-standard>
INPUT
expect(Xml::C14n.format(IsoDoc::CC::HtmlConvert.new({})
expect(Xml::C14n.format(IsoDoc::Cc::HtmlConvert.new({})
.convert("test", input, true)
.gsub(%r{^.*<body}m, "<body")
.gsub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to Xml::C14n.format(<<~"OUTPUT")
Expand Down Expand Up @@ -180,7 +180,7 @@
</sections>
</csd-standard>
INPUT
expect(Xml::C14n.format(IsoDoc::CC::HtmlConvert.new({})
expect(Xml::C14n.format(IsoDoc::Cc::HtmlConvert.new({})
.convert("test", input, true)
.gsub(%r{^.*<body}m, "<body")
.gsub(%r{</body>.*$}m, "</body>"))).to be_equivalent_to Xml::C14n.format(<<~"OUTPUT")
Expand Down Expand Up @@ -217,7 +217,7 @@
</body>
</html>
INPUT
expect(Xml::C14n.format(IsoDoc::CC::HtmlConvert.new({})
expect(Xml::C14n.format(IsoDoc::Cc::HtmlConvert.new({})
.cleanup(Nokogiri::XML(input)).to_s))
.to be_equivalent_to Xml::C14n.format(<<~OUTPUT)
<?xml version="1.0"?>
Expand Down Expand Up @@ -316,7 +316,7 @@
</csd-standard>
INPUT

expect(Xml::C14n.format(strip_guid(IsoDoc::CC::PresentationXMLConvert.new(presxml_options)
expect(Xml::C14n.format(strip_guid(IsoDoc::Cc::PresentationXMLConvert.new(presxml_options)
Copy link

Choose a reason for hiding this comment

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

Line is too long. [94/80]

.convert("test", input, true)
.gsub(%r{^.*<body}m, "<body")
.gsub(%r{</body>.*$}m, "</body>")))).to be_equivalent_to Xml::C14n.format(<<~OUTPUT)
Expand Down
Loading
Loading