Sha256: 03610bf7bdaa5db93e910beafccb132c97ea3daf8c263d62c85c906c556a4c98

Contents?: true

Size: 675 Bytes

Versions: 11

Compression:

Stored size: 675 Bytes

Contents

module RevealCK
  module Markdown
    # This class knows how to modify emoji so that underscores within
    # emoji are not considered as indicators of markdown emphasis.
    class PreProcessorForEmoji
      attr_reader :doc
      def initialize(doc)
        @doc = doc
      end

      def process
        protect_emojis
      end

      private

      def protect_emojis
        doc.gsub!(emoji_regex) do |emoji|
          emoji.gsub(/_/, emoji_underscore_symbol)
        end
      end

      def emoji_regex
        /:[a-z\d_\-\+]*:/
      end

      def emoji_underscore_symbol
        RevealCK::Markdown::REVEALCK_SYMBOL_FOR_EMOJI_UNDERSCORE
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
reveal-ck-4.0.0 lib/reveal-ck/markdown/pre_processor_for_emoji.rb
reveal-ck-3.9.2 lib/reveal-ck/markdown/pre_processor_for_emoji.rb
reveal-ck-3.9.1 lib/reveal-ck/markdown/pre_processor_for_emoji.rb
reveal-ck-3.9.0 lib/reveal-ck/markdown/pre_processor_for_emoji.rb
reveal-ck-3.8.1 lib/reveal-ck/markdown/pre_processor_for_emoji.rb
reveal-ck-3.8.0 lib/reveal-ck/markdown/pre_processor_for_emoji.rb
reveal-ck-3.7.0 lib/reveal-ck/markdown/pre_processor_for_emoji.rb
reveal-ck-3.6.0 lib/reveal-ck/markdown/pre_processor_for_emoji.rb
reveal-ck-3.5.1 lib/reveal-ck/markdown/pre_processor_for_emoji.rb
reveal-ck-3.5.0 lib/reveal-ck/markdown/pre_processor_for_emoji.rb
reveal-ck-3.4.0 lib/reveal-ck/markdown/pre_processor_for_emoji.rb