Module: HParser::Hatena

Overview

This module provide to_hatena method. This method is intended to convert hatena format node to hatena format.

For example:

Hatena::Parser.parse('*foo').to_html # -> *foo
Hatena::Parser.parse('>|bar|<').to_html # -> >|bar|<

Please see also HParser::Text

Instance Method Summary collapse

Instance Method Details

#to_hatenaObject



15
16
17
18
19
20
21
22
23
24
# File 'lib/hparser/hatena.rb', line 15

def to_hatena
  content = hatena_content
  if content.class == Array then
    content = content.map{|x| x.to_hatena}.join
  end
  if self.respond_to? :hatena_filter,true
    content = hatena_filter content
  end
  content+"\n"
end