diff options
Diffstat (limited to 'lib/sisu/v3/texpdf.rb')
-rw-r--r-- | lib/sisu/v3/texpdf.rb | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb index 4c224b22..0665c9b4 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v3/texpdf.rb @@ -401,8 +401,9 @@ module SiSU_TeX def tables(data) @tex_file=[] data.each do |dob| - @tex_file << if dob.class==String \ - or dob.class==Hash; dob + @tex_file << if dob.is_a?(String) \ + or dob.is_a?(Hash) + dob elsif dob.is==:table tables_hash(@md,dob) #Hash result else dob @@ -468,13 +469,14 @@ module SiSU_TeX || dob.is==:group \ || dob.is==:alt \ || dob.is==:verse - dob.tmp=dob.tmp.gsub(/#{Mx[:nbsp]}/m,'{~}'). - gsub(/#{Mx[:gl_bullet]}/m,'$\txtbullet$\hspace{\enspace}'). #Bullet environment not used for grouped text, ∴ no hanging indent here + dob.tmp=dob.tmp.gsub(/#{Mx[:nbsp]}/m,' \hardspace '). + gsub(/#{Mx[:gl_bullet]}/m,'\txtbullet \hardspace '). #Bullet environment not used for grouped text, no hanging indent here gsub(/#{Mx[:br_nl]}+/m,"\n\n") #match not ideal, but currently not inserting extra newlines anyway ocn=SiSU_TeX_Pdf::FormatTextObject.new(@md).ocn_display(dob) dob.tmp=if dob.is==:group \ || dob.is==:block \ || dob.is==:alt + dob.tmp=SiSU_TeX_Pdf::SpecialCharacters.new(@md,dob.tmp).special_characters_safe ocn \ + @tex_ml.paraskip_small \ + "\n" \ @@ -485,6 +487,9 @@ module SiSU_TeX + "\n" \ + @tex_ml.paraskip_normal elsif dob.is==:verse + dob.tmp=dob.tmp.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/m,'\begin{bfseries}\1 \end{bfseries}'). + gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/m,'\emph{\1}'). + gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/m,'\uline{\1}') ocn \ + @tex_ml.paraskip_tiny \ + "\n" \ @@ -531,14 +536,14 @@ module SiSU_TeX h=tst.heading_major heading="\\clearpage\n" + h.tmp idx_arr=[] - idx=SiSU_Particulars::CombinedSingleton.instance.get_idx_tex(@md.opt).tex_idx + idx=SiSU_Particulars::CombinedSingleton.instance.get_idx_raw(@md.opt).raw_idx idx.each do |x| - x=if x.class==String + x=if x.is_a?(String) x=SiSU_TeX_Pdf::SpecialCharacters.new(@md,x).special_characters x=SiSU_TeX_Pdf::FormatTextObject.new(@md,x).url_str_internal(x,true) else x=nil end - idx_arr << x.sub(/,$/,'') if x.class==String + idx_arr << x.sub(/,$/,'') if x.is_a?(String) end idx_str=idx_arr.join(br) l=heading + br + idx_str @@ -577,7 +582,7 @@ module SiSU_TeX dob.tmp=dob.tmp.strip unless dob.is==:code dob=enclose(dob) unless dob.tmp =~/^$/ end - if dob.class==String + if dob.is_a?(String) dob.tmp=dob.tmp.gsub(/\s*(?:#{Mx[:br_line]}|#{Mx[:br_nl]})\s*/,' \newline '). #% tread with care gsub(/(\.#{Tex[:tilde]}\S*\s*|<:\S+>|#{Mx[:fa_o]}.*?#{Mx[:fa_c]}|#{Mx[:gr_o]}.*?#{Mx[:gr_c]}|<!.*?!>|<!>)/,' ') #% tread with care end @@ -705,8 +710,8 @@ WOK % \\sloppy \\begin{document} WOK - sisu_rc_footnote=if @md.sc_info; @tex_ml.doc_sc_info_footnote_full - else @tex_ml.doc_sc_info_footnote_brief + sisu_rc_footnote=if @md.sc_info then @tex_ml.doc_sc_info_footnote_full + else @tex_ml.doc_sc_info_footnote_brief end @copymark='' #check and remove as now is superflous x={} @@ -771,7 +776,7 @@ WOK @tex_file << x x=nil data.each do |dob| #% case follows with levels 1-6 indents & graphics - if dob.class==Hash + if dob.is_a?(Hash) elsif dob.of==:para \ || dob.of==:block #GATEWAY FIX FIX stuff dob=markup_common(dob) @@ -792,7 +797,7 @@ WOK end end end - elsif dob.tmp.class==Hash \ + elsif dob.tmp.is_a?(Hash) \ and (dob.tmp[:p] and dob.tmp[:l]) dob = { p: markup_common(dob.tmp[:p]), @@ -839,7 +844,7 @@ WOK def number_paras(data) tex_file=[] data.each do |dob| - dob=if dob.class==Hash + dob=if dob.is_a?(Hash) if ( dob['a4'] \ or dob['a5'] \ or dob['b5'] \ @@ -927,7 +932,7 @@ WOK file[:portrait] << @@tex_head[ps][:p] file[:landscape] << @@tex_head[ps][:l] array.each do |morph| - if morph.class==String + if morph.is_a?(String) #morph.gsub!(/^\s+/,'') if morph !~/\A\s*\Z/ file[:portrait].puts morph,"\n" @@ -935,7 +940,7 @@ WOK end elsif morph.class.inspect =~ /SiSU_DAL_DocumentStructure/ \ and morph.tmp \ - and morph.tmp.class==String + and morph.tmp.is_a?(String) if morph.is !=:code \ && morph.of !=:block morph.tmp=morph.tmp.gsub(/^\s+/,'') @@ -946,10 +951,10 @@ WOK file[:portrait].puts morph.tmp,"\n" file[:landscape].puts morph.tmp,"\n" end - elsif morph.class==Hash #inserted headers and the like, only + elsif morph.is_a?(Hash) #inserted headers and the like, only h={ ps: ps, h: morph, filename: file } output_morph_hash(h) - elsif morph.tmp.class==Hash #tables & images? + elsif morph.tmp.is_a?(Hash) #tables & images? h={ ps: ps, h: morph.tmp, filename: file } output_morph_hash(h) end |