From 7299711d841fe4b3790084a3c703e02f6dceed45 Mon Sep 17 00:00:00 2001 From: Nick Nicholas Date: Wed, 9 Oct 2024 22:48:29 +1100 Subject: [PATCH] Consistent Module naming: https://github.com/metanorma/metanorma/issues/367 --- Gemfile.devel | 1 + lib/isodoc/iho/base_convert.rb | 4 +-- lib/isodoc/iho/html_convert.rb | 2 +- lib/isodoc/iho/init.rb | 6 ++-- lib/isodoc/iho/metadata.rb | 4 +-- lib/isodoc/iho/pdf_convert.rb | 2 +- lib/isodoc/iho/presentation_xml_convert.rb | 2 +- lib/isodoc/iho/word_convert.rb | 2 +- lib/isodoc/iho/xref.rb | 2 +- lib/metanorma-iho.rb | 2 +- lib/metanorma/iho.rb | 4 +-- lib/metanorma/iho/biblio-standoc.rng | 13 +++++++ lib/metanorma/iho/biblio.rng | 31 +++++++++------- lib/metanorma/iho/converter.rb | 14 ++++---- lib/metanorma/iho/processor.rb | 14 ++++---- lib/metanorma/iho/relaton-iho.rng | 1 + lib/metanorma/iho/version.rb | 2 +- lib/relaton/render/fields.rb | 2 +- lib/relaton/render/general.rb | 6 ++-- lib/relaton/render/parse.rb | 2 +- metanorma-iho.gemspec | 2 +- spec/isodoc/html_convert_spec.rb | 14 ++++---- spec/isodoc/ref_spec.rb | 4 +-- spec/isodoc/xref_spec.rb | 28 +++++++-------- spec/metanorma/base_spec.rb | 17 +++++---- spec/metanorma/processor_spec.rb | 6 ++-- spec/metanorma/rsd_spec.rb | 42 +++++++++++----------- spec/metanorma/validate_spec.rb | 4 +-- spec/spec_helper.rb | 7 ++-- 29 files changed, 134 insertions(+), 106 deletions(-) create mode 100644 Gemfile.devel diff --git a/Gemfile.devel b/Gemfile.devel new file mode 100644 index 0000000..c677e08 --- /dev/null +++ b/Gemfile.devel @@ -0,0 +1 @@ +gem "metanorma-standoc", git: "https://github.com/metanorma/metanorma-standoc", branch: "feature/ext-flavor" diff --git a/lib/isodoc/iho/base_convert.rb b/lib/isodoc/iho/base_convert.rb index 849da16..d7eeb76 100644 --- a/lib/isodoc/iho/base_convert.rb +++ b/lib/isodoc/iho/base_convert.rb @@ -1,5 +1,5 @@ module IsoDoc - module IHO + module Iho module BaseConvert # terms not defined in standoc def error_parse(node, out) @@ -11,7 +11,7 @@ def error_parse(node, out) end def configuration - Metanorma::IHO.configuration + Metanorma::Iho.configuration end end end diff --git a/lib/isodoc/iho/html_convert.rb b/lib/isodoc/iho/html_convert.rb index aa87c72..c8721a4 100644 --- a/lib/isodoc/iho/html_convert.rb +++ b/lib/isodoc/iho/html_convert.rb @@ -3,7 +3,7 @@ require_relative "init" module IsoDoc - module IHO + module Iho class HtmlConvert < IsoDoc::Generic::HtmlConvert include BaseConvert diff --git a/lib/isodoc/iho/init.rb b/lib/isodoc/iho/init.rb index 75266da..15a251d 100644 --- a/lib/isodoc/iho/init.rb +++ b/lib/isodoc/iho/init.rb @@ -3,7 +3,7 @@ require_relative "xref" module IsoDoc - module IHO + module Iho module Init def metadata_init(lang, script, locale, labels) @meta = Metadata.new(lang, script, locale, labels) @@ -18,12 +18,12 @@ def i18n_init(lang, script, locale, i18nyaml = nil) @i18n = I18n.new( lang, script, locale: locale, i18nyaml: i18nyaml || - Metanorma::IHO.configuration.i18nyaml || @i18nyaml + Metanorma::Iho.configuration.i18nyaml || @i18nyaml ) end def bibrenderer(options = {}) - ::Relaton::Render::IHO::General.new(options.merge(language: @lang, + ::Relaton::Render::Iho::General.new(options.merge(language: @lang, i18nhash: @i18n.get)) end diff --git a/lib/isodoc/iho/metadata.rb b/lib/isodoc/iho/metadata.rb index 36bfc2f..3d408d4 100644 --- a/lib/isodoc/iho/metadata.rb +++ b/lib/isodoc/iho/metadata.rb @@ -1,11 +1,11 @@ require "isodoc" module IsoDoc - module IHO + module Iho class Metadata < IsoDoc::Generic::Metadata def configuration - Metanorma::IHO.configuration + Metanorma::Iho.configuration end def series(xml, _out) diff --git a/lib/isodoc/iho/pdf_convert.rb b/lib/isodoc/iho/pdf_convert.rb index ab0ece4..31c155a 100644 --- a/lib/isodoc/iho/pdf_convert.rb +++ b/lib/isodoc/iho/pdf_convert.rb @@ -3,7 +3,7 @@ require_relative "base_convert" module IsoDoc - module IHO + module Iho # A {Converter} implementation that generates PDF HTML output, and a # document schema encapsulation of the document for validation class PdfConvert < IsoDoc::Generic::PdfConvert diff --git a/lib/isodoc/iho/presentation_xml_convert.rb b/lib/isodoc/iho/presentation_xml_convert.rb index 6997eda..d068e35 100644 --- a/lib/isodoc/iho/presentation_xml_convert.rb +++ b/lib/isodoc/iho/presentation_xml_convert.rb @@ -4,7 +4,7 @@ require_relative "../../relaton/render/general" module IsoDoc - module IHO + module Iho class PresentationXMLConvert < IsoDoc::Generic::PresentationXMLConvert def norm_ref_entry_code(ordinal, _idents, _ids, _standard, _datefn, _bib) "[#{ordinal}]" diff --git a/lib/isodoc/iho/word_convert.rb b/lib/isodoc/iho/word_convert.rb index 7ecce14..759e813 100644 --- a/lib/isodoc/iho/word_convert.rb +++ b/lib/isodoc/iho/word_convert.rb @@ -3,7 +3,7 @@ require_relative "init" module IsoDoc - module IHO + module Iho # A {Converter} implementation that generates Word output, and a document # schema encapsulation of the document for validation class WordConvert < IsoDoc::Generic::WordConvert diff --git a/lib/isodoc/iho/xref.rb b/lib/isodoc/iho/xref.rb index fc5d491..637ae0e 100644 --- a/lib/isodoc/iho/xref.rb +++ b/lib/isodoc/iho/xref.rb @@ -1,7 +1,7 @@ require "isodoc/generic/xref" module IsoDoc - module IHO + module Iho class Counter < IsoDoc::XrefGen::Counter end diff --git a/lib/metanorma-iho.rb b/lib/metanorma-iho.rb index 0511518..e885dc0 100644 --- a/lib/metanorma-iho.rb +++ b/lib/metanorma-iho.rb @@ -10,5 +10,5 @@ if defined? Metanorma::Registry require_relative "metanorma/iho" - Metanorma::Registry.instance.register(Metanorma::IHO::Processor) + Metanorma::Registry.instance.register(Metanorma::Iho::Processor) end diff --git a/lib/metanorma/iho.rb b/lib/metanorma/iho.rb index edcbcdb..18f8a9a 100644 --- a/lib/metanorma/iho.rb +++ b/lib/metanorma/iho.rb @@ -3,7 +3,7 @@ require "metanorma/iho/processor" module Metanorma - module IHO + module Iho class Configuration < Metanorma::Generic::Configuration def initialize(*args) @@ -29,4 +29,4 @@ def configure configure {} end end -Metanorma::Registry.instance.register(Metanorma::IHO::Processor) +Metanorma::Registry.instance.register(Metanorma::Iho::Processor) diff --git a/lib/metanorma/iho/biblio-standoc.rng b/lib/metanorma/iho/biblio-standoc.rng index 70a0502..6588af6 100644 --- a/lib/metanorma/iho/biblio-standoc.rng +++ b/lib/metanorma/iho/biblio-standoc.rng @@ -72,6 +72,9 @@ standards defining organization, and that is rendered in a distinct manner + + Flavour of Metanorma used to process this document + Groups associated with the production of the standards document, typically within @@ -113,6 +116,16 @@ a standards definition organization + + + + + + + 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 group associated with the production of the standards document, typically within a standards definition organization diff --git a/lib/metanorma/iho/biblio.rng b/lib/metanorma/iho/biblio.rng index 1a206da..9cfa89f 100644 --- a/lib/metanorma/iho/biblio.rng +++ b/lib/metanorma/iho/biblio.rng @@ -1382,18 +1382,7 @@ Applies whether the resource has already been created or not, and whether it is Significant date in the lifecycle of the bibliographic item, including its production and its access - - The phase of the production of or access to a bibliographic item - - - - - - - - An optional textual description of the date, especially when a Gregorian date is not applicable - - + @@ -1416,6 +1405,20 @@ Applies whether the resource has already been created or not, and whether it is + + + The phase of the production of or access to a bibliographic item + + + + + + + + An optional textual description of the date, especially when a Gregorian date is not applicable + + + An identifier of a bibliographic item in an international standard scheme @@ -1884,6 +1887,10 @@ Detailed in https://www.relaton.org/model/relations/ hasAnnotation draftOf hasDraft + preliminaryDraftOf + hasPreliminaryDraft + revisionDraftOf + hasRevisionDraft editionOf hasEdition updates diff --git a/lib/metanorma/iho/converter.rb b/lib/metanorma/iho/converter.rb index a05c7bf..7203430 100644 --- a/lib/metanorma/iho/converter.rb +++ b/lib/metanorma/iho/converter.rb @@ -2,7 +2,7 @@ require "metanorma/generic/converter" module Metanorma - module IHO + module Iho class Converter < Metanorma::Generic::Converter XML_ROOT_TAG = "iho-standard".freeze XML_NAMESPACE = "https://www.metanorma.org/ns/iho".freeze @@ -97,27 +97,27 @@ def metadata_version(node, xml) end def configuration - Metanorma::IHO.configuration + Metanorma::Iho.configuration end def presentation_xml_converter(node) - IsoDoc::IHO::PresentationXMLConvert + IsoDoc::Iho::PresentationXMLConvert .new(html_extract_attributes(node) - .merge(output_formats: ::Metanorma::IHO::Processor.new.output_formats)) + .merge(output_formats: ::Metanorma::Iho::Processor.new.output_formats)) end def html_converter(node) - IsoDoc::IHO::HtmlConvert.new(html_extract_attributes(node)) + IsoDoc::Iho::HtmlConvert.new(html_extract_attributes(node)) end def pdf_converter(node) return nil if node.attr("no-pdf") - IsoDoc::IHO::PdfConvert.new(pdf_extract_attributes(node)) + IsoDoc::Iho::PdfConvert.new(pdf_extract_attributes(node)) end def doc_converter(node) - IsoDoc::IHO::WordConvert.new(doc_extract_attributes(node)) + IsoDoc::Iho::WordConvert.new(doc_extract_attributes(node)) end end end diff --git a/lib/metanorma/iho/processor.rb b/lib/metanorma/iho/processor.rb index d9ba66f..c5a6dd6 100644 --- a/lib/metanorma/iho/processor.rb +++ b/lib/metanorma/iho/processor.rb @@ -1,10 +1,10 @@ require "metanorma/processor" module Metanorma - module IHO + module Iho class Processor < Metanorma::Generic::Processor def configuration - Metanorma::IHO.configuration + Metanorma::Iho.configuration end def output_formats @@ -16,20 +16,20 @@ def output_formats end def version - "Metanorma::IHO #{Metanorma::IHO::VERSION}" + "Metanorma::Iho #{Metanorma::Iho::VERSION}" end def output(isodoc_node, inname, outname, format, options={}) options_preprocess(options) case format when :html - IsoDoc::IHO::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname) + IsoDoc::Iho::HtmlConvert.new(options).convert(inname, isodoc_node, nil, outname) when :doc - IsoDoc::IHO::WordConvert.new(options).convert(inname, isodoc_node, nil, outname) + IsoDoc::Iho::WordConvert.new(options).convert(inname, isodoc_node, nil, outname) when :pdf - IsoDoc::IHO::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname) + IsoDoc::Iho::PdfConvert.new(options).convert(inname, isodoc_node, nil, outname) when :presentation - IsoDoc::IHO::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname) + IsoDoc::Iho::PresentationXMLConvert.new(options).convert(inname, isodoc_node, nil, outname) else super end diff --git a/lib/metanorma/iho/relaton-iho.rng b/lib/metanorma/iho/relaton-iho.rng index 1939372..f3abefd 100644 --- a/lib/metanorma/iho/relaton-iho.rng +++ b/lib/metanorma/iho/relaton-iho.rng @@ -34,6 +34,7 @@ + diff --git a/lib/metanorma/iho/version.rb b/lib/metanorma/iho/version.rb index c8b6fde..068a2c1 100644 --- a/lib/metanorma/iho/version.rb +++ b/lib/metanorma/iho/version.rb @@ -1,5 +1,5 @@ module Metanorma - module IHO + module Iho VERSION = "1.0.4".freeze end end diff --git a/lib/relaton/render/fields.rb b/lib/relaton/render/fields.rb index 7103daa..a50411d 100644 --- a/lib/relaton/render/fields.rb +++ b/lib/relaton/render/fields.rb @@ -1,6 +1,6 @@ module Relaton module Render - module IHO + module Iho class Fields < ::Relaton::Render::Fields def edition_fields_format(hash) super diff --git a/lib/relaton/render/general.rb b/lib/relaton/render/general.rb index ba8c645..990fb1a 100644 --- a/lib/relaton/render/general.rb +++ b/lib/relaton/render/general.rb @@ -4,7 +4,7 @@ module Relaton module Render - module IHO + module Iho class General < ::Relaton::Render::IsoDoc::General def config_loc YAML.load_file(File.join(File.dirname(__FILE__), "config.yml")) @@ -12,8 +12,8 @@ def config_loc def klass_initialize(_options) super - @fieldsklass = Relaton::Render::IHO::Fields - @parseklass = Relaton::Render::IHO::Parse + @fieldsklass = Relaton::Render::Iho::Fields + @parseklass = Relaton::Render::Iho::Parse end end end diff --git a/lib/relaton/render/parse.rb b/lib/relaton/render/parse.rb index 6c755ab..57d9689 100644 --- a/lib/relaton/render/parse.rb +++ b/lib/relaton/render/parse.rb @@ -1,6 +1,6 @@ module Relaton module Render - module IHO + module Iho class Parse < ::Relaton::Render::Parse def uri(doc) uri = nil diff --git a/metanorma-iho.gemspec b/metanorma-iho.gemspec index 9112d5c..b7c14f9 100644 --- a/metanorma-iho.gemspec +++ b/metanorma-iho.gemspec @@ -4,7 +4,7 @@ require "metanorma/iho/version" Gem::Specification.new do |spec| spec.name = "metanorma-iho" - spec.version = Metanorma::IHO::VERSION + spec.version = Metanorma::Iho::VERSION spec.authors = ["Ribose Inc."] spec.email = ["open.source@ribose.com"] diff --git a/spec/isodoc/html_convert_spec.rb b/spec/isodoc/html_convert_spec.rb index 2589160..207dbfe 100644 --- a/spec/isodoc/html_convert_spec.rb +++ b/spec/isodoc/html_convert_spec.rb @@ -8,9 +8,9 @@ "..", "..", "lib", "isodoc", "iho", "html" )).cleanpath.to_s -RSpec.describe IsoDoc::IHO do +RSpec.describe IsoDoc::Iho do it "processes default metadata" do - csdc = IsoDoc::IHO::HtmlConvert.new({}) + csdc = IsoDoc::Iho::HtmlConvert.new({}) input = <<~"INPUT" @@ -252,7 +252,7 @@ OUTPUT - expect(Xml::C14n.format(strip_guid(IsoDoc::IHO::PresentationXMLConvert + expect(Xml::C14n.format(strip_guid(IsoDoc::Iho::PresentationXMLConvert .new(presxml_options) .convert("test", input, true) .sub(%r{.*}m, "")))) @@ -432,7 +432,7 @@ OUTPUT - expect(Xml::C14n.format(strip_guid(IsoDoc::IHO::PresentationXMLConvert + expect(Xml::C14n.format(strip_guid(IsoDoc::Iho::PresentationXMLConvert .new(presxml_options) .convert("test", input, true) .sub(%r{.*}m, "")))) @@ -698,12 +698,12 @@ OUTPUT - expect(Xml::C14n.format(strip_guid(IsoDoc::IHO::PresentationXMLConvert + expect(Xml::C14n.format(strip_guid(IsoDoc::Iho::PresentationXMLConvert .new(presxml_options) .convert("test", input, true) .sub(%r{.*}m, "")))) .to be_equivalent_to Xml::C14n.format(presxml) - expect(Xml::C14n.format(IsoDoc::IHO::HtmlConvert.new({}) + expect(Xml::C14n.format(IsoDoc::Iho::HtmlConvert.new({}) .convert("test", presxml, true) .gsub(%r{^.*.*}m, ""))) @@ -1123,7 +1123,7 @@ OUTPUT expect(Xml::C14n.format(strip_guid(Nokogiri::XML( - IsoDoc::IHO::PresentationXMLConvert + IsoDoc::Iho::PresentationXMLConvert .new(presxml_options) .convert("test", input, true), ) diff --git a/spec/isodoc/ref_spec.rb b/spec/isodoc/ref_spec.rb index cdf9c59..a89f745 100644 --- a/spec/isodoc/ref_spec.rb +++ b/spec/isodoc/ref_spec.rb @@ -598,11 +598,11 @@ OUTPUT - expect(Xml::C14n.format(strip_guid(IsoDoc::IHO::PresentationXMLConvert.new(presxml_options) + expect(Xml::C14n.format(strip_guid(IsoDoc::Iho::PresentationXMLConvert.new(presxml_options) .convert("test", input, true) .sub(%r{.*}m, "")))) .to be_equivalent_to Xml::C14n.format(presxml) - expect(Xml::C14n.format(IsoDoc::IHO::HtmlConvert.new({}) + expect(Xml::C14n.format(IsoDoc::Iho::HtmlConvert.new({}) .convert("test", presxml, true) .gsub(%r{^.*.*}m, ""))) diff --git a/spec/isodoc/xref_spec.rb b/spec/isodoc/xref_spec.rb index 697d235..ddd4983 100644 --- a/spec/isodoc/xref_spec.rb +++ b/spec/isodoc/xref_spec.rb @@ -107,7 +107,7 @@

