bridgetown icon indicating copy to clipboard operation
bridgetown copied to clipboard

Refactor SmartyPants

Open jaredcwhite opened this issue 2 years ago • 1 comments

There's currently a converter for "SmartyPants" (aka swap in smart quotes in text), but as far as I can tell it's not a real converter — aka it doesn't actually process any files automatically ever and only gets used when the smartify filter is invoked. So it doesn't actually make any sense for this to be a converter. There a small cost in performance for every converter in the system (since every template loops through all installed converters to see if there's a match), so this is definitely a worthwhile refactor.

jaredcwhite avatar Sep 30 '21 19:09 jaredcwhite

SmartyPants https://github.com/bridgetownrb/bridgetown/blob/main/bridgetown-core/lib/bridgetown-core/converters/smartypants.rb

Referenced:

$ rg SmartyPants
bridgetown-website/src/_docs/commands/plugins.md
32:                    Bridgetown::Converters::SmartyPants

bridgetown-core/lib/bridgetown-core/converters/smartypants.rb
5:    class SmartyPants < Kramdown::Parser::Kramdown
22:    # SmartyPants converter.
24:    class SmartyPants < Converter
33:        @config[:input] = :SmartyPants

bridgetown-core/lib/bridgetown-core/filters.rb
30:        Bridgetown::Converters::SmartyPants

bridgetown-core/test/test_filters.rb
75:          "SmartyPants is *not* Markdown",
76:          @filter.smartify("SmartyPants is *not* Markdown")

armahillo avatar Oct 29 '21 20:10 armahillo