Sha256: f83f251f3b9ac505a6198d2e48e176d4e9c1c7f1ed1c9752f8848c647d11d08b

Contents?: true

Size: 803 Bytes

Versions: 1

Compression:

Stored size: 803 Bytes

Contents

require "isodoc"

module Asciidoctor
  module Gb
    # A {Converter} implementation that generates GB output, and a document
    # schema encapsulation of the document for validation
    class GbConvert < IsoDoc::Convert
      def format_ref(ref, isopub)
        return "ISO #{ref}" if isopub
        return "[#{ref}]" if /^\d+$/.match?(ref) && !/^\[.*\]$/.match?(ref)
        ref
      end

      def reference_names(ref)
        isopub = ref.at(ns(ISO_PUBLISHER_XPATH))
        docid = ref.at(ns("./docidentifier"))
        return ref_names(ref) unless docid
        date = ref.at(ns("./date[@type = 'published']"))
        reference = format_ref(docid.text, isopub)
        reference += ": #{date.text}" if date && isopub
        @anchors[ref["id"]] = { xref: reference }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
asciidoctor-gb-0.1.5 lib/asciidoctor/gb/xref_gen.rb