Class: FujiMarkdown::Preprocessors::EscapeNarou

Inherits:
Object
  • Object
show all
Defined in:
lib/fuji_markdown/preprocessors/escape_narou.rb

Instance Method Summary collapse

Instance Method Details

#call(text) ⇒ Object



6
7
8
9
10
# File 'lib/fuji_markdown/preprocessors/escape_narou.rb', line 6

def call(text)
  text.gsub(/([一-龠々])(([\p{Hiragana}\p{Katakana}]+))/, '\1|(\2)')
      .gsub(/([一-龠々])\(([\p{Hiragana}\p{Katakana}]+)\)/, '\1|(\2)')
      .gsub(/《([\p{Hiragana}\p{Katakana}]+)》/, '|《\1》')
end