Sha256: 71e72bfd68ae3a18bf46273ab568e2a695edccbfe6167610502d233656a1e05f

Contents?: true

Size: 829 Bytes

Versions: 13

Compression:

Stored size: 829 Bytes

Contents

module Liquid
  module CustomFilters
    module Filters
      def values(list)
        list.values
      end

      def terminological_data(term)
        result = []

        result << "&lt;#{term['usage_info']}&gt;" if term["usage_info"]
        result << extract_grammar_info(term)
        result << term["geographical_area"]&.upcase

        result.unshift(",") if result.compact.size.positive?

        result.compact.join(" ")
      end

      def extract_grammar_info(term)
        return unless term["grammar_info"]

        grammar_info = []

        term["grammar_info"].each do |info|
          grammar_info << info["gender"]&.join(", ")
          grammar_info << info["number"]&.join(", ")
          grammar_info << extract_parts_of_speech(info)
        end

        grammar_info.join(" ")
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
metanorma-plugin-glossarist-0.2.3 lib/liquid/custom_filters/filters.rb
metanorma-plugin-glossarist-0.2.2 lib/liquid/custom_filters/filters.rb
metanorma-plugin-glossarist-0.2.1 lib/liquid/custom_filters/filters.rb
metanorma-plugin-glossarist-0.2.0 lib/liquid/custom_filters/filters.rb
metanorma-plugin-glossarist-0.1.8 lib/liquid/custom_filters/filters.rb
metanorma-plugin-glossarist-0.1.7 lib/liquid/custom_filters/filters.rb
metanorma-plugin-glossarist-0.1.6 lib/liquid/custom_filters/filters.rb
metanorma-plugin-glossarist-0.1.5 lib/liquid/custom_filters/filters.rb
metanorma-plugin-glossarist-0.1.4 lib/liquid/custom_filters/filters.rb
metanorma-plugin-glossarist-0.1.3 lib/liquid/custom_filters/filters.rb
metanorma-plugin-glossarist-0.1.2 lib/liquid/custom_filters/filters.rb
metanorma-plugin-glossarist-0.1.1 lib/liquid/custom_filters/filters.rb
metanorma-plugin-glossarist-0.1.0 lib/liquid/custom_filters/filters.rb