class SiSU_XML_ODF_ODT_Format::FormatBookIndex
Public Class Methods
new(idx_str)
click to toggle source
# File lib/sisu/xml_odf_odt_format.rb, line 89 def initialize(idx_str) @idx_str=idx_str end
Public Instance Methods
book_idx_bookmark()
click to toggle source
# File lib/sisu/xml_odf_odt_format.rb, line 92 def book_idx_bookmark map_nametags=SiSU_Particulars::CombinedSingleton.instance.get_map_nametags(@md).nametags_map #p map_nametags rgx_bookmark=/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}#?\S+?#{Mx[:rel_c]}/m while @idx_str =~/#{Mx[:lnk_o]}([^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+)#{Mx[:lnk_c]}#{Mx[:rel_o]}#?(\S+?)#{Mx[:rel_c]}/m link,url=$1,$2 link,url=link.strip,url.strip @idx_str=@idx_str.gsub(/&/m,"&") ocn_lnk=if map_nametags[url] \ and map_nametags[url][:ocn] map_nametags[url][:ocn] else nil end ocn_lnk=(url=~/^\d+$/ ? url : ocn_lnk) if ocn_lnk and not ocn_lnk.empty? @idx_str=@idx_str.sub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/, '<text:span text:style-name="Span_bold">\1</text:span>'). sub(rgx_bookmark, %{<text:bookmark-ref text:reference-format="text" text:ref-name="#{url}">#{link.strip}</text:bookmark-ref>}) else puts %{name tag: "#{url}" not found} @idx_str.sub!(rgx_bookmark,"#{link}") end end @idx_str=@idx_str.gsub(/#{Xx[:protect]}/m,''). sub(/,\s*$/m,''). gsub(/\n/,'') @idx_str='<text:p text:style-name="P_normal">' + @idx_str + '</text:p>' end