Class: Adocsite::Content
- Inherits:
-
Object
- Object
- Adocsite::Content
- Defined in:
- lib/adocsite/content_types.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(adoc) ⇒ Content
constructor
A new instance of Content.
Constructor Details
#initialize(adoc) ⇒ Content
Returns a new instance of Content.
4 5 6 7 8 |
# File 'lib/adocsite/content_types.rb', line 4 def initialize(adoc) @name = Content::title_to_name(adoc.doctitle) @title = adoc.doctitle @content = adoc.content end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/adocsite/content_types.rb', line 3 def name @name end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/adocsite/content_types.rb', line 3 def title @title end |
Class Method Details
.title_to_name(title) ⇒ Object
10 11 12 13 14 |
# File 'lib/adocsite/content_types.rb', line 10 def self.title_to_name(title) title = title.strip title = title.gsub(/[^0-9A-Za-z.\-]/, '_') title = title.gsub(/[_]+/, '_') end |
Instance Method Details
#content ⇒ Object
21 22 23 |
# File 'lib/adocsite/content_types.rb', line 21 def content() @content = @content.gsub(/sitenav:['"](.*)['"](\[(.*)\])?/) {|sitenav| stringreturn("#$1","#$3")} end |