Skip to content

Commit

Permalink
Merge pull request #425 from metanorma/feature/ext-flavor
Browse files Browse the repository at this point in the history
  • Loading branch information
opoudjis authored Oct 11, 2024
2 parents 539e5b8 + 61a5bd1 commit b970163
Show file tree
Hide file tree
Showing 70 changed files with 1,209 additions and 1,183 deletions.
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"
2 changes: 1 addition & 1 deletion lib/html2doc/ieee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
require "html2doc/ieee/lists"

class Html2Doc
class IEEE
class Ieee
end
end
2 changes: 1 addition & 1 deletion lib/html2doc/ieee/lists.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Html2Doc
class IEEE < ::Html2Doc
class Ieee < ::Html2Doc
def style_list(elem, level, liststyle, listnumber)
return unless liststyle

Expand Down
2 changes: 1 addition & 1 deletion lib/html2doc/ieee/notes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Html2Doc
class IEEE < ::Html2Doc
class Ieee < ::Html2Doc
def process_footnote_texts(docxml, footnotes)
body = docxml.at("//body")
list = body.add_child("<div style='mso-element:footnote-list'/>")
Expand Down
2 changes: 1 addition & 1 deletion lib/html2doc/ieee_wp.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "html2doc/ieee_wp/lists"

class Html2Doc
class IEEE_WP
class Ieee_Wp
end
end
2 changes: 1 addition & 1 deletion lib/html2doc/ieee_wp/lists.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Html2Doc
class IEEE_WP < ::Html2Doc
class Ieee_Wp < ::Html2Doc
def list2para(list)
list.name == "ol" and return super
return if list.xpath("./li").empty?
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/ieee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
require "isodoc/ieee/ieee_xml_convert"

module IsoDoc
module IEEE
module Ieee
end
end
2 changes: 1 addition & 1 deletion lib/isodoc/ieee/base_convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require "fileutils"

module IsoDoc
module IEEE
module Ieee
module BaseConvert
def clause_attrs(node)
{ id: node["id"], type: node["type"] }
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/ieee/html_convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require_relative "init"

module IsoDoc
module IEEE
module Ieee
class HtmlConvert < IsoDoc::HtmlConvert
def initialize(options)
@libdir = File.dirname(__FILE__)
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/ieee/i18n.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module IsoDoc
module IEEE
module Ieee
class I18n < IsoDoc::I18n
def load_file(fname)
f = File.join(File.dirname(__FILE__), fname)
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/ieee/ieee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
require "isodoc/ieee/presentation_xml_convert"

module IsoDoc
module IEEE
module Ieee
end
end
4 changes: 2 additions & 2 deletions lib/isodoc/ieee/ieee_xml_convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
require "mnconvert"

module IsoDoc
module IEEE
class IEEEXMLConvert < IsoDoc::XslfoPdfConvert
module Ieee
class IeeeXMLConvert < IsoDoc::XslfoPdfConvert
def initialize(options) # rubocop:disable Lint/MissingSuper
@libdir = File.dirname(__FILE__)
@format = :ieee
Expand Down
4 changes: 2 additions & 2 deletions lib/isodoc/ieee/init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
require_relative "i18n"

module IsoDoc
module IEEE
module Ieee
module Init
def metadata_init(lang, script, locale, i18n)
@meta = Metadata.new(lang, script, locale, i18n)
Expand All @@ -22,7 +22,7 @@ def i18n_init(lang, script, locale, i18nyaml = nil)
end

def bibrenderer
::Relaton::Render::IEEE::General.new(language: @lang,
::Relaton::Render::Ieee::General.new(language: @lang,
i18nhash: @i18n.get)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/ieee/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require "twitter_cldr"

module IsoDoc
module IEEE
module Ieee
class Metadata < IsoDoc::Metadata
def initialize(lang, script, i18n, fonts_options = {})
super
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/ieee/pdf_convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require "fileutils"

module IsoDoc
module IEEE
module Ieee
# A {Converter} implementation that generates PDF HTML output, and a
# document schema encapsulation of the document for validation
class PdfConvert < IsoDoc::XslfoPdfConvert
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/ieee/presentation_bibdata.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module IsoDoc
module IEEE
module Ieee
class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
def bibdata_i18n(bib)
super
Expand Down
15 changes: 7 additions & 8 deletions lib/isodoc/ieee/presentation_ref.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative "../../relaton/render/general"

module IsoDoc
module IEEE
module Ieee
class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
# Style manual 19
def anchor_linkend(node, linkend)
Expand Down Expand Up @@ -76,14 +76,13 @@ def author_date?(xml)
end

def creatornames(bibitem)
::Relaton::Render::IEEE::General
::Relaton::Render::Ieee::General
.new(language: @lang, i18nhash: @i18n.get,
#template: { (bibitem["type"] || "misc").to_sym =>
#"{{ creatornames }}" },
template: "{{ creatornames }}" ,
extenttemplate: { (bibitem["type"] || "misc").to_sym => "{{page}}"} ,
sizetemplate: { (bibitem["type"] || "misc").to_sym => "{{data}}"} ,
)
# template: { (bibitem["type"] || "misc").to_sym =>
# "{{ creatornames }}" },
template: "{{ creatornames }}",
extenttemplate: { (bibitem["type"] || "misc").to_sym => "{{page}}" },
sizetemplate: { (bibitem["type"] || "misc").to_sym => "{{data}}" })
.render1(RelatonBib::XMLParser.from_xml(bibitem.to_xml))
end

Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/ieee/presentation_terms.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module IsoDoc
module IEEE
module Ieee
class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
def multidef(elem)
number_multidef(elem)
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/ieee/presentation_xml_convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require "isodoc"

