Welcome to mirror list, hosted at ThFree Co, Russian Federation.

truncate_source_filter.rb « filter « banzai « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c903b83d8684aa61b2fc163ba7aae518d4ead08f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
# frozen_string_literal: true

module Banzai
  module Filter
    class TruncateSourceFilter < HTML::Pipeline::TextFilter
      def call
        return text unless context.key?(:limit)

        text.truncate_bytes(context[:limit])
      end
    end
  end
end