Class: SiSU_XML_ODF_ODT_Format::FormatBookIndex
- Inherits:
-
Object
- Object
- SiSU_XML_ODF_ODT_Format::FormatBookIndex
- Defined in:
- lib/sisu/xml_odf_odt_format.rb
Instance Method Summary collapse
- #book_idx_bookmark ⇒ Object
-
#initialize(idx_str) ⇒ FormatBookIndex
constructor
A new instance of FormatBookIndex.
Constructor Details
#initialize(idx_str) ⇒ FormatBookIndex
Returns a new instance of FormatBookIndex.
91 92 93 |
# File 'lib/sisu/xml_odf_odt_format.rb', line 91 def initialize(idx_str) @idx_str=idx_str end |
Instance Method Details
#book_idx_bookmark ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/sisu/xml_odf_odt_format.rb', line 94 def book_idx_bookmark =SiSU_Particulars::CombinedSingleton.instance.(@md). #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 [url] \ and [url][:ocn] [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 |