Class: SiSU_XHTML_EPUB2_Concordance::Source::Words
- Inherits:
-
Object
- Object
- SiSU_XHTML_EPUB2_Concordance::Source::Words
- Includes:
- SiSU_Screen, SiSU_XHTML_EPUB2_Format
- Defined in:
- lib/sisu/xhtml_epub2_concordance.rb
Instance Method Summary collapse
-
#initialize(particulars) ⇒ Words
constructor
A new instance of Words.
- #songsheet ⇒ Object
Constructor Details
#initialize(particulars) ⇒ Words
Returns a new instance of Words.
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/sisu/xhtml_epub2_concordance.rb', line 150 def initialize(particulars) @particulars=particulars begin @env,@md,@ao_array=particulars.env,particulars.md,particulars.ao_array @path="#{@env.processing_path.epub}" @freq=Hash.new(0) @rxp_lv0=/^#{Mx[:lv_o]}0:/ @rxp_lv1=/^#{Mx[:lv_o]}1:/ @rxp_lv2=/^#{Mx[:lv_o]}2:/ @rxp_lv3=/^#{Mx[:lv_o]}3:/ @rxp_seg=/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/ @rxp_title=Regexp.new("^#{Mx[:meta_o]}title#{Mx[:meta_c]}\s*(.+?)\s*$") @rxp_t0=Regexp.new('^T0') @rxp_t1=Regexp.new('^T1') @rxp_t2=Regexp.new('^T2') @rxp_t3=Regexp.new('^T3') @rxp_excluded1=/(?:https?|file|ftp):\/\/\S+/ @rxp_excluded0=/^(?:#{Mx[:fa_bold_o]}|#{Mx[:fa_italics_o]})?(?:to\d+|\d+| |#{Mx[:br_endnotes]}|EOF|#{Mx[:br_eof]}|thumb_\S+|snap_\S+|_+|-+|[(]?(?:ii+|iv|vi+|ix|xi+|xiv|xv|xvi+|xix|xx)[).]?|\S+?_\S+|[\d_]+\w\S+|[\w\d]{1,2}|\d{1,3}\w?|[0-9a-f]{16,64}|\d{2,3}x\d{2,3}|\S{0,2}sha\d|\S{0,3}\d{4}w\d\d|\b\w\d+|\d_all\b|e\.?g\.?)(?:#{Mx[:fa_bold_c]}|#{Mx[:fa_italics_c]})?$/mi #this regex causes and cures a stack dump in ruby 1.9 !!! @rgx_splitlist=%r{[—.,;:-]+|#{Mx[:nbsp]}+}mi @rgx_scanlist=%r{#{Mx[:fa_italics_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_italics_c]}|#{Mx[:fa_bold_o]}[a-zA-Z0-9"\s]{2,12}#{Mx[:fa_bold_c]}|#{Mx[:url_o]}https?://\S+?#{Mx[:url_c]}|file://\S+|<\S+?>|\w+|[a-zA-Z]+}mi rescue SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do __LINE__.to_s + ':' + __FILE__ end end end |
Instance Method Details
#songsheet ⇒ Object
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/sisu/xhtml_epub2_concordance.rb', line 176 def songsheet begin #fix to use p __LINE__.to_s + ':' + __FILE__ p "#{@path}/content/#{@md.fn[:epub_concord]}" p "#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}" @file_concordance=File.open("#{@path}/content/#{@md.fn[:epub_concord]}",'w') map_para rescue SiSU_Errors::Rescued.new($!,$@,@md.opt.selections.str,@md.fns).location do __LINE__.to_s + ':' + __FILE__ end ensure @file_concordance.close end end |