OUTPUT - expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::IHO::PresentationXMLConvert + expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::Iho::PresentationXMLConvert .new(presxml_options) .convert("test", input, true)) .at("//xmlns:foreword").to_xml)) @@ -226,7 +226,7 @@

OUTPUT - expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::IHO::PresentationXMLConvert + expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::Iho::PresentationXMLConvert .new(presxml_options) .convert("test", input, true)) .at("//xmlns:foreword").to_xml)) @@ -378,7 +378,7 @@

OUTPUT - expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::IHO::PresentationXMLConvert + expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::Iho::PresentationXMLConvert .new(presxml_options) .convert("test", input, true)) .at("//xmlns:foreword").to_xml)) @@ -530,7 +530,7 @@

OUTPUT - expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::IHO::PresentationXMLConvert + expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::Iho::PresentationXMLConvert .new(presxml_options) .convert("test", input, true)) .at("//xmlns:foreword").to_xml)) @@ -642,7 +642,7 @@

OUTPUT - expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::IHO::PresentationXMLConvert + expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::Iho::PresentationXMLConvert .new(presxml_options) .convert("test", input, true)) .at("//xmlns:foreword").to_xml)) @@ -756,7 +756,7 @@

OUTPUT - expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::IHO::PresentationXMLConvert + expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::Iho::PresentationXMLConvert .new(presxml_options) .convert("test", input, true)) .at("//xmlns:foreword").to_xml)) @@ -782,7 +782,7 @@

