Module: Jekyll::HyphenateFilter

Defined in:
lib/jekyll/hyphenate_filter.rb,
lib/jekyll/hyphenate_filter/version.rb,
lib/jekyll/hyphenate_filter/hyphenator.rb

Defined Under Namespace

Classes: Hyphenator

Constant Summary collapse

VERSION =
"0.0.2"

Instance Method Summary collapse

Instance Method Details

#hyphenate(content) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/jekyll/hyphenate_filter.rb', line 5

def hyphenate(content)
  config = @context.registers[:site].config['hyphenate_filter'] || {}
  config = {'language' => 'en_us',
            'left' => 2,
            'right' => 2,
            'hyphen' => Hyphenator::SOFT_HYPHEN_CHAR,
            'selector' => 'p'}.merge!(config)
  hyphenator = Hyphenator.new(language: config['language'],
                              left: config['left'],
                              right: config['right'],
                              hyphen: config['hyphen'],
                              selector: config['selector'])
  hyphenator.hyphenate(content)
end