Class: Jekyll::Converters::SmartyPants
- Inherits:
-
Jekyll::Converter
- Object
- Plugin
- Jekyll::Converter
- Jekyll::Converters::SmartyPants
- Defined in:
- lib/jekyll/converters/smartypants.rb
Overview
SmartyPants converter. For more info on converters see jekyllrb.com/docs/plugins/converters/
Constant Summary
Constants inherited from Plugin
Instance Method Summary collapse
-
#convert(content) ⇒ Object
Logic to do the content conversion.
-
#initialize(config) ⇒ SmartyPants
constructor
A new instance of SmartyPants.
-
#matches(_ext) ⇒ Object
Does the given extension match this converter’s list of acceptable extensions? Takes one argument: the file’s extension (including the dot).
-
#output_ext(_ext) ⇒ Object
Public: The extension to be given to the output file (including the dot).
Methods inherited from Jekyll::Converter
highlighter_prefix, #highlighter_prefix, highlighter_suffix, #highlighter_suffix
Methods inherited from Plugin
#<=>, <=>, catch_inheritance, descendants, inherited, priority, safe
Constructor Details
#initialize(config) ⇒ SmartyPants
Returns a new instance of SmartyPants.
28 29 30 31 32 |
# File 'lib/jekyll/converters/smartypants.rb', line 28 def initialize(config) Jekyll::External.require_with_graceful_fail "kramdown" unless defined?(Kramdown) @config = config["kramdown"].dup || {} @config[:input] = :SmartyPants end |
Instance Method Details
#convert(content) ⇒ Object
Logic to do the content conversion.
content - String content of file (without front matter).
Returns a String of the converted content.
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/jekyll/converters/smartypants.rb', line 58 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 |
#matches(_ext) ⇒ Object
Does the given extension match this converter’s list of acceptable extensions? Takes one argument: the file’s extension (including the dot).
ext - The String extension to check.
Returns true if it matches, false otherwise.
40 41 42 |
# File 'lib/jekyll/converters/smartypants.rb', line 40 def matches(_ext) false end |
#output_ext(_ext) ⇒ Object
Public: The extension to be given to the output file (including the dot).
ext - The String extension or original file.
Returns The String output file extension.
49 50 51 |
# File 'lib/jekyll/converters/smartypants.rb', line 49 def output_ext(_ext) nil end |