Sha256: 33074c4ab22cd487690c46a586989453ee9df4de4f0a11fb948b1583acfa113e

Contents?: true

Size: 411 Bytes

Versions: 5

Compression:

Stored size: 411 Bytes

Contents

require 'nishisuke_blog_syntax/formatter'

module NishisukeBlogSyntax
  module Formatter
    class ListFormatter < FormatterBase
      SUBSTITUTE_REGEXP = /^- .*$/
      PARSE_REGEXP = /^- (.*)$/

      private

      def regexp
        SUBSTITUTE_REGEXP
      end

      def substitute(matched)
        content_str = matched.match(PARSE_REGEXP)[1]
        "<li>#{content_str}</li>"
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
nishisuke_blog_syntax-0.1.8 lib/nishisuke_blog_syntax/formatter/list_formatter.rb
nishisuke-blog-syntax-0.1.7 lib/nishisuke_blog_syntax/formatter/list_formatter.rb
nishisuke-blog-syntax-0.1.6 lib/nishisuke_blog_syntax/formatter/list_formatter.rb
nishisuke-blog-syntax-0.1.5 lib/nishisuke_blog_syntax/formatter/list_formatter.rb
nishisuke-blog-syntax-0.1.4 lib/nishisuke_blog_syntax/formatter/list_formatter.rb