Class: SiSU_XML_Format::ParagraphNumber

Inherits:
Object
  • Object
show all
Defined in:
lib/sisu/xml_format.rb,
lib/sisu/xml_format.rb

Instance Method Summary collapse

Constructor Details

#initialize(md, ocn) ⇒ ParagraphNumber

Returns a new instance of ParagraphNumber.



60
61
62
63
# File 'lib/sisu/xml_format.rb', line 60

def initialize(md,paranum)
  @md=md
  @paranum=(paranum ? (/(\d+)/m.match(paranum)[1]) : nil)
end

Instance Method Details

#displayObject



64
65
66
67
68
69
70
71
72
# File 'lib/sisu/xml_format.rb', line 64

def display
  p_num_display=if @paranum
    @paranum.gsub(/(\d+)/,
    '<font size="1" color="#777777">' +
    '&nbsp;&nbsp;\1</font>')
  else ''
  end
  p_num_display
end

#gotoObject



77
78
79
80
# File 'lib/sisu/xml_format.rb', line 77

def goto
  p_num_goto=@paranum.gsub(/(\d+)/,'<a href="#\1">')
  p_num_goto
end

#idObject

w3c? “tidy” complains about numbers as identifiers ! annoying



357
358
359
# File 'lib/sisu/xml_format.rb', line 357

def id #w3c? "tidy" complains about numbers as identifiers ! annoying
  %{id="o#{@ocn}"}
end

#nameObject



73
74
75
76
# File 'lib/sisu/xml_format.rb', line 73

def name
  p_num_name=@paranum.gsub(/(\d+)/,'<a name="\1"></a>')
  p_num_name
end

#ocn_displayObject



337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/sisu/xml_format.rb', line 337

def ocn_display
  @make=SiSU_Env::ProcessingSettings.new(@md)
  if @make.build.ocn?
    ocn_class='ocn'
    if @ocn.to_i==0
      @ocn.gsub(/^(\d+|)$/,
        %{<label class="#{ocn_class}"><a name="#{@ocn}">&nbsp;</a></label>})
    else
      @ocn.gsub(/^(\d+|)$/,
        %{<label class="#{ocn_class}"><a name="#{@ocn}">\\1</a></label>})
    end
  else
    ocn_class='ocn_off'
    @ocn.gsub(/^(\d+|)$/,
      %{<label class="#{ocn_class}">&nbsp;</label>})
  end
end