Class: ConTeXtSetup::Assignments

Inherits:
Param show all
Defined in:
lib/tex/context/contextsetup.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Param

#opt, #optional?, #sanitize_html

Methods inherited from SetupXML

parse_xml, tag_method

Constructor Details

#initialize(interface) ⇒ Assignments

parse_xml



372
373
374
375
376
377
# File 'lib/tex/context/contextsetup.rb', line 372

def initialize(interface)
  @interface=interface
  @optional=false
  @list=false
  @parameters=[]
end

Instance Attribute Details

#listObject

Returns the value of attribute list.



357
358
359
# File 'lib/tex/context/contextsetup.rb', line 357

def list
  @list
end

#optionalObject

Returns the value of attribute optional.



357
358
359
# File 'lib/tex/context/contextsetup.rb', line 357

def optional
  @optional
end

#parametersObject

Returns the value of attribute parameters.



357
358
359
# File 'lib/tex/context/contextsetup.rb', line 357

def parameters
  @parameters
end

Instance Method Details

#==(other) ⇒ Object



395
396
397
# File 'lib/tex/context/contextsetup.rb', line 395

def ==(other)
  Assignments===other && @optional == other.optional && @list=other.list && @parameters==other.parameters
end

#parse_xml(elt) ⇒ Object



358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File 'lib/tex/context/contextsetup.rb', line 358

def parse_xml(elt)
  @list     = elt.attributes["list"]     == "yes"
  @optional = elt.attributes["optional"] == "yes"
  elt.each_element do |parameter|
    case parameter.name
    when "inherit"
      @parameters << Inherit.parse_xml(parameter,@interface)
    when "parameter"
      @parameters << Parameter.parse_xml(parameter,@interface)
    else
      raise "not implemented yet: assignments/#{parameter.name}"
    end
  end
end

#to_html(detail = true, cls = "first") ⇒ Object



378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
# File 'lib/tex/context/contextsetup.rb', line 378

def to_html(detail=true,cls="first")
  head = show
  if detail
    tmp=@parameters.collect do |param|
      tr(:class => cls, :valign => "top") {
        case param
        when Parameter
          td { param.to_html(false) } + td {param.to_html(true)} 
        when Inherit
          td { head } + td { param.to_html }
        end
      } + "\n"
    end.to_s
  else
    head 
  end
end