OUTPUT - expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::IHO::PresentationXMLConvert + expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::Iho::PresentationXMLConvert .new(presxml_options) .convert("test", input, true)) .at("//xmlns:clause[@id='widgets1']").to_xml)) @@ -895,7 +895,7 @@

OUTPUT - expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::IHO::PresentationXMLConvert + expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::Iho::PresentationXMLConvert .new(presxml_options) .convert("test", input, true)) .at("//xmlns:foreword").to_xml)) @@ -1018,7 +1018,7 @@

OUTPUT - expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::IHO::PresentationXMLConvert + expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::Iho::PresentationXMLConvert .new(presxml_options) .convert("test", input, true)) .at("//xmlns:foreword").to_xml)) @@ -1131,7 +1131,7 @@

OUTPUT - expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::IHO::PresentationXMLConvert + expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::Iho::PresentationXMLConvert .new(presxml_options) .convert("test", input, true)) .at("//xmlns:foreword").to_xml)) @@ -1244,7 +1244,7 @@

OUTPUT - expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::IHO::PresentationXMLConvert + expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::Iho::PresentationXMLConvert .new(presxml_options) .convert("test", input, true)) .at("//xmlns:foreword").to_xml)) @@ -1358,7 +1358,7 @@

OUTPUT - expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::IHO::PresentationXMLConvert + expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::Iho::PresentationXMLConvert .new(presxml_options) .convert("test", input, true)) .at("//xmlns:foreword").to_xml)) @@ -1555,7 +1555,7 @@

