File: tmstd/docbook/leaf.rb

Overview
Module Structure
Class Hierarchy
Code

Overview

Module Structure

  module: <Toplevel Module>
  module: TmStd#8
  module: DocBook#10
  module: Leaf#12
  module: Include#14
  class: Element#16
inherits from
  LeafElement ( TmStd::DocBook::Abstraction )
has properties
attribute: name [R] #17
attribute: suffix [R] #17
method: initialize / 2 #20
method: to_xml #29
  module: Text#38
  class: Element#40
inherits from
  LeafElement ( TmStd::DocBook::Abstraction )
has properties
attribute: text [R] #41
method: initialize / 1 #44
method: to_xml #53
  module: RawText#62
  class: Element#64
inherits from
  Element ( TmStd::DocBook::Leaf::Text )
has properties
method: to_xml #65
  module: Title#74
  class: Element#76
inherits from
  Name ( TmStd::DocBook::Abstraction )
has properties
method: to_xml #77
  module: PubDate#86
  class: Element#88
inherits from
  Name ( TmStd::DocBook::Abstraction )
has properties
method: to_xml #89
  module: Primary#98
  class: Element#100
inherits from
  Name ( TmStd::DocBook::Abstraction )
has properties
method: to_xml #101
  module: Secondary#110
  class: Element#112
inherits from
  Name ( TmStd::DocBook::Abstraction )
has properties
method: to_xml #113
  module: Tertiary#122
  class: Element#124
inherits from
  Name ( TmStd::DocBook::Abstraction )
has properties
method: to_xml #125
  module: Literal#134
  class: Element#136
inherits from
  Name ( TmStd::DocBook::Abstraction )
has properties
method: to_xml #137
  module: Constant#146
  class: Element#148
inherits from
  Name ( TmStd::DocBook::Abstraction )
has properties
method: to_xml #149
  module: VarName#158
  class: Element#160
inherits from
  Name ( TmStd::DocBook::Abstraction )
has properties
method: to_xml #161
  module: ClassName#170
  class: Element#172
inherits from
  Name ( TmStd::DocBook::Abstraction )
has properties
method: to_xml #173
  module: Function#182
  class: Element#184
inherits from
  Name ( TmStd::DocBook::Abstraction )
has properties
method: to_xml #185
  module: FileName#194
  class: Element#196
inherits from
  Name ( TmStd::DocBook::Abstraction )
has properties
method: to_xml #197
  module: Index#206
  class: Element#208
inherits from
  LeafElement ( TmStd::DocBook::Abstraction )
has properties
method: to_xml #209
  module: Anchor#218
  class: Element#220
inherits from
  LeafElement ( TmStd::DocBook::Abstraction )
has properties
method: to_xml #221
  module: ColSpec#230
  class: Element#232
inherits from
  LeafElement ( TmStd::DocBook::Abstraction )
has properties
method: initialize / 1 #233
method: to_xml #245

Code

   1  # $Id: leaf.rb,v 1.4 2012/01/20 18:11:33 machan Exp $
   2 
   3  require 'tmdoc/tmstd'
   4  require 'tmdoc/tmstd/xml'
   5  require 'tmdoc/tmstd/docbook/abstraction'
   6 
   7 
   8  module TmStd
   9 
  10  module DocBook
  11 
  12  module Leaf
  13 
  14  module Include
  15 
  16  class Element < Abstraction::LeafElement
  17      attr_reader :name, :suffix
  18 
  19 
  20      def initialize(name, suffix)
  21          Assertion.kind_of name,     String
  22          Assertion.kind_of suffix,   String
  23 
  24          @name   = name
  25          @suffix = suffix
  26      end
  27 
  28 
  29      def to_xml
  30          Xml::Include.new(format("%s.%s", @name, @suffix))
  31      end
  32  end
  33 
  34  end
  35 
  36 
  37 
  38  module Text
  39 
  40  class Element < Abstraction::LeafElement
  41      attr_reader :text
  42 
  43 
  44      def initialize(text)
  45          Assertion.kind_of text, String
  46 
  47          super()
  48 
  49          @text = text
  50      end
  51 
  52 
  53      def to_xml
  54          Xml::Text.new @text
  55      end
  56  end
  57 
  58  end
  59 
  60 
  61 
  62  module RawText
  63 
  64  class Element < Text::Element
  65      def to_xml
  66          Xml::RawText.new self.text
  67      end
  68  end
  69 
  70  end
  71 
  72 
  73 
  74  module Title
  75 
  76  class Element < Abstraction::Name
  77      def to_xml;
  78          super :title
  79      end
  80  end
  81 
  82  end
  83 
  84 
  85 
  86  module PubDate
  87 
  88  class Element < Abstraction::Name
  89      def to_xml
  90          super :pubdate
  91      end
  92  end
  93 
  94  end
  95 
  96 
  97 
  98  module Primary
  99 
 100  class Element < Abstraction::Name
 101      def to_xml
 102          super :primary
 103      end
 104  end
 105 
 106  end
 107 
 108 
 109 
 110  module Secondary
 111 
 112  class Element < Abstraction::Name
 113      def to_xml
 114          super :secondary
 115      end
 116  end
 117 
 118  end
 119 
 120 
 121 
 122  module Tertiary
 123 
 124  class Element < Abstraction::Name
 125      def to_xml
 126          super :tertiary
 127      end
 128  end
 129 
 130  end
 131 
 132 
 133 
 134  module Literal
 135 
 136  class Element < Abstraction::Name
 137      def to_xml
 138          super :literal
 139      end
 140  end
 141 
 142  end
 143 
 144 
 145 
 146  module Constant
 147 
 148  class Element < Abstraction::Name
 149      def to_xml
 150          super :constant
 151      end
 152  end
 153 
 154  end
 155 
 156 
 157 
 158  module VarName
 159 
 160  class Element < Abstraction::Name
 161      def to_xml
 162          super :varname
 163      end
 164  end
 165 
 166  end
 167 
 168 
 169 
 170  module ClassName
 171 
 172  class Element < Abstraction::Name
 173      def to_xml
 174          super :classname
 175      end
 176  end
 177 
 178  end
 179 
 180 
 181 
 182  module Function
 183 
 184  class Element < Abstraction::Name
 185      def to_xml
 186          super :function
 187      end
 188  end
 189 
 190  end
 191 
 192 
 193 
 194  module FileName
 195 
 196  class Element < Abstraction::Name
 197      def to_xml
 198          super :filename
 199      end
 200  end
 201 
 202  end
 203 
 204 
 205 
 206  module Index
 207 
 208  class Element < Abstraction::LeafElement
 209      def to_xml
 210          super :index
 211      end
 212  end
 213 
 214  end
 215 
 216 
 217 
 218  module Anchor
 219 
 220  class Element < Abstraction::LeafElement
 221      def to_xml
 222          super :anchor
 223      end
 224  end
 225 
 226  end
 227 
 228 
 229 
 230  module ColSpec
 231 
 232  class Element < Abstraction::LeafElement
 233      def initialize(attrs = {})
 234          Assertion.kind_of attrs,    Hash
 235 
 236          @attr_align = nil
 237          common_attrs = parse_attributes(
 238              attrs, :align => [ String, lambda { |val| @attr_align = val } ]
 239          )
 240 
 241          super common_attrs
 242      end
 243 
 244 
 245      def to_xml
 246          attrs = attributes :align => @attr_align
 247 
 248          super :colspec, attrs
 249      end
 250  end
 251 
 252  end
 253 
 254  end # TmStd::DocBook::Leaf
 255 
 256  end # TmStd::DocBook
 257 
 258  end # TmStd