module IsoDoc
module IEEE
module Ieee
class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
def initialize(options)
@hierarchical_assets = options[:hierarchicalassets]
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/ieee/word_authority.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module IsoDoc
module IEEE
module Ieee
class WordConvert < IsoDoc::WordConvert
def authority_cleanup(docxml)
feedback_footnote(docxml)
Expand Down
4 changes: 2 additions & 2 deletions lib/isodoc/ieee/word_cleanup.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module IsoDoc
module IEEE
module Ieee
class WordConvert < IsoDoc::WordConvert
def toWord(result, filename, dir, header)
::Html2Doc::IEEE.new(
::Html2Doc::Ieee.new(
filename: filename,
imagedir: @localdir,
stylesheet: @wordstylesheet&.path,
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/ieee/word_cleanup_blocks.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module IsoDoc
module IEEE
module Ieee
class WordConvert < IsoDoc::WordConvert
# STYLE
def admonition_cleanup(docxml)
Expand Down
4 changes: 2 additions & 2 deletions lib/isodoc/ieee/word_convert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
require_relative "word_wp_convert"

module IsoDoc
module IEEE
module Ieee
class WordConvert < IsoDoc::WordConvert
def initialize(options)
@libdir = File.dirname(__FILE__)
Expand All @@ -15,7 +15,7 @@ def initialize(options)
end

def init_wp(options)
@wp = ::IsoDoc::IEEE::WordWPConvert.new(options)
@wp = ::IsoDoc::Ieee::WordWPConvert.new(options)
end

def convert1(docxml, filename, dir)
Expand Down
4 changes: 2 additions & 2 deletions lib/isodoc/ieee/word_wp_cleanup.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module IsoDoc
module IEEE
module Ieee
class WordWPConvert < WordConvert
def stylesmap
{
Expand Down Expand Up @@ -75,7 +75,7 @@ def headings_style_body(hdr, idx)
end

def toWord(result, filename, dir, header)
::Html2Doc::IEEE_WP.new(
::Html2Doc::Ieee_Wp.new(
filename: filename,
imagedir: @localdir,
stylesheet: @wordstylesheet&.path,
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/ieee/word_wp_convert.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require_relative "word_wp_cleanup"

module IsoDoc
module IEEE
module Ieee
class WordWPConvert < WordConvert
def initialize(options)
@libdir ||= File.dirname(__FILE__) # rubocop:disable Lint/DisjunctiveAssignmentInConstructor
Expand Down
2 changes: 1 addition & 1 deletion lib/isodoc/ieee/xref.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "isodoc"

module IsoDoc
module IEEE
module Ieee
class Counter < ::IsoDoc::XrefGen::Counter
end

Expand Down
2 changes: 1 addition & 1 deletion lib/metanorma-ieee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@
require "metanorma"

if defined? Metanorma::Registry
Metanorma::Registry.instance.register(Metanorma::IEEE::Processor)
Metanorma::Registry.instance.register(Metanorma::Ieee::Processor)
end
2 changes: 1 addition & 1 deletion lib/metanorma/ieee.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require "metanorma/ieee/converter"

module Metanorma
module IEEE
module Ieee
ORGANIZATION_NAME_SHORT = "IEEE"
ORGANIZATION_NAME_LONG = "Institute of Electrical and Electronics Engineers"
end
Expand Down
13 changes: 13 additions & 0 deletions lib/metanorma/ieee/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/ieee/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
4 changes: 2 additions & 2 deletions lib/metanorma/ieee/cleanup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
require_relative "term_lookup_cleanup"

module Metanorma
module IEEE
module Ieee
class Converter < Standoc::Converter
def initial_boilerplate(xml, isodoc)
intro_boilerplate(xml, isodoc)
Expand Down Expand Up @@ -130,7 +130,7 @@ def termdef_boilerplate_insert(xmldoc, isodoc, once = false)
def term_defs_boilerplate_cont(src, term, isodoc); end

def termlookup_cleanup(xmldoc)
Metanorma::IEEE::TermLookupCleanup.new(xmldoc, @log).call
Metanorma::Ieee::TermLookupCleanup.new(xmldoc, @log).call
end

def boilerplate_isodoc(xmldoc)
Expand Down
4 changes: 2 additions & 2 deletions lib/metanorma/ieee/cleanup_ref.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Metanorma
module IEEE
module Ieee
class Converter < Standoc::Converter
BIBLIO =
"//bibliography/references[@normative = 'false'][not(@hidden)] | " \
Expand All @@ -20,7 +20,7 @@ def biblio_preface(ref)
end

def sort_biblio(bib)
@i = IsoDoc::IEEE::PresentationXMLConvert
@i = IsoDoc::Ieee::PresentationXMLConvert
.new({ lang: @lang, script: @script, locale: @locale })
@i.i18n_init(@lang, @script, @locale)
sort_keys = bib.each_with_object({}) do |b, m|
Expand Down
Loading

0 comments on commit b970163

Please sign in to comment.