Class: ConTeXtSetup::Sequence
- Defined in:
- lib/tex/context/contextsetup.rb
Overview
The visible name of a command.
Instance Attribute Summary collapse
-
#sequence ⇒ Object
sequence is an Array of Arrays.
Instance Method Summary collapse
-
#cmd_name ⇒ Object
Return the name of the command, without backslash and without start if it is an environment.
-
#cmd_name_html ⇒ Object
Return the name as html, without backslash and without start if it is an environment.
-
#has_variable? ⇒ Boolean
Return true if the command name has a variable part in it, such as placecombinedlist.
-
#initialize(interface) ⇒ Sequence
constructor
A new instance of Sequence.
-
#parse_xml(sequence) ⇒ Object
:nodoc:.
-
#to_html ⇒ Object
Return html representation of the sequence, not including a backslash or the start-prefix for environments.
Methods inherited from SetupXML
Constructor Details
#initialize(interface) ⇒ Sequence
Returns a new instance of Sequence.
267 268 269 270 |
# File 'lib/tex/context/contextsetup.rb', line 267 def initialize(interface) @interface=interface @sequence=[] end |
Instance Attribute Details
#sequence ⇒ Object
sequence is an Array of Arrays. Example: [[:string, “place”],[:variable, “combinedlist”].
266 267 268 |
# File 'lib/tex/context/contextsetup.rb', line 266 def sequence @sequence end |
Instance Method Details
#cmd_name ⇒ Object
Return the name of the command, without backslash and without start if it is an environment
304 305 306 307 308 |
# File 'lib/tex/context/contextsetup.rb', line 304 def cmd_name @sequence.collect do |type,name| name end.to_s end |
#cmd_name_html ⇒ Object
Return the name as html, without backslash and without start if it is an environment
310 311 312 313 314 315 316 317 318 319 320 321 |
# File 'lib/tex/context/contextsetup.rb', line 310 def cmd_name_html @sequence.collect do |type,name| case type when :string name when :variable "<i>#{name}</i>" else raise "internal error" end end.to_s end |
#has_variable? ⇒ Boolean
Return true if the command name has a variable part in it, such as placecombinedlist.
298 299 300 301 302 |
# File 'lib/tex/context/contextsetup.rb', line 298 def has_variable? @sequence.any? do |type,name| type==:variable end end |
#parse_xml(sequence) ⇒ Object
:nodoc:
271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/tex/context/contextsetup.rb', line 271 def parse_xml(sequence) # :nodoc: sequence.each_element do |elt| case elt.name when "string" @sequence << [:string, elt.attributes["value"]] when "variable" @sequence << [:variable, elt.attributes["value"]] else raise "internal error" end end # Return html representation of the sequence, not including a # backslash or the start-prefix for environments. end |
#to_html ⇒ Object
Return html representation of the sequence, not including a backslash or the start-prefix for environments.
285 286 287 288 289 290 291 292 293 294 295 |
# File 'lib/tex/context/contextsetup.rb', line 285 def to_html tmp=@sequence.collect do |type,name| case type when :string name when :variable "<i>#{name}</i>" end end tmp.to_s end |