Class: Docgenerator::Creole::Placeholders::Creole_comment

Inherits:
Docgenerator::Creole::Placeholder show all
Defined in:
lib/docgenerator/creole/placeholder.rb

Overview

Usage:

<<<comment
This text is a comment.
>>>

Instance Method Summary collapse

Methods inherited from Docgenerator::Creole::Placeholder

#<<, #close, #initialize, set_placeholder_key

Constructor Details

This class inherits a constructor from Docgenerator::Creole::Placeholder

Instance Method Details

#to_contextObject



154
# File 'lib/docgenerator/creole/placeholder.rb', line 154

alias :to_context :to_latex

#to_creole(options = {}) ⇒ Object



158
159
160
# File 'lib/docgenerator/creole/placeholder.rb', line 158

def to_creole(options = {})
  return "<<<comment\n#{@source.join}>>>"
end

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

Return content as a comment



141
142
143
144
145
146
147
148
149
150
# File 'lib/docgenerator/creole/placeholder.rb', line 141

def to_doc( target, options = {})
  case target
    when :html; to_html( options )
    when :latex; to_latex( options )
    when :context; to_latex( options )
    when :creole; to_creole( options )
    else
      @log.error("Creole_comment not supported for target #{target.inspect}") if @log.error?
  end
end

#to_html(options = {}) ⇒ Object



151
152
153
# File 'lib/docgenerator/creole/placeholder.rb', line 151

def to_html(options = {})
  return "<!-- #{@source.join} -->"
end

#to_latex(options = {}) ⇒ Object



155
156
157
# File 'lib/docgenerator/creole/placeholder.rb', line 155

def to_latex(options = {})
  return @source.map{|l| "%#{l}" }.join
end