OUTPUT - expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::IHO::PresentationXMLConvert + expect(Xml::C14n.format(Nokogiri.XML(IsoDoc::Iho::PresentationXMLConvert .new(presxml_options) .convert("test", input, true)) .at("//xmlns:foreword").to_xml)) @@ -1762,7 +1762,7 @@ OUTPUT - expect(Xml::C14n.format(strip_guid(IsoDoc::IHO::PresentationXMLConvert + expect(Xml::C14n.format(strip_guid(IsoDoc::Iho::PresentationXMLConvert .new(presxml_options) .convert("test", input, true)))) .to be_equivalent_to Xml::C14n.format(output) diff --git a/spec/metanorma/base_spec.rb b/spec/metanorma/base_spec.rb index f44dc48..232d913 100644 --- a/spec/metanorma/base_spec.rb +++ b/spec/metanorma/base_spec.rb @@ -3,9 +3,9 @@ OPTIONS = [backend: :iho, header_footer: true].freeze -RSpec.describe Metanorma::IHO do +RSpec.describe Metanorma::Iho do it "has a version number" do - expect(Metanorma::IHO::VERSION).not_to be nil + expect(Metanorma::Iho::VERSION).not_to be nil end it "processes a blank document" do @@ -81,7 +81,7 @@ output = Xml::C14n.format(<<~"OUTPUT") - + Main Title B-1000 @@ -131,6 +131,7 @@ standard + iho HSSC @@ -207,7 +208,7 @@ :title: Main Title INPUT output = <<~OUTPUT - + Main Title S-1000 @@ -248,6 +249,7 @@ standard + iho @@ -304,7 +306,7 @@ :edition-minor: 3 INPUT output <<~OUTPUT - + OUTPUT xml = Nokogiri::XML(Asciidoctor @@ -324,7 +326,7 @@ :edition-patch: 5 INPUT output <<~OUTPUT - + OUTPUT xml = Nokogiri::XML(Asciidoctor @@ -343,7 +345,7 @@ :edition-patch: 5 INPUT output <<~OUTPUT - + OUTPUT xml = Nokogiri::XML(Asciidoctor @@ -850,6 +852,7 @@ standard + iho OUTPUT diff --git a/spec/metanorma/processor_spec.rb b/spec/metanorma/processor_spec.rb index 1da4e03..d49d5a9 100644 --- a/spec/metanorma/processor_spec.rb +++ b/spec/metanorma/processor_spec.rb @@ -2,9 +2,9 @@ require "metanorma" require "fileutils" -RSpec.describe Metanorma::IHO::Processor do +RSpec.describe Metanorma::Iho::Processor do registry = Metanorma::Registry.instance - registry.register(Metanorma::IHO::Processor) + registry.register(Metanorma::Iho::Processor) let(:processor) do registry.find_processor(:iho) @@ -21,7 +21,7 @@ end it "registers version against metanorma" do - expect(processor.version.to_s).to match(%r{^Metanorma::IHO }) + expect(processor.version.to_s).to match(%r{^Metanorma::Iho }) end it "generates IsoDoc XML from a blank document" do diff --git a/spec/metanorma/rsd_spec.rb b/spec/metanorma/rsd_spec.rb index e631253..4e60850 100644 --- a/spec/metanorma/rsd_spec.rb +++ b/spec/metanorma/rsd_spec.rb @@ -1,24 +1,26 @@ -require 'spec_helper' +require "spec_helper" -RSpec.describe Metanorma::IHO do +RSpec.describe Metanorma::Iho do it "has a version number" do - expect(Metanorma::IHO::VERSION).not_to be nil + expect(Metanorma::Iho::VERSION).not_to be nil end - describe '#configuration' do - it 'has `configuration` attribute accessable' do - expect(Metanorma::IHO.configuration) - .to(be_instance_of(Metanorma::IHO::Configuration)) + describe "#configuration" do + it "has `configuration` attribute accessable" do + expect(Metanorma::Iho.configuration) + .to(be_instance_of(Metanorma::Iho::Configuration)) end - context 'default attributes' do - subject(:config) { Metanorma::IHO.configuration } - let(:default_organization_name_short) { 'IHO' } - let(:default_organization_name_long) { 'International Hydrographic Organization' } + context "default attributes" do + subject(:config) { Metanorma::Iho.configuration } + let(:default_organization_name_short) { "IHO" } + let(:default_organization_name_long) do + "International Hydrographic Organization" + end let(:default_document_namespace) do - 'https://www.metanorma.org/ns/iho' + "https://www.metanorma.org/ns/iho" end - it 'sets default atrributes' do + it "sets default atrributes" do expect(config.organization_name_short) .to(eq(default_organization_name_short)) expect(config.organization_name_long) @@ -28,14 +30,14 @@ end end - context 'attribute setters' do - subject(:config) { Metanorma::IHO.configuration } - let(:organization_name_short) { 'Test' } - let(:organization_name_long) { 'Test Corp.' } - let(:document_namespace) { 'https://example.com/' } + context "attribute setters" do + subject(:config) { Metanorma::Iho.configuration } + let(:organization_name_short) { "Test" } + let(:organization_name_long) { "Test Corp." } + let(:document_namespace) { "https://example.com/" } - it 'sets atrributes' do - Metanorma::IHO.configure do |config| + it "sets atrributes" do + Metanorma::Iho.configure do |config| config.organization_name_short = organization_name_short config.organization_name_long = organization_name_long config.document_namespace = document_namespace diff --git a/spec/metanorma/validate_spec.rb b/spec/metanorma/validate_spec.rb index 51be5a5..dd9d692 100644 --- a/spec/metanorma/validate_spec.rb +++ b/spec/metanorma/validate_spec.rb @@ -1,6 +1,6 @@ require "spec_helper" -RSpec.describe Metanorma::IHO do +RSpec.describe Metanorma::Iho do context "when xref_error.adoc compilation" do around do |example| FileUtils.rm_f "spec/assets/xref_error.err.html" @@ -18,7 +18,7 @@ Metanorma::Compile .new .compile("spec/assets/xref_error.adoc", type: "iho", - install_fonts: false) + install_fonts: false) end.to(change { File.exist?("spec/assets/xref_error.err.html") } .from(false).to(true)) end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 70fb36e..1d018f3 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -74,7 +74,7 @@ def presxml_options def boilerplate_read(file) HTMLEntities.new.decode( - Metanorma::IHO::Converter.new(:iho, {}).boilerplate_file_restructure(file) + Metanorma::Iho::Converter.new(:iho, {}).boilerplate_file_restructure(file) .to_xml.gsub(/<(\/)?sections>/, "<\\1boilerplate>") .gsub(/ id="_[^"]+"/, " id='_'"), ) @@ -95,7 +95,7 @@ def boilerplate_read(file) BLANK_HDR = <<~"HDR".freeze - + Document title @@ -130,6 +130,7 @@ def boilerplate_read(file) standard + iho @@ -168,6 +169,6 @@ def boilerplate_read(file) def mock_pdf allow(Mn2pdf).to receive(:convert) do |url, output, _c, _d| - FileUtils.cp(url.gsub(/"/, ""), output.gsub(/"/, "")) + FileUtils.cp(url.delete('"'), output.delete('"')) end end