Class: PPZ::PModel

Inherits:
AbstractModel show all
Defined in:
lib/doc/model/p/index.rb

Constant Summary collapse

UpperClass =
PPZ::AbstractSectionModel

Instance Attribute Summary

Attributes inherited from AbstractModel

#father_model, #index, #left_model, #right_model

Instance Method Summary collapse

Methods inherited from AbstractModel

from_line, #transform_inline_element

Constructor Details

#initialize(text) ⇒ PModel

Returns a new instance of PModel.



4
5
6
7
8
9
10
11
12
# File 'lib/doc/model/p/index.rb', line 4

def initialize text
  # 转义行首的加号
  pre = text[0..2]
  text = text[1..-1] if (pre == '\\+ ' or pre == '\\> ')
  # 转义 html
  text = transform_inline_element text

  @text = text
end

Instance Method Details

#to_htmlObject



14
15
16
# File 'lib/doc/model/p/index.rb', line 14

def to_html
  "<p>#{@text}</p>"
end