contextsetup 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README +4 -0
  2. data/Rakefile +40 -0
  3. data/lib/tex/context/contextsetup.rb +728 -0
  4. metadata +51 -0
data/README ADDED
@@ -0,0 +1,4 @@
1
+ = Readme file for contextsetup library
2
+
3
+ License: BSD
4
+
@@ -0,0 +1,40 @@
1
+ require 'rubygems'
2
+ require 'rake/gempackagetask'
3
+ require 'rake/rdoctask'
4
+
5
+
6
+ PKG_VERSION="0.1"
7
+ PKG_FILES=["lib/tex/context/contextsetup.rb","README","Rakefile"]
8
+
9
+
10
+
11
+ spec = Gem::Specification.new do |s|
12
+ s.platform = Gem::Platform::RUBY
13
+ s.summary = "Library for accessing ConTeXt setup files (cont-??.xml)"
14
+ s.name = 'contextsetup'
15
+ s.version = PKG_VERSION
16
+ s.requirements << 'none'
17
+ s.require_path = 'lib'
18
+ s.has_rdoc = true
19
+ s.rdoc_options << "--main" << "README" << "--title" << "ConTeXt Setup"
20
+ s.extra_rdoc_files = ["README"]
21
+ s.files = PKG_FILES
22
+ s.description = <<EOF
23
+ ConTeXt setup library is a helper library to use the cont-??.xml files
24
+ for ConTeXt.
25
+ EOF
26
+ end
27
+
28
+
29
+ Rake::RDocTask.new do |rd|
30
+ rd.rdoc_files.include(PKG_FILES)
31
+ rd.title="ConTeXt setup"
32
+ rd.options << "-A"
33
+ rd.options << "documented_as_accessor=RW,documented_as_reader=R"
34
+ end
35
+
36
+
37
+ Rake::GemPackageTask.new(spec) do |pkg|
38
+ pkg.need_zip = true
39
+ pkg.need_tar = true
40
+ end
@@ -0,0 +1,728 @@
1
+ #!/usr/bin/env ruby
2
+ # == ConTeXtSetup Library
3
+ # Example usage:
4
+ #
5
+ # src='<cd:command name="completecombinedlist" generated="yes">
6
+ # <cd:sequence>
7
+ # <cd:string value="complete"/>
8
+ # <cd:variable value="combinedlist"/>
9
+ # </cd:sequence>
10
+ # <cd:arguments>
11
+ # <cd:keywords>
12
+ # <cd:constant type="cd:name"/>
13
+ # </cd:keywords>
14
+ # <cd:assignments list="yes">
15
+ # <cd:inherit name="setupcombinedlist"/>
16
+ # </cd:assignments>
17
+ # </cd:arguments>
18
+ # </cd:command>'
19
+ #
20
+ # root = REXML::Document.new(src).root
21
+ # i = Setup::Interface.parse_xml(root)
22
+ # i.commands # => Hash {"completecombinedlist" => [#<Command::...>] }
23
+ # cmd = i.commands["completecombinedlist"][0] # variant no 0
24
+ # cmd.to_html # <table ...> ... </table>
25
+ # # You can also compare two commands (which compares all its arguments)
26
+ # cmd_a == cmd_b # true/false
27
+ # == Other
28
+ # Documentation: http://contextsetup.rubyforge.org
29
+ # Project page: http://rubyforge.org/projects/contextsetup/
30
+
31
+ require 'rexml/document'
32
+
33
+
34
+ # See ConTeXtSetup::Interface for documentation.
35
+ module ConTeXtSetup
36
+ # The parse_xml interface for the helper classes.
37
+ class SetupXML
38
+ class << self
39
+ def parse_xml(elt,interface)
40
+ t=new(interface)
41
+ t.parse_xml(elt)
42
+ return t
43
+ end
44
+ def tag_method(*names)
45
+ names.each do |sym|
46
+ class_eval %{
47
+ def #{sym}(options={},&block)
48
+ tmp=""
49
+ options.each do |key,value|
50
+ tmp << " " + key.to_s + "='" + value.to_s + "'"
51
+ end
52
+ "<#{sym}" + tmp.to_s + ">" + (block ? block.call.to_s : "") + "</#{sym}>"
53
+ end
54
+ }
55
+ end
56
+ end
57
+ end
58
+
59
+ tag_method :td, :table, :tr, :span, :strong
60
+ def initialize
61
+ end
62
+
63
+ def parse_xml(elt)
64
+ end
65
+
66
+ end
67
+
68
+ # Main class for parsing the cont-??.xml file. Just feed the root
69
+ # element (cd:interface) or a command element (cd:document) into the
70
+ # class method parse_xml. These elements must be of type
71
+ # REXML::Element.
72
+ #
73
+ class Interface < SetupXML
74
+ class << self
75
+ def parse_xml(elt)
76
+ t=new
77
+ t.parse_xml(elt)
78
+ return t
79
+ end
80
+ end
81
+ # The language of the interface as a String. Default is "en"
82
+ attr_accessor :language
83
+ # The version number of the interface definition. Only set if is
84
+ # read from xml
85
+ attr_accessor :version
86
+ # Hash of the commands. The key is the name of the command +
87
+ # start if it is an environment. The value is an array of the
88
+ # variants of the command.
89
+ attr_accessor :commands
90
+ # The resolve parts
91
+ attr_accessor :defines
92
+ def parse_xml(elt) # :nodoc:
93
+ case elt.name
94
+ when "interface"
95
+ # one or more <command ...>
96
+ @language = elt.attributes["language"]
97
+ @version = elt.attributes["version"]
98
+ elt.each_element do |cmd_or_define|
99
+ case cmd_or_define.name
100
+ when "command"
101
+ add_command(cmd_or_define)
102
+ when "define"
103
+ d=Define.parse_xml(cmd_or_define,self)
104
+ @defines[d.name]=d
105
+ else
106
+ raise "not implemented: interface/#{cmd_or_define.name}"
107
+ end
108
+ end
109
+ when "command"
110
+ add_command(elt)
111
+ else
112
+ raise ArgumentError, "The top element for parse_xml should be 'interface' or 'command', but is '#{elt.name}'"
113
+ end
114
+ end
115
+
116
+ # Dummy parameter is only for a nicer piece of code in another place
117
+ def initialize(dummy=nil)
118
+ @language="en"
119
+ @version=nil
120
+ @commands={}
121
+ @defines={}
122
+ end
123
+
124
+ def ==(other)
125
+ Interface===other && @commands == other.commands
126
+ end
127
+
128
+ private
129
+
130
+ def add_command(cmd_elt)
131
+ c=Command.parse_xml(cmd_elt,self)
132
+ ary=@commands[c.cmd_name(false)] ||= []
133
+ ary[c.variant - 1]=c
134
+ end
135
+ end
136
+
137
+ class Define < SetupXML
138
+ attr_accessor :name, :keywords
139
+ def parse_xml(elt)
140
+ @name=elt.attributes["name"]
141
+ elt.each_element do |constant|
142
+ @keywords << constant.attributes["type"]
143
+ end
144
+ end
145
+ def initialize(interface)
146
+ @interface=interface
147
+ @name=nil
148
+ @keywords = []
149
+ end
150
+ end
151
+ # Represents a single command with a sequence (the name of the command) and an argument list.
152
+ class Command < SetupXML
153
+ attr_accessor :sequence, :arguments,:environment, :generated, :name, :file, :variant
154
+
155
+ def parse_xml(elt)
156
+ @name = elt.attributes["name"]
157
+ @file = elt.attributes["file"]
158
+ @variant = (elt.attributes["variant"] && elt.attributes["variant"].to_i ) || 1
159
+ @environment = elt.attributes["type"] == "environment"
160
+ @generated = elt.attributes["generated"] == "yes"
161
+
162
+ @sequence = Sequence.parse_xml(elt.elements[1],@interface)
163
+ arguments=elt.elements[2]
164
+
165
+ # if this is a macro without arguments, we can return now and not parse any arguments
166
+ return unless arguments
167
+
168
+ disp_table = {
169
+ "keywords" => ConTeXtSetup::Keywords,
170
+ "triplet" => ConTeXtSetup::Triplet,
171
+ "assignments" => ConTeXtSetup::Assignments,
172
+ "content" => ConTeXtSetup::Content,
173
+ "reference" => ConTeXtSetup::Reference,
174
+ "word" => ConTeXtSetup::Word,
175
+ "nothing" => ConTeXtSetup::Nothing,
176
+ "file" => ConTeXtSetup::File,
177
+ "csname" => ConTeXtSetup::Csname,
178
+ "index" => ConTeXtSetup::Index,
179
+ "position" => ConTeXtSetup::Position,
180
+ "displaymath" => ConTeXtSetup::Displaymath,
181
+ "tex" => ConTeXtSetup::TeX,
182
+ }
183
+ arguments.each_element do |arg|
184
+ if disp_table.has_key?(arg.name)
185
+ @arguments << disp_table[arg.name].send(:parse_xml,arg,@interface)
186
+ else
187
+ raise "unknown argument: #{arg.name}"
188
+ end
189
+ end
190
+ end
191
+
192
+ def initialize(interface)
193
+ @interface=interface
194
+ @name=nil
195
+ @file=nil
196
+ @variant=1
197
+ @environment=false
198
+ @generated=false
199
+ @sequence=nil
200
+ @arguments=[]
201
+ @inteface=interface
202
+ @enum=%w( first second third )
203
+ super()
204
+ end
205
+ # Return the number of arguments the command takes. If with_optional is false,
206
+ # return only the number of mandatory arguments.
207
+ def no_of_arguments(with_optional=true)
208
+ tmp=@arguments.reject do |arg|
209
+ unless arg.optional?
210
+ true unless with_optional
211
+ else
212
+ false
213
+ end
214
+ end
215
+ tmp.size
216
+ end
217
+ # Return the name of the command, translated in the current
218
+ # interface's language. Included is the start prefix if the
219
+ # command is an environment and the backslash if
220
+ # <em>with_backslash</em> is set to true (the default).
221
+ def cmd_name(with_backslash=true)
222
+ backslash= with_backslash ? "\\" : ""
223
+ tmp=environment ? "#{backslash}start" : backslash
224
+ tmp << @sequence.cmd_name
225
+ return tmp
226
+ end
227
+ # Return the name of the command, translated in the current
228
+ # interface's language. Included is the start prefix if the
229
+ # command is an environment and the backslash if
230
+ # <em>with_backslash</em> is set to true (the default).
231
+ def cmd_name_html(with_backslash=true)
232
+ tmp=environment ? "\\start" : "\\"
233
+ tmp << @sequence.cmd_name_html
234
+ return tmp
235
+ end
236
+ # Return true if the command name has a variable part in it, such as \placecombinedlist.
237
+ def has_variable?
238
+ @sequence.has_variable?
239
+ end
240
+ def to_html
241
+ first_line = []
242
+ details = []
243
+ @arguments.each_with_index do |arg,i|
244
+ cls=@enum[ i % @enum.size]
245
+ opt_or_not_opt = arg.optional? ? span(:class => "optional") { arg.to_html(false) } : arg.to_html(false)
246
+ first_line << span(:class => cls) { opt_or_not_opt }
247
+ details << arg.to_html(true, cls)
248
+ end
249
+
250
+ table(:class => "cmd", :cellspacing => "4", :cellpadding => "2") {
251
+ tr {
252
+ td(:colspan => "2", "class" => "cmd") { cmd_name_html(true) + first_line.to_s }
253
+ } +
254
+ details.to_s
255
+ }
256
+ end
257
+ def ==(other)
258
+ return false unless Command===other
259
+ @sequence == other.sequence && @environment==other.environment &&
260
+ @arguments == other.arguments && @generated==other.generated
261
+ end
262
+ end
263
+ # The visible name of a command.
264
+ class Sequence < SetupXML
265
+ # _sequence_ is an Array of Arrays. Example: [[:string, "place"],[:variable, "combinedlist"].
266
+ attr_accessor :sequence
267
+ def initialize(interface)
268
+ @interface=interface
269
+ @sequence=[]
270
+ end
271
+ def parse_xml(sequence) # :nodoc:
272
+ sequence.each_element do |elt|
273
+ case elt.name
274
+ when "string"
275
+ @sequence << [:string, elt.attributes["value"]]
276
+ when "variable"
277
+ @sequence << [:variable, elt.attributes["value"]]
278
+ else
279
+ raise "internal error"
280
+ end
281
+ end
282
+ # Return html representation of the sequence, not including a
283
+ # backslash or the start-prefix for environments.
284
+ end
285
+ def to_html
286
+ tmp=@sequence.collect do |type,name|
287
+ case type
288
+ when :string
289
+ name
290
+ when :variable
291
+ "<i>#{name}</i>"
292
+ end
293
+ end
294
+ tmp.to_s
295
+ end
296
+
297
+ # Return true if the command name has a variable part in it, such as \placecombinedlist.
298
+ def has_variable?
299
+ @sequence.any? do |type,name|
300
+ type==:variable
301
+ end
302
+ end
303
+ # Return the name of the command, without backslash and without start if it is an environment
304
+ def cmd_name
305
+ @sequence.collect do |type,name|
306
+ name
307
+ end.to_s
308
+ end
309
+ # Return the name as html, without backslash and without start if it is an environment
310
+ def cmd_name_html
311
+ @sequence.collect do |type,name|
312
+ case type
313
+ when :string
314
+ name
315
+ when :variable
316
+ "<i>#{name}</i>"
317
+ else
318
+ raise "internal error"
319
+ end
320
+ end.to_s
321
+ end
322
+ end
323
+ # An interface for all the parameters (Position, TeX, Csname, Word, ...)
324
+ class Param < SetupXML
325
+ def initialize(interface)
326
+ @interface=interface
327
+ end
328
+ def opt(what)
329
+ optional? ? span(:class => "optional") { what } : what
330
+ end
331
+ def sanitize_html(text)
332
+ text.gsub(/cd:([a-zA-Z]+)/,'<i>\1</i>')
333
+ end
334
+ def optional?
335
+ if self.respond_to?(:optional)
336
+ self.optional
337
+ else
338
+ false
339
+ end
340
+ end
341
+ def show
342
+ raise ScriptError, "must be subclassed"
343
+ end
344
+ def to_html(detail=true,cls="first")
345
+ head=show
346
+ if detail
347
+ tr {
348
+ td(:class => cls) { head } + td(:class => cls)
349
+ }
350
+ else
351
+ head
352
+ end
353
+ end
354
+ end
355
+
356
+ class Assignments < Param
357
+ attr_accessor :list,:parameters, :optional
358
+ def parse_xml(elt)
359
+ @list = elt.attributes["list"] == "yes"
360
+ @optional = elt.attributes["optional"] == "yes"
361
+ elt.each_element do |parameter|
362
+ case parameter.name
363
+ when "inherit"
364
+ @parameters << Inherit.parse_xml(parameter,@interface)
365
+ when "parameter"
366
+ @parameters << Parameter.parse_xml(parameter,@interface)
367
+ else
368
+ raise "not implemented yet: assignments/#{parameter.name}"
369
+ end
370
+ end
371
+ end # parse_xml
372
+ def initialize(interface)
373
+ @interface=interface
374
+ @optional=false
375
+ @list=false
376
+ @parameters=[]
377
+ end
378
+ def to_html(detail=true,cls="first")
379
+ head = show
380
+ if detail
381
+ tmp=@parameters.collect do |param|
382
+ tr(:class => cls, :valign => "top") {
383
+ case param
384
+ when Parameter
385
+ td { param.to_html(false) } + td {param.to_html(true)}
386
+ when Inherit
387
+ td { head } + td { param.to_html }
388
+ end
389
+ } + "\n"
390
+ end.to_s
391
+ else
392
+ head
393
+ end
394
+ end
395
+ def ==(other)
396
+ Assignments===other && @optional == other.optional && @list=other.list && @parameters==other.parameters
397
+ end
398
+ private
399
+
400
+ def show
401
+ @list ? "[...,...=...,...]" : "[...=...]"
402
+ end
403
+ end
404
+ class Nothing < Param
405
+ attr_accessor :separator
406
+ def parse_xml(elt)
407
+ if elt.attributes["separator"]=="backslash"
408
+ @separator = "\\\\"
409
+ end
410
+ end
411
+ def initialize(interface)
412
+ @interface=interface
413
+ @separator=nil
414
+ end
415
+ def to_html(detail=true,cls='first')
416
+ if detail
417
+ tr(:class => cls, :valign => "top" ) {
418
+ td { "..." } + td { "<i>text</i>" }
419
+ }
420
+ else
421
+ "#{@separator}..."
422
+ end
423
+ end
424
+ def ==(other)
425
+ Nothing===other && other.separator==@separator
426
+ end
427
+ end
428
+ class File < Param
429
+ def to_html(detail=true,cls="first")
430
+ if detail
431
+ tr(:class => cls, :valign => "top") { td(:class => 'cmd') { "..." } + td { "<i>file</i>" } }
432
+ else
433
+ "..."
434
+ end
435
+ end
436
+ end
437
+ class TeX < Param
438
+ # If set, usually set to \\ (backslash)
439
+ attr_accessor :separator
440
+ # The command that all this is about (without any backslashes)
441
+ attr_accessor :command
442
+ def parse_xml(elt)
443
+ if elt.attributes["separator"]
444
+ @separator = "\\\\"
445
+ end
446
+ @command = elt.attributes["command"]
447
+ end
448
+ def initialize(interface)
449
+ @interface=interface
450
+ @separator=nil
451
+ @command=nil
452
+ end
453
+ def to_html(detail=true,cls='first')
454
+ if detail
455
+ ""
456
+ else
457
+ "#{@separator}\\#{@command}"
458
+ end
459
+ end
460
+ def ==(other)
461
+ ConTeXtSetup::TeX===other && @separator==other.separator && @command == other.command
462
+ end
463
+ end
464
+ class Displaymath < Param
465
+ def to_html(detail=true,cls="first")
466
+ head=show
467
+ if detail
468
+ tr {
469
+ td(:class => cls) { head } + td(:class => cls) { "<i>formula</i>" }
470
+ }
471
+ else
472
+ head
473
+ end
474
+ end
475
+ def ==(other)
476
+ ConTeXtSetup::Displaymath===other
477
+ end
478
+ private
479
+ def show
480
+ "$$...$$"
481
+ end
482
+
483
+ end
484
+ class Position < Param
485
+ attr_accessor :list
486
+ def parse_xml(elt)
487
+ @list = elt.attributes["list"] == "yes"
488
+ end
489
+ def initialize(interface)
490
+ @interface=interface
491
+ @list=false
492
+ end
493
+ def to_html(detail=true,cls="first")
494
+ head=show
495
+ if detail
496
+ tr {
497
+ td(:class => cls) { head } + td(:class => cls) { "<i>number</i>, <i>number</i>"}
498
+ }
499
+ else
500
+ head
501
+ end
502
+ end
503
+ def ==(other)
504
+ ConTeXtSetup::Position===other && @list==other.list
505
+ end
506
+
507
+ private
508
+
509
+ def show
510
+ @list ? "(...,...)" : "(..)"
511
+ end
512
+ end
513
+ class Index < Param
514
+ attr_accessor :list
515
+ def parse_xml(elt)
516
+ @list = elt.attributes["list"] == "yes"
517
+ end
518
+ def initialize(interface)
519
+ @interface=interface
520
+ @list=false
521
+ end
522
+ def ==(other)
523
+ ConTeXtSetup::Index===other && @list==other.list
524
+ end
525
+ private
526
+
527
+ def show
528
+ @list ? "{...+...+...}" : "{...}"
529
+ end
530
+ end #
531
+ class Csname < Param
532
+ def to_html(detail=true,cls="first")
533
+ if detail
534
+ ""
535
+ else
536
+ "\\command"
537
+ end
538
+ end
539
+ def ==(other)
540
+ ConTeXtSetup::Csname===other
541
+ end
542
+
543
+ end
544
+ class Word < Param
545
+ attr_accessor :list
546
+ def parse_xml(elt)
547
+ @list = elt.attributes["list"] == "yes"
548
+ end
549
+ def initialize(interface)
550
+ @interface=interface
551
+ @list=false
552
+ end
553
+ def to_html(detail=true,cls="first")
554
+ # this is a hack! cd:word only appears with one argument, so the second td looks ugly
555
+ # TODO: this should be corrected in Command.to_html
556
+ head="{... ...}"
557
+ if detail
558
+ tr {
559
+ td(:class => cls) { head }
560
+ }
561
+ else
562
+ head
563
+ end
564
+ end
565
+ def ==(other)
566
+ ConTeXtSetup::Word===other && @list==other.list
567
+ end
568
+ end
569
+ class Reference < Param
570
+ attr_accessor :optional, :list
571
+ def parse_xml(elt)
572
+ @optional = elt.attributes["optional"] == "yes"
573
+ @list = elt.attributes['list']=="yes"
574
+ end
575
+ def initialize(interface)
576
+ @interface=interface
577
+ @optional=false
578
+ end
579
+ def ==(other)
580
+ ConTeXtSetup::Reference===other && @optional == other.optional && @list==other.list
581
+ end
582
+ private
583
+ def show
584
+ @list ? "[ref,ref,...]" : "[ref]"
585
+ end
586
+
587
+ end
588
+ class Content < Param
589
+ attr_accessor :list
590
+ def parse_xml(elt)
591
+ @list = elt.attributes["list"] == "yes"
592
+ end # parse_xml
593
+ def initialize(interface)
594
+ @interface=interface
595
+ @list=false
596
+ end
597
+ def to_html(detail=true,cls='first')
598
+ head = show
599
+ if detail
600
+ tr{ td(:class => cls) { head } + td(:class => cls) { "<i>text</i>" } }
601
+ else
602
+ head
603
+ end
604
+ end
605
+ def ==(other)
606
+ Content===other && @list == other.list
607
+ end
608
+ private
609
+
610
+ def show
611
+ @list ? "{...,...,...}" : "{...}"
612
+ end
613
+
614
+ end
615
+ class Inherit < Param
616
+ attr_accessor :name
617
+ def parse_xml(elt)
618
+ @name=elt.attributes["name"]
619
+ end # parse_xml
620
+ def initialize(interface)
621
+ @interface=interface
622
+ @name=nil
623
+ end
624
+ def to_html
625
+ "see also #{@name}"
626
+ end
627
+ def ==(other)
628
+ Inherit===other && @name==other.name
629
+ end
630
+ end
631
+ class Parameter < Param
632
+ attr_accessor :name, :list
633
+ def parse_xml(elt)
634
+ @name=elt.attributes["name"]
635
+ elt.each_element do |elt|
636
+ case elt.name
637
+ when "constant"
638
+ @list << elt.attributes["type"]
639
+
640
+ when "resolve"
641
+ @list = @interface.defines[elt.attributes["name"]].keywords
642
+ else
643
+ raise "not implemented yet: Parameter/#{elt.name}"
644
+ end
645
+ end
646
+ end # parse_xml
647
+ def initialize(interface)
648
+ @interface=interface
649
+ @name=nil
650
+ @list=[]
651
+ end
652
+ def to_html(detail=true)
653
+ if detail
654
+ sanitize_html @list.join(" ")
655
+ else
656
+ @name
657
+ end
658
+
659
+ end
660
+ def ==(other)
661
+ Parameter===other && @name==other.name && @list==other.list
662
+ end
663
+ end
664
+ class Keywords < Param
665
+ attr_accessor :optional,:keywords, :default, :list
666
+ def parse_xml(keywords)
667
+ @optional = keywords.attributes['optional']=="yes"
668
+ @list = keywords.attributes['list']=="yes"
669
+ keywords.each_element do |keyword|
670
+ @keywords << keyword.attributes["type"]
671
+ if keyword.attributes["default"]=="yes"
672
+ @default=@keywords.size - 1
673
+ end
674
+ end
675
+ end # parse_xml
676
+
677
+ def initialize(interface)
678
+ @interface=interface
679
+ @optional=false
680
+ @list=false
681
+ @default=nil
682
+ @keywords=[]
683
+ end
684
+ def to_html(detail=true,cls="first")
685
+ head=@list ? "[...,...,...]" : "[...]"
686
+ if detail
687
+ # create list
688
+ lst=[]
689
+ @keywords.each_with_index { |kw, i|
690
+ lst << (@default==i ? strong { kw } : kw )
691
+ }
692
+ tr { td(:class => cls) { head } + td(:class => cls) { sanitize_html(lst.join(" ")) } }
693
+ else
694
+ head
695
+ end
696
+ end
697
+ # Return true if the two objects are the same. Comparison is based on the
698
+ # attributes 'list', 'default', 'optional' and 'keywords'.
699
+ def ==(other)
700
+ return false unless Keywords===other
701
+ other.optional == @optional && other.keywords == @keywords &&
702
+ other.default == @default && other.list == @list
703
+ end
704
+ end
705
+ class Triplet < Param
706
+ attr_accessor :list
707
+ def parse_xml(elt)
708
+ @list=elt.attributes["list"]=="yes"
709
+ end
710
+ def initialize(interface)
711
+ @interface=interface
712
+ @list=false
713
+ end
714
+
715
+ # Return true if the two objects are the same. Comparison is based on the attribute 'list'.
716
+ def ==(other)
717
+ return false unless Triplet===other
718
+ other.respond_to?(:list) && self.list==other.list
719
+ end
720
+
721
+ private
722
+
723
+ def show
724
+ "[x:y:z=,...]"
725
+ end
726
+ end
727
+ end
728
+
metadata ADDED
@@ -0,0 +1,51 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.0
3
+ specification_version: 1
4
+ name: contextsetup
5
+ version: !ruby/object:Gem::Version
6
+ version: "0.1"
7
+ date: 2006-09-03 00:00:00 +02:00
8
+ summary: Library for accessing ConTeXt setup files (cont-??.xml)
9
+ require_paths:
10
+ - lib
11
+ email:
12
+ homepage:
13
+ rubyforge_project:
14
+ description: ConTeXt setup library is a helper library to use the cont-??.xml files for ConTeXt.
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors: []
30
+
31
+ files:
32
+ - lib/tex/context/contextsetup.rb
33
+ - README
34
+ - Rakefile
35
+ test_files: []
36
+
37
+ rdoc_options:
38
+ - --main
39
+ - README
40
+ - --title
41
+ - ConTeXt Setup
42
+ extra_rdoc_files:
43
+ - README
44
+ executables: []
45
+
46
+ extensions: []
47
+
48
+ requirements:
49
+ - none
50
+ dependencies: []
51
+