Skip to content

Commit

Permalink
Consistent Module naming: metanorma/metanorma#367
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis committed Oct 9, 2024
1 parent fb0d443 commit f1f088c
Show file tree
Hide file tree
Showing 41 changed files with 173 additions and 302 deletions.
2 changes: 1 addition & 1 deletion Gemfile.devel
Original file line number Diff line number Diff line change
@@ -1 +1 @@
gem "metanorma-standoc", git: "https://github.com/metanorma/metanorma-standoc", branch: "main"
gem "metanorma-standoc", git: "https://github.com/metanorma/metanorma-standoc", branch: "feature/ext-flavor"
2 changes: 1 addition & 1 deletion lib/metanorma/iso/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
require_relative "processor"

module Metanorma
module ISO
module Iso
class Converter < Standoc::Converter
XML_ROOT_TAG = "iso-standard".freeze
XML_NAMESPACE = "https://www.metanorma.org/ns/iso".freeze
Expand Down
13 changes: 13 additions & 0 deletions lib/metanorma/iso/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/iso/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
2 changes: 1 addition & 1 deletion lib/metanorma/iso/cleanup.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative "cleanup_biblio"

module Metanorma
module ISO
module Iso
class Converter < Standoc::Converter
PRE_NORMREF_FOOTNOTES = "//preface//fn | " \
"//clause[@type = 'scope']//fn".freeze
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/iso/cleanup_biblio.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Metanorma
module ISO
module Iso
class Converter < Standoc::Converter
def id_prefix(prefix, id)
# we're just inheriting the prefixes from parent doc
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/iso/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
require "metanorma/iso/cleanup"

module Metanorma
module ISO
module Iso
# A {Converter} implementation that generates ISO output, and a document
# schema encapsulation of the document for validation
class Converter < ::Metanorma::Standoc::Converter
Expand Down
4 changes: 2 additions & 2 deletions lib/metanorma/iso/front.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
require_relative "front_contributor"

module Metanorma
module ISO
module Iso
class Converter < Standoc::Converter
def metadata_ext(node, xml)
super
Expand Down Expand Up @@ -47,7 +47,7 @@ def metadata_stagename(id)
end
end

def metadata_subdoctype(node, xml)
def metadata_flavor(node, xml)
super
a = node.attr("horizontal") and xml.horizontal a
end
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/iso/front_contributor.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Metanorma
module ISO
module Iso
class Converter < Standoc::Converter
# def home_agency
# "ISO"
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/iso/front_id.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require "pubid-iec"

module Metanorma
module ISO
module Iso
class Converter < Standoc::Converter
def metadata_id(node, xml)
if id = node.attr("docidentifier")
Expand Down
8 changes: 3 additions & 5 deletions lib/metanorma/iso/processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
module Metanorma
module Iso
class Processor < Metanorma::Processor

def initialize # rubocop:disable Lint/MissingSuper
@short = :iso
@input_format = :asciidoc
Expand All @@ -22,7 +21,7 @@ def output_formats
end

def version
"Metanorma::ISO #{Metanorma::ISO::VERSION}"
"Metanorma::Iso #{Metanorma::Iso::VERSION}"
end

def fonts_manifest
Expand All @@ -38,12 +37,12 @@ def fonts_manifest
end

def use_presentation_xml(ext)
return true if [:html_alt, :sts, :isosts].include?(ext)
return true if %i[html_alt sts isosts].include?(ext)

super
end

def output(isodoc_node, inname, outname, format, options={})
def output(isodoc_node, inname, outname, format, options = {})
options_preprocess(options)
case format
when :html
Expand Down Expand Up @@ -71,7 +70,6 @@ def output(isodoc_node, inname, outname, format, options={})
super
end
end

end
end
end
1 change: 1 addition & 0 deletions lib/metanorma/iso/relaton-iso.rng
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<optional>
<ref name="docsubtype"/>
</optional>
<ref name="flavor"/>
<optional>
<ref name="horizontal"/>
</optional>
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/iso/section.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require "uri" if /^2\./.match?(RUBY_VERSION)

module Metanorma
module ISO
module Iso
class Converter < Standoc::Converter
def clause_parse(attrs, xml, node)
node.option? "appendix" and return appendix_parse(attrs, xml, node)
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/iso/validate.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
require "iev"

module Metanorma
module ISO
module Iso
class Converter < Standoc::Converter
def isosubgroup_validate(root)
root.xpath("//technical-committee/@type").each do |t|
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/iso/validate_image.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Metanorma
module ISO
module Iso
class Converter < Standoc::Converter
# DRG directives 3.7; but anticipated by standoc
def subfigure_validate(xmldoc)
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/iso/validate_list.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Metanorma
module ISO
module Iso
class Converter < Standoc::Converter
# https://www.iso.org/ISO-house-style.html#iso-hs-s-text-r-p-lists
def listcount_validate(doc)
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/iso/validate_requirements.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "metanorma-standoc"

module Metanorma
module ISO
module Iso
class Converter < Standoc::Converter
REQUIREMENT_RE_STR = <<~REGEXP.freeze
\\b
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/iso/validate_section.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "nokogiri"

module Metanorma
module ISO
module Iso
class Converter < Standoc::Converter
def section_validate(doc)
unless %w(amendment technical-corrigendum).include? @doctype
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/iso/validate_style.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "tokenizer"

module Metanorma
module ISO
module Iso
class Converter < Standoc::Converter
def extract_text(node)
node.nil? and return ""
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/iso/validate_title.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "metanorma-standoc"

module Metanorma
module ISO
module Iso
class Converter < Standoc::Converter
def title_lang_part(doc, part, lang)
doc.at("//bibdata/title[@type='title-#{part}' and @language='#{lang}']")
Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma/iso/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Metanorma
module ISO
module Iso
VERSION = "2.8.7".freeze
end
end
4 changes: 2 additions & 2 deletions metanorma-iso.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require "metanorma/iso/version"

Gem::Specification.new do |spec|
spec.name = "metanorma-iso"
spec.version = Metanorma::ISO::VERSION
spec.version = Metanorma::Iso::VERSION
spec.authors = ["Ribose Inc."]
spec.email = ["[email protected]"]

Expand All @@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
f.match(%r{^(test|spec|features|bin|.github)/}) \
|| f.match(%r{Rakefile|bin/rspec})
end
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
spec.test_files = `git ls-files -- {spec}/*`.split("\n")
spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")

spec.add_dependency "metanorma-standoc", "~> 2.9.3"
Expand Down
3 changes: 2 additions & 1 deletion spec/isodoc/section_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@
</iso-standard>
INPUT
presxml = <<~OUTPUT
<iso-standard xmlns='https://www.metanorma.org/ns/iso' type='presentation' version="#{Metanorma::ISO::VERSION}">
<iso-standard xmlns='https://www.metanorma.org/ns/iso' type='presentation' version="#{Metanorma::Iso::VERSION}">
<bibdata type='standard'>
<contributor>
<role type='author'/>
Expand Down Expand Up @@ -644,6 +644,7 @@
<ext>
<doctype>standard</doctype>
<subdoctype>vocabulary</subdoctype>
<flavor>iso</flavor>
<editorialgroup identifier='ISO'>
<agency>ISO</agency>
</editorialgroup>
Expand Down
Loading

0 comments on commit f1f088c

Please sign in to comment.