Sha256: ffd4c10268be8efd8813bc8d2e0736740962f3c01e8153e571e6297fadb5d2fd

Contents?: true

Size: 1.16 KB

Versions: 20

Compression:

Stored size: 1.16 KB

Contents

# frozen_string_literal: true

class Kramdown::Parser::SmartyPants < Kramdown::Parser::Kramdown
  def initialize(source, options)
    super
    @block_parsers = [:block_html, :content]
    @span_parsers =  [:smart_quotes, :html_entity, :typographic_syms, :span_html]
  end

  def parse_content
    add_text @src.scan(%r!\A.*\n!)
  end
  define_parser(:content, %r!\A!)
end

module Jekyll
  module Converters
    class SmartyPants < Converter
      safe true
      priority :low

      def initialize(config)
        unless defined?(Kramdown)
          Jekyll::External.require_with_graceful_fail "kramdown"
        end
        @config = config["kramdown"].dup || {}
        @config[:input] = :SmartyPants
      end

      def matches(_)
        false
      end

      def output_ext(_)
        nil
      end

      def convert(content)
        document = Kramdown::Document.new(content, @config)
        html_output = document.to_html.chomp
        if @config["show_warnings"]
          document.warnings.each do |warning|
            Jekyll.logger.warn "Kramdown warning:", warning.sub(%r!^Warning:\s+!, "")
          end
        end
        html_output
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
jekyll-3.10.0 lib/jekyll/converters/smartypants.rb
jekyll-3.9.5 lib/jekyll/converters/smartypants.rb
jekyll-3.9.4 lib/jekyll/converters/smartypants.rb
jekyll-3.9.3 lib/jekyll/converters/smartypants.rb
jekyll-3.9.2 lib/jekyll/converters/smartypants.rb
jekyll-3.9.1 lib/jekyll/converters/smartypants.rb
jekyll-3.9.0 lib/jekyll/converters/smartypants.rb
jekyll-3.8.7 lib/jekyll/converters/smartypants.rb
jekyll-3.8.6 lib/jekyll/converters/smartypants.rb
jekyll-3.8.5 lib/jekyll/converters/smartypants.rb
jekyll-3.8.4 lib/jekyll/converters/smartypants.rb
jekyll-3.7.4 lib/jekyll/converters/smartypants.rb
jekyll-3.8.3 lib/jekyll/converters/smartypants.rb
jekyll-3.8.2 lib/jekyll/converters/smartypants.rb
jekyll-3.8.1 lib/jekyll/converters/smartypants.rb
jekyll-3.8.0 lib/jekyll/converters/smartypants.rb
jekyll-3.8.0.pre.rc2 lib/jekyll/converters/smartypants.rb
jekyll-3.8.0.pre.rc1 lib/jekyll/converters/smartypants.rb
jekyll-3.7.3 lib/jekyll/converters/smartypants.rb
jekyll-3.7.2 lib/jekyll/converters/smartypants.rb