bridgetownrb / bridgetown

A next-generation progressive site generator & fullstack framework, powered by Ruby
https://www.bridgetownrb.com
MIT License
1.16k stars 112 forks source link

Refactor SmartyPants #401

Closed jaredcwhite closed 2 years ago

jaredcwhite commented 3 years ago

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.

armahillo commented 3 years ago

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")