Class: SiSU_Wikispeak::Source::SplitTextObject
- Inherits:
-
SiSU_Wikispeak::Source
- Object
- SiSU_Wikispeak::Source
- SiSU_Wikispeak::Source::SplitTextObject
- Includes:
- Format
- Defined in:
- lib/sisu/wikispeak.rb
Constant Summary collapse
- @@alt_id_count =
0
- @@dp =
nil
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#lev ⇒ Object
readonly
Returns the value of attribute lev.
-
#lev_para_ocn ⇒ Object
readonly
Returns the value of attribute lev_para_ocn.
-
#ocn ⇒ Object
readonly
Returns the value of attribute ocn.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(para) ⇒ SplitTextObject
constructor
A new instance of SplitTextObject.
- #lev_segname_para_ocn ⇒ Object
Methods inherited from SiSU_Wikispeak::Source
Constructor Details
#initialize(para) ⇒ SplitTextObject
Returns a new instance of SplitTextObject.
113 114 115 116 117 |
# File 'lib/sisu/wikispeak.rb', line 113 def initialize(para) @para=para @format,@ocn='ordinary','ordinary' @dp=@@dp ||=SiSU_Env::InfoEnv.new.digest.pattern end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
112 113 114 |
# File 'lib/sisu/wikispeak.rb', line 112 def format @format end |
#lev ⇒ Object (readonly)
Returns the value of attribute lev.
112 113 114 |
# File 'lib/sisu/wikispeak.rb', line 112 def lev @lev end |
#lev_para_ocn ⇒ Object (readonly)
Returns the value of attribute lev_para_ocn.
112 113 114 |
# File 'lib/sisu/wikispeak.rb', line 112 def lev_para_ocn @lev_para_ocn end |
#ocn ⇒ Object (readonly)
Returns the value of attribute ocn.
112 113 114 |
# File 'lib/sisu/wikispeak.rb', line 112 def ocn @ocn end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
112 113 114 |
# File 'lib/sisu/wikispeak.rb', line 112 def text @text end |
Instance Method Details
#lev_segname_para_ocn ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'lib/sisu/wikispeak.rb', line 118 def lev_segname_para_ocn @text=nil if @para =~/^(\d~|<:.+?>).+?#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/ if /^(([1-6])~(\S+))\s+(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/m.match(@para) @format,@lev,segname,@text,@ocn=$1,$2,$3,$4,$5 elsif /^(([1-6])~)\s+(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/m.match(@para) @format,@lev,@text,@ocn=$1,$2,$3,$4 elsif /<:(.+?)>\s*(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/m.match(@para) @format,@text,@ocn=$1,$2,$3 elsif /^(([1-6])~(\S+))\s+(\S.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;[um]\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/m.match(@para) @@alt_id_count+=1 @format,@lev,segname,@text,@ocn=$1,$2,$3,$4,"x#{@@alt_id_count}" elsif /^(([1-6])~)\s+(\S.+?)#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/m.match(@para) @@alt_id_count+=1 @format,@lev,@text,@ocn=$1,$2,$3,"x#{@@alt_id_count}" end else if /(.+?)#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/m.match(@para) @text,@ocn=$1,$2 end if @para !~/#{Mx[:id_o]}~(\d+);(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$|^$/ #added 2002w06 @text=/(.+?)/m.match(@para)[1] end if /^((\d)~(?:~\S+)?)\s+(.+)/m.match(@para) @format,@lev,@text=$1,$2,$3 end end format=@format.dup @lev_para_ocn=if @para =~/.+#{Mx[:id_o]}~\d+;(?:\w|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/ Format::FormatTextObject.new(format,@text,@ocn) else Format::FormatTextObject.new(format,@text,"#{Mx[:id_o]}~(\d+);[um]\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}") end self end |