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.



57
58
59
60
# File 'lib/sisu/xhtml_epub2_format.rb', line 57

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

Instance Method Details

#gotoObject



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

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

#idObject

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



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

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

#nameObject



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

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

#ocn_displayObject



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

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