File: rd-struct.rb

package info (click to toggle)
rdtool 0.6.38-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 940 kB
  • sloc: ruby: 8,213; lisp: 387; sh: 33; makefile: 16
file content (86 lines) | stat: -rw-r--r-- 2,148 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
require 'rd/document-struct'
require 'rd/tree'
require 'rd/element'
require 'rd/block-element'
require 'rd/list'
require 'rd/desclist'
require 'rd/methodlist'
require 'rd/inline-element'

# definition of RD document structure.

module RD
  # interface. can be component of ListItem.
  module ListItemComposable
  end
  # interface. can be component of Headline and Reference.
  module LabelComposable
  end
  # interface. can include Inline
  module InlineIncludable
  end

  class DocumentStructure
    RD = DocumentStructure.new

    RD.define_relationship(Tree, DocumentElement)
    RD.define_relationship(DocumentElement, BlockElement)
    RD.define_relationship(Headline, LabelComposable)
    RD.define_relationship(TextBlock, InlineElement)
    RD.define_relationship(ItemList, ItemListItem)
    RD.define_relationship(EnumList, EnumListItem)
    RD.define_relationship(DescList, DescListItem)
    RD.define_relationship(MethodList, MethodListItem)
    RD.define_relationship(ListItem, ListItemComposable)
    RD.define_relationship(DescListItem, DescListItem::Term) 
    RD.define_relationship(DescListItem::Term, LabelComposable)
    RD.define_relationship(MethodListItem, MethodListItem::Term)   
    RD.define_relationship(InlineIncludable, InlineElement)
    RD.define_relationship(Reference, LabelComposable)
  end
  
  class TextBlock
    include ListItemComposable
  end
  class Verbatim
    include ListItemComposable
  end
  class ItemList
    include ListItemComposable
  end
  class EnumList
    include ListItemComposable
  end
  class DescList
    include ListItemComposable
  end
  class StringElement
    include LabelComposable
  end
  class Emphasis
    include LabelComposable
    include InlineIncludable
  end
  class Code
    include LabelComposable
    include InlineIncludable
  end
  class Var
    include LabelComposable
    include InlineIncludable
  end
  class Keyboard
    include LabelComposable
    include InlineIncludable
  end
  class Index
    include LabelComposable
    include InlineIncludable
  end
  class Footnote
    include InlineIncludable
  end
  class Verb
    include LabelComposable
  end
end