Class: RDocSupport::RDocMarkup

Inherits:
SM::SimpleMarkup
  • Object
show all
Defined in:
lib/rdocsupport.rb

Overview

A simple rdoc markup class which recognizes some additional formatting commands suitable for Wiki use.

Instance Method Summary collapse

Constructor Details

#initializeRDocMarkup

Returns a new instance of RDocMarkup.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rdocsupport.rb', line 15

def initialize
  super()

  pre = '(?:\\s|^|\\\\)'

  # links of the form
  # [[<url> description with spaces]]
  add_special(/((\\)?\[\[\S+?\s+.+?\]\])/,:TIDYLINK)

  # and external references
  add_special(/((\\)?(link:|anchor:|http:|mailto:|ftp:|img:|www\.)\S+\w\/?)/,
              :HYPERLINK)

  # <br/>
  add_special(%r{(#{pre}<br/>)}, :BR)

  # and <center> ... </center>
  add_html("center", :CENTER)
end

Instance Method Details

#convert(text, handler) ⇒ Object



35
36
37
# File 'lib/rdocsupport.rb', line 35

def convert(text, handler)
  super.sub(/^<p>\n/, '').sub(/<\/p>$/, '')
end