File: parser.rb

package info (click to toggle)
hiki 0.8.6-1etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 1,772 kB
  • ctags: 1,746
  • sloc: ruby: 20,067; lisp: 926; sh: 269; makefile: 10
file content (30 lines) | stat: -rw-r--r-- 638 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# $Id: parser.rb,v 1.22 2005/12/28 22:42:55 fdiary Exp $
# Copyright (C) 2002-2003 TAKEUCHI Hitoshi <hitoshi@namaraii.com>

require 'style/default/hikidoc'

module Hiki
  class Parser_default

    class << self
      def heading( str, level = 1 )
        '!' * level + str
      end

      def link( link_str, str = nil )
        str ? "[[#{str}|#{link_str}]]" : "[[#{link_str}]]"
      end

      def blockquote( str )
        str.split(/\n/).collect{|s| %Q|""#{s}\n|}.join
      end
    end
    
    def initialize( conf )
    end

    def parse( s, top_level = 2 )
      HikiDoc.new( s, :level => top_level ).to_html
    end
  end
end