Sha256: a3400689befa152d0358a9668b46e3fe92471e7bbb7fb4ff5ca38c0f85d54bce
Contents?: true
Size: 1.84 KB
Versions: 2
Compression:
Stored size: 1.84 KB
Contents
require "htmlentities" require "uri" require "mime/types" require "base64" module Asciidoctor module Standoc module Blocks def requirement_subpart(node) name = node.role || node.attr("style") noko do |xml| xml.send name, **attr_code(exclude: node.option?("exclude"), type: node.attr("type")) do |o| o << node.content end end end def req_classif_parse(classif) ret = [] classif.split(/;\s*/).each do |c| c1 = c.split(/:\s*/) next unless c1.size == 2 c1[1].split(/,\s*/).each { |v| ret << [ c1[0], v ] } end ret end def requirement_classification(classif, ex) req_classif_parse(classif).each do |r| ex.classification do |c| c.tag r[0] c.value r[1] end end end def reqt_attributes(node) { id: Utils::anchor_or_uuid, unnumbered: node.option?("unnumbered") ? "true" : nil, subsequence: node.attr("subsequence"), obligation: node.attr("obligation"), filename: node.attr("filename"), type: node.attr("type"), model: node.attr("model"), } end def requirement(node, obligation) classif = node.attr("classification") noko do |xml| xml.send obligation, **attr_code(reqt_attributes(node)) do |ex| ex.title node.title if node.title ex.label node.attr("label") if node.attr("label") ex.subject node.attr("subject") if node.attr("subject") ex.inherit node.attr("inherit") if node.attr("inherit") requirement_classification(classif, ex) if classif wrap_in_para(node, ex) end end.join("\n") end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
metanorma-standoc-1.3.13 | lib/asciidoctor/standoc/reqt.rb |
metanorma-standoc-1.3.12 | lib/asciidoctor/standoc/reqt.rb |