Sha256: b578f81c003e825d236f78b9b38c5948dd93569072e381d14c89735eb8954043

Contents?: true

Size: 1.2 KB

Versions: 6

Compression:

Stored size: 1.2 KB

Contents

require_relative "init"
require "isodoc"

module IsoDoc
  module UN
    class PresentationXMLConvert < IsoDoc::PresentationXMLConvert
      def initialize(options)
        super
        @toc = options[:toc]
      end

      def note1(f)
        return if f.parent.name == "bibitem"
        n = @xrefs.get[f["id"]]
        lbl = case f["type"]
              when "source" then "Source"
              when "abbreviation" then "Abbreviations"
              else
                @i18n.note
              end
        prefix_name(f, "", lbl, "name")
      end

      def conversions(docxml)
        super
        admonition docxml
      end

      def admonition(docxml)
        docxml.xpath(ns("//admonition")).each do |f|
          admonition1(f)
        end
      end

      def admonition1(f)
        n = @xrefs.anchor(f['id'], :label) or return
        lbl = l10n("#{@i18n.admonition} #{n}")
        prefix_name(f, "&nbsp;&mdash; ", lbl, "name")
      end

      def annex1(f)
        lbl = @xrefs.anchor(f['id'], :label)
        if t = f.at(ns("./title"))
          t.children = "<strong>#{t.children.to_xml}</strong>"
        end
        prefix_name(f, "<br/>", lbl, "title")
      end

      include Init
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
metanorma-un-0.5.4 lib/isodoc/un/presentation_xml_convert.rb
metanorma-un-0.5.3 lib/isodoc/un/presentation_xml_convert.rb
metanorma-un-0.5.2 lib/isodoc/un/presentation_xml_convert.rb
metanorma-un-0.5.1 lib/isodoc/un/presentation_xml_convert.rb
metanorma-cli-1.3.4 gems/ruby/2.6.0/gems/metanorma-un-0.5.0/lib/isodoc/un/presentation_xml_convert.rb
metanorma-un-0.5.0 lib/isodoc/un/presentation_xml_convert.rb