class Adocsite::Content

Attributes

name[R]
title[R]

Public Class Methods

new(adoc) click to toggle source
# 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
title_to_name(title) click to toggle source
# 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

Public Instance Methods

content() click to toggle source
# File lib/adocsite/content_types.rb, line 21
def content()
  @content = @content.gsub(/sitenav:['"](.*)['"](\[(.*)\])?/) {|sitenav| stringreturn("#$1","#$3")}
end

Private Instance Methods

stringreturn(title, link_text) click to toggle source
# File lib/adocsite/content_types.rb, line 16
def stringreturn(title, link_text)
  link_text = link_text.empty? ? title : link_text
  '<a href="'+Content::title_to_name(title)+'.html">'+link_text+'</a>'
end