Sha256: aee845178ef60a6c6c88982d00bf47990f638339c1af2e4f9a2ce81fe2e0cf53

Contents?: true

Size: 1.09 KB

Versions: 8

Compression:

Stored size: 1.09 KB

Contents

module Enumerable
  def noblank
    reject do |n|
      n["id"].nil? || n["id"].empty?
    end
  end
end

module IsoDoc
  module XrefGen
    module Blocks
      def blank?(text)
        text.nil? || text.empty?
      end

      def noblank(xpath)
        xpath.reject { |n| blank?(n["id"]) }
      end

      SECTIONS_XPATH =
        "//foreword | //introduction | //acknowledgements | " \
        "//preface/abstract | " \
        "//preface/terms | //preface/definitions | //preface/references | " \
        "//preface/clause | //sections/terms | //annex | " \
        "//sections/clause | //sections/definitions | " \
        "//bibliography/references | //bibliography/clause".freeze

      def sections_xpath
        SECTIONS_XPATH
      end

      def child_asset_path(asset)
        "./*[not(self::xmlns:clause) and not(self::xmlns:appendix) and " \
        "not(self::xmlns:terms) and not(self::xmlns:definitions)]//xmlns:X | " \
        "./xmlns:X".gsub("X", asset)
      end

      CHILD_SECTIONS = "./clause | ./appendix | ./terms | ./definitions | " \
                 "./references".freeze
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
isodoc-2.12.0 lib/isodoc/xref/xref_util.rb
isodoc-2.11.4 lib/isodoc/xref/xref_util.rb
isodoc-2.11.3 lib/isodoc/xref/xref_util.rb
isodoc-2.11.2 lib/isodoc/xref/xref_util.rb
isodoc-2.11.1 lib/isodoc/xref/xref_util.rb
isodoc-2.11.0 lib/isodoc/xref/xref_util.rb
isodoc-2.10.7 lib/isodoc/xref/xref_util.rb
isodoc-2.10.6 lib/isodoc/xref/xref_util.rb