require "isodoc" require_relative "./gbcleanup.rb" require_relative "./metadata.rb" require "fileutils" module IsoDoc module Gb # A {Converter} implementation that generates GB output, and a document # schema encapsulation of the document for validation class Common < IsoDoc::Common attr_accessor :meta def initialize(options) @meta = options[:meta] @standardlogoimg = options[:standardlogoimg]&.sub(%r{^(?=/|[A-Z]:/)}, "#{@localdir}/") @standardclassimg = options[:standardclassimg]&.sub(%r{^(?=/|[A-Z]:/)}, "#{@localdir}/") @standardissuerimg = options[:standardissuerimg]&.sub(%r{^(?=/|[A-Z]:/)}, "#{@localdir}/") end def fileloc(loc) File.expand_path(File.join(File.dirname(__FILE__), loc)) end def format_agency(agency, format, localdir) return "" if @standardissuerimg return agency unless agency.is_a?(Array) if agency == ["中华人民共和国国家质量监督检验检疫总局", "中国国家标准化管理委员会"] logo = "gb-issuer-default.gif" #FileUtils.cp fileloc(File.join('html/gb-logos', logo)), logo return "" end format_agency1(agency, format) end def format_agency1(agency, format) ret = "
#{a} |