Sha256: 4cc590707357797dd4eb71f78e9700bad4a5352daa4969cfdceefabb718d691e

Contents?: true

Size: 1.42 KB

Versions: 12

Compression:

Stored size: 1.42 KB

Contents

require "htmlentities"
require "uri"

module Asciidoctor
  module ISO
    class Converter < Standoc::Converter
      def clause_parse(attrs, xml, node)
        title = node&.attr("heading")&.downcase ||
          node.title.gsub(/<[^>]+>/, "").downcase
        title == "scope" and return scope_parse(attrs, xml, node)
        node.option? "appendix" and return appendix_parse(attrs, xml, node)
        super
      end

      def appendix_parse(attrs, xml, node)
        attrs["inline-header".to_sym] = node.option? "inline-header"
        set_obligation(attrs, node)
        xml.appendix **attr_code(attrs) do |xml_section|
          xml_section.title { |name| name << node.title }
          xml_section << node.content
        end
      end

      def patent_notice_parse(xml, node)
        # xml.patent_notice do |xml_section|
        #  xml_section << node.content
        # end
        xml << node.content
      end

      def scope_parse(attrs, xml, node)
        xml.clause **attr_code(attrs) do |xml_section|
          xml_section.title { |t| t << "Scope" }
          content = node.content
          xml_section << content
        end
      end

      def section_attributes(node)
        super.merge(
          change: @amd ? node.attr("change") : nil,
          locality: @amd ? node.attr("locality") : nil,
        )
      end

      def sectiontype(node, level = true)
        return nil if @amd
        super
      end
    end
  end
end

Version data entries

12 entries across 10 versions & 2 rubygems

Version Path
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/metanorma-iso-1.4.2/lib/asciidoctor/iso/section.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/metanorma-iso-1.4.3/lib/asciidoctor/iso/section.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/metanorma-iso-1.4.3/lib/asciidoctor/iso/section.rb
metanorma-cli-1.3.3.1 gems/ruby/2.6.0/gems/metanorma-iso-1.4.2/lib/asciidoctor/iso/section.rb
metanorma-iso-1.4.3 lib/asciidoctor/iso/section.rb
metanorma-iso-1.4.3.pre.alpha lib/asciidoctor/iso/section.rb
metanorma-iso-1.4.2 lib/asciidoctor/iso/section.rb
metanorma-iso-1.4.1 lib/asciidoctor/iso/section.rb
metanorma-iso-1.4.0 lib/asciidoctor/iso/section.rb
metanorma-iso-1.3.27 lib/asciidoctor/iso/section.rb
metanorma-iso-1.3.26 lib/asciidoctor/iso/section.rb
metanorma-iso-1.3.25 lib/asciidoctor/iso/section.rb