Class: ConTeXtSetup::Param

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

Overview

An interface for all the parameters (Position, TeX, Csname, Word, …)

Instance Method Summary collapse

Methods inherited from SetupXML

parse_xml, #parse_xml, tag_method

Constructor Details

#initialize(interface) ⇒ Param

Returns a new instance of Param.



325
326
327
# File 'lib/tex/context/contextsetup.rb', line 325

def initialize(interface)
  @interface=interface
end

Instance Method Details

#opt(what) ⇒ Object



328
329
330
# File 'lib/tex/context/contextsetup.rb', line 328

def opt(what)
  optional? ? span(:class => "optional") { what } :  what
end

#optional?Boolean

Returns:

  • (Boolean)


334
335
336
337
338
339
340
# File 'lib/tex/context/contextsetup.rb', line 334

def optional?
  if  self.respond_to?(:optional) 
    self.optional
  else
    false
  end
end

#sanitize_html(text) ⇒ Object



331
332
333
# File 'lib/tex/context/contextsetup.rb', line 331

def sanitize_html(text)
  text.gsub(/cd:([a-zA-Z]+)/,'<i>\1</i>')
end

#showObject

Raises:

  • (ScriptError)


341
342
343
# File 'lib/tex/context/contextsetup.rb', line 341

def show
  raise ScriptError, "must be subclassed"
end

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



344
345
346
347
348
349
350
351
352
353
# File 'lib/tex/context/contextsetup.rb', line 344

def to_html(detail=true,cls="first")
  head=show
  if detail
    tr { 
      td(:class => cls) { head } + td(:class => cls)
    }
  else
    head
  end
end