Class: Regenerate::HtmlVariable

Inherits:
TextVariable show all
Defined in:
lib/regenerate/web-page.rb

Overview

HtmlVariable Can be both source and result

Instance Attribute Summary

Attributes inherited from TextVariable

#varName

Attributes inherited from PageComponent

#parentPage, #text

Instance Method Summary collapse

Methods inherited from TextVariable

#addToParentPage, #initializeFromStartComment, #textVariableValue

Methods inherited from PageComponent

#addLine, #addToParentPage, #finishText, #finished, #initialize, #initializeFromStartComment, #processStartComment

Constructor Details

This class inherits a constructor from Regenerate::PageComponent

Instance Method Details

#output(showSource = true) ⇒ Object



137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/regenerate/web-page.rb', line 137

def output(showSource = true)
  if showSource
    textValue = textVariableValue
    if textValue == nil || textValue == ""
      "<!-- [#{@varName}] -->\n"
    else
      "<!-- [#{@varName} -->\n#{textValue}\n<!-- #{@varName}] -->\n"
    end
  else
    text
  end
end

#processEndComment(parsedCommentLine) ⇒ Object



130
131
132
133
134
135
# File 'lib/regenerate/web-page.rb', line 130

def processEndComment(parsedCommentLine)
  super(parsedCommentLine)
  if !parsedCommentLine.hasCommentStart
    raise ParseException.new("End comment for HTML variable does not have a comment start")
  end
end