Class: SiSU_XHTML_EPUB2_Format::ParagraphNumber

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

Instance Method Summary collapse

Constructor Details

#initialize(md, ocn) ⇒ ParagraphNumber

Returns a new instance of ParagraphNumber.



59
60
61
62
# File 'lib/sisu/xhtml_epub2_format.rb', line 59

def initialize(md,ocn)
  @md,@ocn=md,ocn.to_s
  @ocn ||=''
end

Instance Method Details

#gotoObject



85
86
87
# File 'lib/sisu/xhtml_epub2_format.rb', line 85

def goto
  (@ocn==nil || @ocn.empty?) ? '' : %{<a href="##{@ocn}">}
end

#idObject

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



82
83
84
# File 'lib/sisu/xhtml_epub2_format.rb', line 82

def id #w3c? "tidy" complains about numbers as identifiers ! annoying
  (@ocn==nil || @ocn.empty?) ? '' : %{id="o#{@ocn}"}
end

#nameObject



79
80
81
# File 'lib/sisu/xhtml_epub2_format.rb', line 79

def name
  (@ocn==nil || @ocn.empty?) ? '' : %{<a name="#{@ocn}"></a>}
end

#ocn_displayObject



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/sisu/xhtml_epub2_format.rb', line 63

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