aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3dv/texpdf.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v3dv/texpdf.rb')
-rw-r--r--lib/sisu/v3dv/texpdf.rb66
1 files changed, 35 insertions, 31 deletions
diff --git a/lib/sisu/v3dv/texpdf.rb b/lib/sisu/v3dv/texpdf.rb
index f8010511..c69f7b9c 100644
--- a/lib/sisu/v3dv/texpdf.rb
+++ b/lib/sisu/v3dv/texpdf.rb
@@ -345,26 +345,26 @@ module SiSU_TeX
# from param, Sort out ... revert to more elegant solution
# even more of a kludge as had to insert newlines where code is used not satisfactory, think about
dob.tmp=dob.obj #.dup
- if dob.is=='para' \
- or dob.is=='heading'
+ if dob.is==:para \
+ || dob.is==:heading
dob.tmp=dob.tmp.gsub(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'')
dob.tmp=SiSU_TeX_Pdf::SpecialCharacters.new(@md,dob.tmp).special_characters
if dob.tmp =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
dob.tmp=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob.tmp).url_str_internal(dob.tmp)
end
- elsif dob.is =='code'
+ elsif dob.is ==:code
dob.tmp=if @codeblock_box=='listings'
dob.tmp
else
SiSU_TeX_Pdf::SpecialCharacters.new(@md,dob.tmp).special_characters_code
end
- elsif dob.is =='break'
+ elsif dob.is ==:break
if dob.obj==Mx[:br_page]; dob.tmp='\newpage'
elsif dob.obj==Mx[:br_page_new]; dob.tmp='\clearpage'
elsif dob.obj==Mx[:br_obj]; dob.tmp='\parasep'
end
- elsif dob.is=='comment' \
- or dob.is=='meta'
+ elsif dob.is==:comment \
+ || dob.is==:meta
dob.tmp='' #dob.tmp=nil
end
end
@@ -403,7 +403,7 @@ module SiSU_TeX
data.each do |dob|
@tex_file << if dob.class==String \
or dob.class==Hash; dob
- elsif dob.is=='table'
+ elsif dob.is==:table
tables_hash(@md,dob) #Hash result
else dob
end
@@ -463,16 +463,18 @@ module SiSU_TeX
def markup_common(dob)
tex_f=nil
txt_obj={ dal: dob }
- if dob.of=='block'
- @lineone=case dob.is
- when /block|group|alt|verse/
+ if dob.of==:block
+ @lineone=if dob.is==:block \
+ || 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
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' \
- or dob.is=='block' \
- or dob.is=='alt'
+ dob.tmp=if dob.is==:group \
+ || dob.is==:block \
+ || dob.is==:alt
ocn \
+ @tex_ml.paraskip_small \
+ "\n" \
@@ -482,7 +484,7 @@ module SiSU_TeX
+ '\\end{footnotesize}' \
+ "\n" \
+ @tex_ml.paraskip_normal
- elsif dob.is=~/verse/
+ elsif dob.is==:verse
ocn \
+ @tex_ml.paraskip_tiny \
+ "\n" \
@@ -495,7 +497,7 @@ module SiSU_TeX
+ "\n\\linebreak\n"
end
dob
- when /code/
+ elsif dob.is ==:code
dob=if @codeblock_box == 'listings'
box_listings(dob,ocn)
elsif @codeblock_box == 'boites'
@@ -511,7 +513,7 @@ module SiSU_TeX
else
tst=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob)
case dob.is
- when 'heading'
+ when :heading
case dob.ln
when 1..3
tst.heading_major
@@ -523,7 +525,7 @@ module SiSU_TeX
tst.level6
else dob
end
- when 'heading_insert'
+ when :heading_insert
br="\n\\\\\n"
if dob.name=='book_index'
h=tst.heading_major
@@ -555,7 +557,7 @@ module SiSU_TeX
dob.tmp=h.tmp + ' ' + '\begin{scriptsize}' + metadata.join(br) + '\end{scriptsize}'
else dob.tmp='' # dob.tmp={ l: '', p: '' }
end
- when 'para'
+ when :para
if dob.bullet_
dob.tmp=tst.bullet
elsif dob.indent \
@@ -572,7 +574,7 @@ module SiSU_TeX
dob=enclose(dob) unless dob.tmp =~/^$/
end
else
- dob.tmp=dob.tmp.strip unless dob.is=='code'
+ dob.tmp=dob.tmp.strip unless dob.is==:code
dob=enclose(dob) unless dob.tmp =~/^$/
end
if dob.class==String
@@ -582,20 +584,20 @@ module SiSU_TeX
dob
end
if dob.tmp =~/(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image\b)/m \
- && dob.is !='code'
+ && dob.is !=:code
dob=SiSU_TeX_Pdf::BareUrls.new(@md,dob).bare_urls
tst=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob)
dob=tst.urls_txt_and_images
dob
elsif dob.tmp =~/https?:\/\/\S+\b/m \
- && dob.is =='code' \
+ && dob.is ==:code \
&& @codeblock_box !='listings'
dob=SiSU_TeX_Pdf::BareUrls.new(@md,dob).bare_urls_in_code
dob
end
if dob.class !=Hash \
&& dob.tmp =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image\b/ \
- && dob.is !='code'
+ && dob.is !=:code
tst=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob)
end
dob
@@ -763,10 +765,10 @@ WOK
x=nil
data.each do |dob| #% case follows with levels 1-6 indents & graphics
if dob.class==Hash
- elsif dob.of=='para' \
- or dob.of=='block' #GATEWAY FIX FIX stuff
+ elsif dob.of==:para \
+ || dob.of==:block #GATEWAY FIX FIX stuff
dob=markup_common(dob)
- elsif dob.is=='table'
+ elsif dob.is==:table
if ( dob.tmp['a4'] \
or dob.tmp['a5'] \
or dob.tmp['b5'] \
@@ -809,7 +811,7 @@ WOK
@tex_file << "\n\\end{document}"
end
def number_paras_numbering(dob) # need tables and other types of object
- if dob.of =~/para/ #\
+ if dob.of ==:para
paranum=dob.ocn ? dob.ocn : ''
paranum = '' if paranum.to_i==0
paranumber_display=if @md.markup.inspect =~/no_ocn/ \
@@ -860,7 +862,9 @@ WOK
else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/
end
else
- dob=if dob.of !~/comment|meta|layout/
+ dob=if dob.of !=:comment \
+ || dob.of !=:meta \
+ || dob.of !=:layout
number_paras_numbering(dob)
else dob
end
@@ -928,13 +932,13 @@ WOK
elsif morph.class.inspect =~ /SiSU_DAL_DocumentStructure/ \
and morph.tmp \
and morph.tmp.class==String
- if morph.is !='code' \
- && morph.of !='block'
+ if morph.is !=:code \
+ && morph.of !=:block
morph.tmp=morph.tmp.gsub(/^\s+/,'')
else morph.tmp
end
- if morph.tmp !~/\A\s*\Z/ \
- or morph.is=='code'
+ if (morph.tmp !~/\A\s*\Z/) \
+ || morph.is==:code
file[:portrait].puts morph.tmp,"\n"
file[:landscape].puts morph.tmp,"\n"
end