Sha256: 779a68c93701b2b629780ea4e6439be262b6a0b5724438048c34f6cf9d858fd0
Contents?: true
Size: 1.79 KB
Versions: 12
Compression:
Stored size: 1.79 KB
Contents
module Asciidoctor module ITU class Converter < Standoc::Converter def bibdata_validate(doc) doctype_validate(doc) stage_validate(doc) end def doctype_validate(xmldoc) doctype = xmldoc&.at("//bibdata/ext/doctype")&.text %w(recommendation recommendation-supplement recommendation-amendment recommendation-corrigendum recommendation-errata recommendation-annex focus-group implementers-guide technical-paper technical-report joint-itu-iso-iec).include? doctype or warn "Document Attributes: #{doctype} is not a recognised document type" end def stage_validate(xmldoc) stage = xmldoc&.at("//bibdata/status/stage")&.text %w(in-force superseded in-force-prepublished withdrawn).include? stage or warn "Document Attributes: #{stage} is not a recognised status" end def content_validate(doc) super approval_validate(doc) itu_identifier_validate(doc) bibdata_validate(doc.root) end def approval_validate(xmldoc) s = xmldoc.at("//bibdata/ext/recommendationstatus/approvalstage") || return process = s["process"] if process == "aap" and %w(determined in-force).include? s.text warn "Recommendation Status #{s.text} inconsistent with AAP" end if process == "tap" and !%w(determined in-force).include? s.text warn "Recommendation Status #{s.text} inconsistent with TAP" end end def itu_identifier_validate(xmldoc) s = xmldoc.xpath("//bibdata/docidentifier[@type = 'ITU']").each do |x| /^ITU-[RTF] [AD-VX-Z]\.[0-9]+$/.match(x.text) or warn("#{x.text} does not match ITU document identifier conventions") end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems