Class: Docgenerator::Creole::Placeholder

Inherits:
Object
  • Object
show all
Defined in:
lib/docgenerator/creole/placeholder.rb

Overview

Placeholder are defined in Creole-Syntax via <<< >>>

Placeholders get a name and optional parameters:

<<<name|parameter

Placeholders collect the content between <<< and >>>.

Derived classes are:

  • Creole::Placeholders::Dummy

  • Creole::Placeholders::Html

  • Creole::Placeholders::Latex

  • Creole::Creole_tabular

  • Creole::Creole_tab

Defined Under Namespace

Classes: ParameterError

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wiki, parameters = nil) ⇒ Placeholder

Each placeholder get the wiki where it belongs to.

Parameters is an optional string.

Definition inside the wiki:

<<<name|parameters
content
>>>

Placeholders collect the content between <<< and >>>.



47
48
49
50
51
# File 'lib/docgenerator/creole/placeholder.rb', line 47

def initialize( wiki, parameters = nil)
  @wiki = wiki
  @parameters = parameters
  @log  = @wiki.log
end

Class Method Details

.set_placeholder_key(key) ⇒ Object

Define class as a placeholder. You may use the class as:

{{key}}


29
30
31
# File 'lib/docgenerator/creole/placeholder.rb', line 29

def set_placeholder_key(key)
  Placeholders::Collection[key] = self
end

Instance Method Details

#<<(content) ⇒ Object

Add the content between <<< and >>>.



54
55
56
57
# File 'lib/docgenerator/creole/placeholder.rb', line 54

def << (content)
  @source = [] unless @source
  @source << content
end

#closeObject

Possibility to analyse the content.



60
61
62
# File 'lib/docgenerator/creole/placeholder.rb', line 60

def close()
  @source.freeze
end

#to_doc(target, options = {}) ⇒ Object

Export it. Should be redefined by sub classes.



64
65
66
# File 'lib/docgenerator/creole/placeholder.rb', line 64

def to_doc( target, options = {})
  @source.to_doc( target, options )
end