Class: SiSU_XHTML_EPUB2_Format::FormatSeg
Instance Attribute Summary
#banner, #format, #headname, #link, #linkname, #md, #ocn, #p_num, #paranum, #t_o, #table, #txt, #url
Instance Method Summary
collapse
#alt, #block, #bold, #bold_heading, #bold_para, #break, #bullet, #center, #center_bold, #code, #dl, #endnote_body, #endnote_body_indent, #group, #gsub_body, #nametags_seg, #no_paranum, #para, #para_form_css, #seg_heading4, #seg_heading5, #seg_heading6, #seg_heading7, #seg_heading_sub, #table_css_end, #title_heading, #title_heading0, #title_heading1, #title_heading2, #title_heading3, #title_heading4, #toc_head_copy_at, #verse
#css, #home, #num_css, #paragraph_font_small, #paragraph_font_tiny, #set_fonts, #set_small, #set_tiny, #site, #the_font, #the_line_break, #the_margin, #the_nav, #the_table_close, #the_url, #the_url_decoration, #txt_0, #txt_1, #txt_2, #txt_3, #txt_close, #txt_concordance, #txt_manifest, #txt_open, #txt_toc_link, #xml_close, #xml_open
#footer_signature, #home, #home_txt, #i_choice, #i_home_button, #i_ico, #i_new, #rl_root, #root_http, #sisu, #sisu_txt, #sisudoc, #site, #the_icon, #the_text, #the_url, #txt_home, #txt_hp, #txt_hp_alias, #txt_signature, #urify, #url_close, #url_open
Constructor Details
#initialize(md, txt) ⇒ FormatSeg
Returns a new instance of FormatSeg.
2124
2125
2126
|
# File 'lib/sisu/xhtml_epub2_format.rb', line 2124
def initialize(md,txt)
super(md,txt)
end
|
Instance Method Details
#clean(txt) ⇒ Object
2135
2136
2137
2138
|
# File 'lib/sisu/xhtml_epub2_format.rb', line 2135
def clean(txt)
txt=txt.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/,'').
gsub(/#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'')
end
|
#endnote_seg_body(fn = '') ⇒ Object
FIX #url construction keep within single line… BUG WATCH 200408
2127
2128
2129
2130
2131
2132
2133
2134
|
# File 'lib/sisu/xhtml_epub2_format.rb', line 2127
def endnote_seg_body(fn='') fn='doc' if fn.to_s.empty? %{
<p class="endnote">
#{@endnote_part_a}#{fn}#{Sfx[:epub_xhtml]}#{@endnote_part_b}
</p>
}
end
|
#heading4 ⇒ Object
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
|
# File 'lib/sisu/xhtml_epub2_format.rb', line 2178
def heading4
%{
<div class="substance">
#{@p_num.ocn_display}
<h1 class="norm" #{@p_num.id}>
#{@t_o[:format]}
#{@txt}
</h1>
</div>
}
end
|
#heading5 ⇒ Object
2189
2190
2191
|
# File 'lib/sisu/xhtml_epub2_format.rb', line 2189
def heading5
heading_sub('p','bold',@txt)
end
|
#heading6 ⇒ Object
2192
2193
2194
|
# File 'lib/sisu/xhtml_epub2_format.rb', line 2192
def heading6
heading_sub('p','bold',@txt)
end
|
#heading7 ⇒ Object
2195
2196
2197
|
# File 'lib/sisu/xhtml_epub2_format.rb', line 2195
def heading7
heading_sub('h7','bold',@txt)
end
|
#heading_sub(tag, attrib, txt) ⇒ Object
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
|
# File 'lib/sisu/xhtml_epub2_format.rb', line 2167
def heading_sub(tag,attrib,txt)
txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ')
%{
<div class="substance">
#{@p_num.ocn_display}
<#{tag} class="#{attrib}" #{@p_num.id}> #{@headname}
#{@txt}
</#{tag}>
</div>
}
end
|
#navigation_center ⇒ Object
2221
2222
2223
|
# File 'lib/sisu/xhtml_epub2_format.rb', line 2221
def navigation_center
%{<p class="centerbold">#{@txt}</p>}
end
|
#navigation_heading4 ⇒ Object
2198
2199
2200
2201
2202
2203
2204
2205
|
# File 'lib/sisu/xhtml_epub2_format.rb', line 2198
def navigation_heading4
%{<table summary="navigation segment heading 4" width=100% bgcolor="#08163f" border="0">
<tr><td align="center">
<p class="bold">
#{@txt}
</p>
#{the_table_close}}
end
|
#navigation_heading5 ⇒ Object
2206
2207
2208
2209
2210
|
# File 'lib/sisu/xhtml_epub2_format.rb', line 2206
def navigation_heading5
%{<p class="bold">
#{@txt}
</p>}
end
|
#navigation_heading6 ⇒ Object
2211
2212
2213
2214
2215
|
# File 'lib/sisu/xhtml_epub2_format.rb', line 2211
def navigation_heading6
%{<p class="bold">
#{@txt}
</p>}
end
|
#navigation_heading7 ⇒ Object
2216
2217
2218
2219
2220
|
# File 'lib/sisu/xhtml_epub2_format.rb', line 2216
def navigation_heading7
%{<p class="bold">
#{@txt}
</p>}
end
|
#subtoc_lev(tag, attrib) ⇒ Object
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
|
# File 'lib/sisu/xhtml_epub2_format.rb', line 2139
def subtoc_lev(tag,attrib)
@txt=clean(@txt)
txt=if @txt \
and @txt =~/<\/?i>|<a\s+name="\S+?">/mi
@txt.gsub(/<\/?i>|<a\s+name="\S+?">/mi,'') else @txt
end
note=''
if txt =~/(#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})/m note=$1
note=note.gsub(/[\s]+/m,' ')
txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ').
gsub(/<a[\n\s]+"[\n\s]+href="##{Mx[:note_ref]}\d+">#{$ep[:hsp]}<sup id="#{Mx[:note]}\d+">\d+<\/sup>#{$ep[:hsp]}/m,'').
gsub(/<a[\n\s]+"[\n\s]+href="##{Mx[:note_ref]}\d+">#{$ep[:hsp]}<sup id="#{Mx[:note]}\d+">\d+<\/sup>#{$ep[:hsp]}/m,'') end
%{<#{tag} class="#{attrib}">
<a href="#o#{@ocn}"><i>#{txt}</i></a> #{note}
</#{tag}>}
end
|
#subtoc_lev5 ⇒ Object
2158
2159
2160
|
# File 'lib/sisu/xhtml_epub2_format.rb', line 2158
def subtoc_lev5
subtoc_lev('h5','subtoc') if @txt
end
|
#subtoc_lev6 ⇒ Object
2161
2162
2163
|
# File 'lib/sisu/xhtml_epub2_format.rb', line 2161
def subtoc_lev6
subtoc_lev('h6','subtoc') if @txt
end
|
#subtoc_lev7 ⇒ Object
2164
2165
2166
|
# File 'lib/sisu/xhtml_epub2_format.rb', line 2164
def subtoc_lev7
subtoc_lev('h7','subtoc') if @txt
end
|