\n}
@@seg[:main] << dob_html
@@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc
@@ -473,16 +494,18 @@ module SiSU_HTML_Seg
data.each do |dob|
dob.obj=dob.obj.gsub(/
(.+?)<\/a>/mi,'\1')
if @md.flag_auto_endnotes
- if (dob.is=='heading' or dob.is=='heading_insert') \
- and dob.ln.to_s =~/^[1234]/ \
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
+ && (dob.ln.to_s =~/^[1234]/) \
and not @@fn.to_s.empty?
@@seg_endnotes[@@fn]=[]
@@seg_endnotes[@@fn] << @@seg_endnotes_array
@@seg_endnotes_array=[] if dob.ln==4
@@fns_previous=@md.fns if dob.ln==4 and dob.name =~/^meta/
end
- if (dob.is=='heading' or dob.is=='heading_insert') \
- and dob.ln==4 #% EXTRACTION OF SUB-TOCs & SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs
+ if (dob.is==:heading \
+ || dob.is==:heading_insert) \
+ && dob.ln==4 #% EXTRACTION OF SUB-TOCs & SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs
@@seg_subtoc[@@fn]=@@seg_subtoc_array
@@seg_subtoc_array=[]
if dob.name \
@@ -496,8 +519,8 @@ module SiSU_HTML_Seg
end
end
end
- if dob.is=='heading' \
- and dob.ln.to_s =~/^[56]/
+ if dob.is==:heading \
+ && (dob.ln.to_s =~/^[56]/)
case dob.ln
when 5
txt_obj={ txt: dob.obj.strip, ocn: dob.ocn }
@@ -511,8 +534,8 @@ module SiSU_HTML_Seg
@@seg_subtoc_array << subtoc
end
if @md.flag_auto_endnotes
- if dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ \2 ' + #note- endnote-
'\1\2
\2. \3 \4'). #endnote- note- (careful may have switched)
@@ -341,7 +341,7 @@ module SiSU_HTML_Tune
def markup(dob)
dob.obj=dob.obj.gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;')
- dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'
') unless dob.is=='table'
+ dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'
') unless dob.is==:table
dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'
\1').
gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'
\1').
gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'
\1').
diff --git a/lib/sisu/v3dv/hub.rb b/lib/sisu/v3dv/hub.rb
index c2477267..4924297a 100644
--- a/lib/sisu/v3dv/hub.rb
+++ b/lib/sisu/v3dv/hub.rb
@@ -364,8 +364,8 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/
@cX=SiSU_Screen::Ansi.new(@opt.cmd).cX
flag=SiSU_Env::InfoProcessingFlag.new
if @opt.cmd =~/[vVM]/ #% version information
- if @opt.cmd =~/V/ \
- and @opt.files.empty? #% environment
+ if (@opt.cmd =~/V/) \
+ && (@opt.files.empty?) #% environment
SiSU_Help::Help.new('env',@opt).environment
else SiSU_Help::Help.new('env',@opt).sisu_version
end
diff --git a/lib/sisu/v3dv/manpage.rb b/lib/sisu/v3dv/manpage.rb
index dd681967..0571a0e6 100644
--- a/lib/sisu/v3dv/manpage.rb
+++ b/lib/sisu/v3dv/manpage.rb
@@ -192,16 +192,16 @@ at: <#{vz.url_site}>
WOK
end
def manpage_structure(dob='',hname='') #% Used to extract the structure of a document
- if dob.is=='heading'
+ if dob.is==:heading
lv=dob.ln
n=dob.ln - 1
n3=dob.ln + 2
else lv=nil
end
- wrapped=if dob.is=='para' \
- or dob.is=='heading'
+ wrapped=if dob.is==:para \
+ || dob.is==:heading
paragraph=dob.obj
- if dob.is=='para'
+ if dob.is==:para
if dob.indent =~/[1-9]/ \
and dob.indent == dob.hang
util=if dob.bullet_
@@ -259,8 +259,8 @@ WOK
fix=[]
manpage_metadata
data.each do |dob|
- if dob.is=='comment' \
- or dob.is=='heading_insert'
+ if dob.is==:comment \
+ || dob.is==:heading_insert
dob.obj=''
end
dob.obj=dob.obj.gsub(/.+?<-#>/,''). # remove dummy headings (used by html) #check
@@ -275,7 +275,7 @@ WOK
gsub(/\A\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}([,.:!?](?: |$))?#{Mx[:br_line]}/m,"#{Mx[:br_line]}.BI \\1\\2#{Mx[:br_line]}").
gsub(/\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}([,.:!?](?: |$))?/,"#{Mx[:br_line]}.B \\1\\2#{Mx[:br_line]}").
gsub(/\s*#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}([,.:!?](?: |$))?/,"#{Mx[:br_line]}.I \\1\\2#{Mx[:br_line]}")
- unless dob.is=='code'
+ unless dob.is==:code
dob.obj=dob.obj.gsub(/(?:^|\s)#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}([,.:!?](?: |$))?/,"\\1 #{@brace_url.txt_open}\\2#{@brace_url.txt_close}\\3").
gsub(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}([,.:!?](?: |$))?/,"\\1#{@brace_url.txt_open}\\2#{@brace_url.txt_close}\\3")
@manpage[:endnotes]=extract_endnotes(dob.obj)
@@ -305,7 +305,7 @@ WOK
gsub(/-/,'\-') #manpages use this
dob.obj=dob.obj.gsub(/~/,'~') if dob.obj #manpages use this
if dob.is =~/block|group|verse|alt|code/
- if dob.is =='code'
+ if dob.is ==:code
dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _<
gsub(/(^|[^}])_([<>])/m,'\1\2'). # _<_<
gsub(/\A(.+)?\Z/m,".nf\n\n\\1\n\n.fi")
@@ -340,7 +340,7 @@ WOK
@p_num=SiSU_ManpageFormat::ParagraphNumber.new(paranum)
end
x=SiSU_ManpageFormat::FormatTextObject.new(@md,dob)
- if dob.is=='heading'
+ if dob.is==:heading
manpage_structure(dob)
dob.obj=case dob.ln
when 1; x.heading_body1
@@ -350,7 +350,7 @@ WOK
when 5; x.heading_body5
when 6; x.heading_body6
end
- elsif dob.is=='para'
+ elsif dob.is==:para
manpage_structure(dob)
else
if dob.obj =~/#{table_message}/
@@ -367,7 +367,7 @@ WOK
gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~').
gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{').
gsub(/#{Mx[:pa_o]}\S+#{Mx[:pa_c]}/,' ')
- unless dob.is =='code'
+ unless dob.is ==:code
dob.obj=dob.obj.gsub(//,' ').
gsub(/<:\S+>/,' ')
end
diff --git a/lib/sisu/v3dv/odf.rb b/lib/sisu/v3dv/odf.rb
index 1b928548..68aa6e40 100644
--- a/lib/sisu/v3dv/odf.rb
+++ b/lib/sisu/v3dv/odf.rb
@@ -305,11 +305,11 @@ module SiSU_ODF
%{#{@brace_url.xml_open}
\\1#{@brace_url.xml_close}}).
gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,
%{#{@brace_url.xml_open}
\\1#{@brace_url.xml_close}}) #http ftp matches with decoration
- dob.obj= if dob.is=='para' \
+ dob.obj= if dob.is==:para \
and dob.indent.to_s =~/[0-9]/ \
and dob.indent == dob.hang
%{
#{dob.obj}#{p_num}}
- elsif dob.is=='para' \
+ elsif dob.is==:para \
and dob.hang.to_s =~/[0-9]/ \
and dob.indent != dob.hang
%{
#{dob.obj}#{p_num}}
@@ -432,7 +432,7 @@ module SiSU_ODF
dob
end
def code(dob,p_num) #P5
- if dob.is=='code'
+ if dob.is==:code
dob.obj=dob.obj.gsub(/\s\s/,' ')
parray=[]
dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock|
@@ -449,14 +449,14 @@ module SiSU_ODF
dob
end
def table(dob,p_num) #
- if dob.is =='table'
+ if dob.is ==:table
table=SiSU_ODF_Format::Table.new(@md,dob,p_num)
dob=table.table
end
dob
end
def obj_break(dob)
- if dob.is =='break'
+ if dob.is ==:break
br=SiSU_ODF_Format::FormatObjBreak.new(@md,dob)
if dob.obj==Mx[:br_page] \
or dob.obj==Mx[:br_page_new]
@@ -469,7 +469,7 @@ module SiSU_ODF
end
def odf_structure(md,dob)
@md,@dob=md,dob
- dob=if dob.is !='code'
+ dob=if dob.is !=:code
dob=image(dob) if dob.obj =~/#{Mx[:lnk_o]}[ ]*\S+?\.(?:png|jpg|gif)\s.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
dob=text_link(dob) if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/
dob=text_link_relative(dob) if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/
@@ -486,19 +486,19 @@ module SiSU_ODF
end
end
dob=footnote(dob)
- if dob.is=='heading'
+ if dob.is==:heading
@@odf[:body] << heading(dob,p_num).obj << @br*2
- elsif dob.is =='verse'
+ elsif dob.is ==:verse
@@odf[:body] << poem(dob,p_num).obj << @br*2
- elsif dob.is=='group'
+ elsif dob.is==:group
@@odf[:body] << group(dob,p_num).obj << @br*2
- elsif dob.is=='block'
+ elsif dob.is==:block
@@odf[:body] << block(dob,p_num).obj << @br*2
- elsif dob.is=='code'
+ elsif dob.is==:code
@@odf[:body] << code(dob,p_num).obj << @br*2
- elsif dob.is=='table' #elsif dob.obj =~ /|>)/m,'\1>').
gsub(/(^|[^}])_(?:<|<)/m,'\1<').gsub(/(^|[^}])_(?:>|>)/m,'\1>')
end
- if dob.of=='block'
+ if dob.of==:block
dob.obj=dob.obj.gsub(/#{Mx[:gl_bullet]}/,'● ')
end
dob.obj=dob.obj.gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'
\1').
@@ -560,7 +560,7 @@ module SiSU_ODF
gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;').
gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;').
gsub(/#{Mx[:mk_o]}[~-]##{Mx[:mk_c]}/,'')
- if dob.is=='para' \
+ if dob.is==:para \
and dob.bullet_
dob.obj='
' +
dob.obj
@@ -595,11 +595,17 @@ module SiSU_ODF
dob.obj=tidywords(wordlist).join(' ').strip
@rcdc=true if @rcdc==false \
and (dob.obj =~/~metadata/ or dob =~/#{Mx[:lv_o]}1:meta#{Mx[:lv_x]}\s*Document Information/) #fix Mx[:lv_o]
- if dob.is !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/
+ if dob.is !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ #check
if defined? dob.ocn and dob.ocn =~/\d+/
@p_num=SiSU_ODF_Format::ParagraphNumber.new(dob.ocn)
end
- if dob.is=~/heading|para|group|verse|code|table|break/ # extend, include other types
+ if dob.is ==:heading \
+ || dob.is ==:para \
+ || dob.is ==:group \
+ || dob.is ==:verse \
+ || dob.is ==:code \
+ || dob.is ==:table \
+ || dob.is ==:break
odf_structure(@md,dob)
end
if dob.obj ## Clean Prepared Text
diff --git a/lib/sisu/v3dv/plaintext.rb b/lib/sisu/v3dv/plaintext.rb
index ba1f30d2..557c5f1b 100644
--- a/lib/sisu/v3dv/plaintext.rb
+++ b/lib/sisu/v3dv/plaintext.rb
@@ -216,15 +216,15 @@ WOK
end
def plaintext_structure(dob='',p_num='') #% Used to extract the structure of a document
lv=n=n3=nil
- if dob.is=='heading'
+ if dob.is==:heading
lv=dob.ln
n=lv - 1
n3=lv + 2
end
util=nil
- wrapped=if dob.is =='para' \
- or dob.is=='heading'
- if dob.is=='para'
+ wrapped=if dob.is ==:para \
+ or dob.is==:heading
+ if dob.is==:para
if dob.hang \
and dob.hang =~/[0-9]/ \
and dob.indent != dob.hang
@@ -299,7 +299,7 @@ WOK
"#{Px[:strike_o]}\\1#{Px[:strike_c]}").
gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,
"#{Px[:monospace_o]}\\1#{Px[:monospace_c]}")
- unless dob.is=='code'
+ unless dob.is==:code
dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1').
gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1').
gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]').
@@ -323,12 +323,12 @@ WOK
gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©').
gsub(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\\')
end
- dob.obj=if dob.of=='block' # watch
+ dob.obj=if dob.of==:block # watch
dob.obj.gsub(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/,"* ").
gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n")
else dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n\n")
end
- if dob.is=='code'
+ if dob.is==:code
dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _<
gsub(/(^|[^}])_([<>])/m,'\1\2') # _<_<
end
@@ -352,16 +352,16 @@ WOK
p_num=SiSU_PlaintextFormat::ParagraphNumber.new(dob.ocn).display
end
end
- if dob.is=='heading' \
- or dob.is=='para'
+ if dob.is==:heading \
+ or dob.is==:para
plaintext_structure(dob,p_num)
- elsif dob.is=='group' \
- or dob.is=='block' \
- or dob.is=='verse' \
- or dob.is=='code' \
- or dob.is=='table'
+ elsif dob.is==:group \
+ or dob.is==:block \
+ or dob.is==:verse \
+ or dob.is==:code \
+ or dob.is==:table
@plaintext[:body] << dob.obj + p_num << @br
- elsif dob.is=='break'
+ elsif dob.is==:break
sp=' '
ln='-'
@plaintext[:body] <<=if dob.obj==Mx[:br_page] \
diff --git a/lib/sisu/v3dv/po4a.rb b/lib/sisu/v3dv/po4a.rb
index 945b07b8..adb977c2 100644
--- a/lib/sisu/v3dv/po4a.rb
+++ b/lib/sisu/v3dv/po4a.rb
@@ -509,7 +509,7 @@ GSUB
util=nil
fn=(dob_src.name=~/[a-z\d]/i) ? dob_src.name : ''
mark="#{dob_src.lv}~#{fn} "
- d="#{dob_src.is} (level #{dob_src.lv})"
+ d="#{dob_src.is.to_s} (level #{dob_src.lv})"
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct=%{\n# markup for headings is marker at the start of the line/object, indicating the heading level, and if provided an associated name tag, this heading is "#{mark}"}
@@ -538,7 +538,7 @@ GSUB
s_mark=desc=orig=trans=''
if dob_src.bullet_
mark="_#{dob_src.indent}* "
- d="#{dob_src.is}: indent #{dob_src.indent}, bullet"
+ d="#{dob_src.is.to_s}: indent #{dob_src.indent}, bullet"
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct=%{\n# markup for indented bullet text is at the start of the line/object, an underscore followed by the indent level and an asterisk "#{mark}"}
@@ -547,7 +547,7 @@ GSUB
desc="#{d}#{s_mark}#{instruct}"
else
mark="_#{dob_src.indent} "
- d="#{dob_src.is}: indent #{dob_src.indent}"
+ d="#{dob_src.is.to_s}: indent #{dob_src.indent}"
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct=%{\n# markup for indented text is at the start of the line/object, an underscore followed by the indent level "#{mark}"}
@@ -562,7 +562,7 @@ GSUB
and dob_src.indent != dob_src.hang
s_mark=desc=orig=trans=''
mark="_#{dob_src.hang}_#{dob_src.indent} "
- d="#{dob_src.is}: hang #{dob_src.hang} indent #{dob_src.indent}"
+ d="#{dob_src.is.to_s}: hang #{dob_src.hang} indent #{dob_src.indent}"
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct=%{\n# markup for indented text with a first line indented to a different level from the rest of the paragraph, is at the start of the line/object, an underscore and the first indent level a second underscore and the indent level for the rest of the paragraph, "#{mark1}"}
@@ -576,7 +576,7 @@ GSUB
s_mark=desc=orig=trans=''
if dob_src.bullet_
mark='_* '
- d="#{dob_src.is}: bullet"
+ d="#{dob_src.is.to_s}: bullet"
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct=%{\n# markup for indented text is at the start of the line/object, an underscore followed by an asterisk "#{mark}"}
@@ -587,7 +587,7 @@ GSUB
trans=(dob_trn=='') ? '' : "#{s_mark}#{dob_trn.obj}"
else
mark=''
- d=dob_src.is
+ d=dob_src.is.to_s
instruct=%{\n# regular paragraph, no special markup}
if @md.opt.cmd=~/M/
instruct="\n# "
@@ -613,7 +613,7 @@ GSUB
end
def pot_structure_block(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document
mark="block{\\n\\n...\\n\\n}block"
- d=dob_src.is
+ d=dob_src.is.to_s
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct="\n# block text is a text block with an opening and closing marker, the content of which may be wrapped"
@@ -628,7 +628,7 @@ GSUB
end
def pot_structure_group(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document
mark="group{\\n\\n...\\n\\n}group"
- d=dob_src.is
+ d=dob_src.is.to_s
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct="\n# group text is a text block with an opening and closing marker, the content of which may be wrapped"
@@ -643,7 +643,7 @@ GSUB
end
def pot_structure_verse(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document
mark="poem{\n\nverse\n\nverse\n\n...\n\n}poem"
- d=dob_src.is
+ d=dob_src.is.to_s
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct="\n# verse are part of the text block described as a poem, the first verse is preceeded by an opening marker, and the last verse by a closing marker, the content of which should remain unwrapped"
@@ -658,7 +658,7 @@ GSUB
end
def pot_structure_code(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document
mark="code{\\n\\n...\\n\\n}code"
- d=dob_src.is
+ d=dob_src.is.to_s
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct="\n# codeblocks are a text block with an opening and closing marker, the content of which should remain unwrapped"
@@ -673,7 +673,7 @@ GSUB
end
def pot_structure_table(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document
mark="table{\\n\\n...\\n\\n}table"
- d=dob_src.is
+ d=dob_src.is.to_s
instruct=s_mark=''
if @md.opt.cmd=~/M/
instruct="\n# tables are a text block with an opening and closing marker, the content of which should remain unwrapped"
@@ -729,22 +729,22 @@ GSUB
and data_trn[t]
break
end
- if data_src[s].of == 'comment' \
- and data_trn[t].of == 'comment' \
+ if data_src[s].of == :comment \
+ and data_trn[t].of == :comment \
and (data_src[s].is == data_trn[t].is)
s+=1;t+=1
next
end
- if (data_src[s].is == 'comment' or data_trn[t].is == 'comment') \
+ if (data_src[s].is == :comment or data_trn[t].is == :comment) \
and (data_src[s].is != data_trn[t].is)
- if data_src[s].is == 'comment'
+ if data_src[s].is == :comment
puts "src (comment):\n\t" + data_src[s].obj if @md.opt.cmd =~/M/
s+=1
- #next if data_src[s].is == 'comment'
- elsif data_trn[t].is == 'comment'
+ #next if data_src[s].is == :comment
+ elsif data_trn[t].is == :comment
puts "trans (comment):\n\t" + data_trn[t].obj if @md.opt.cmd =~/M/
t+=1
- #next if data_trn[t].is == 'comment'
+ #next if data_trn[t].is == :comment
end
end
if (defined? data_src[s].ocn and data_src[s].ocn.class == Fixnum) \
@@ -814,13 +814,13 @@ GSUB
@p_num=SiSU_Po4aUtils::ParagraphNumber.new(paranum)
end
case dob_src.is
- when 'heading'; pot_structure_heading(dob_src,notes_s,dob_trn,notes_t)
- when 'para'; pot_structure_para(dob_src,notes_s,dob_trn,notes_t)
- when 'group'; pot_structure_group(dob_src,notes_s,dob_trn,notes_t)
- when 'block'; pot_structure_block(dob_src,notes_s,dob_trn,notes_t)
- when 'verse'; pot_structure_verse(dob_src,notes_s,dob_trn,notes_t)
- when 'code'; pot_structure_code(dob_src,notes_s,dob_trn,notes_t)
- when 'table'; pot_structure_table(dob_src,notes_s,dob_trn,notes_t)
+ when :heading; pot_structure_heading(dob_src,notes_s,dob_trn,notes_t)
+ when :para; pot_structure_para(dob_src,notes_s,dob_trn,notes_t)
+ when :group; pot_structure_group(dob_src,notes_s,dob_trn,notes_t)
+ when :block; pot_structure_block(dob_src,notes_s,dob_trn,notes_t)
+ when :verse; pot_structure_verse(dob_src,notes_s,dob_trn,notes_t)
+ when :code; pot_structure_code(dob_src,notes_s,dob_trn,notes_t)
+ when :table; pot_structure_table(dob_src,notes_s,dob_trn,notes_t)
end
if defined? dob_src.idx \
and not dob_src.idx.nil? \
@@ -858,7 +858,7 @@ GSUB
gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,
"#{Px[:po_monospace_o]}\\1#{Px[:po_monospace_c]}")
notes=''
- unless dob.is=='code'
+ unless dob.is==:code
dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1').
gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1').
gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]').
@@ -887,12 +887,12 @@ GSUB
gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~').
gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©')
end
- dob.obj=if dob.of=='block' # watch
+ dob.obj=if dob.of==:block # watch
dob.obj.gsub(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/,"* ").
gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n")
else dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n\n")
end
- if dob.is=='code'
+ if dob.is==:code
dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _<
gsub(/(^|[^}])_([<>])/m,'\1\2') # _<_<
end
diff --git a/lib/sisu/v3dv/shared_html_lite.rb b/lib/sisu/v3dv/shared_html_lite.rb
index 94413c69..27a228eb 100644
--- a/lib/sisu/v3dv/shared_html_lite.rb
+++ b/lib/sisu/v3dv/shared_html_lite.rb
@@ -68,7 +68,7 @@ module SiSU_FormatShared
@md,@t_o=md,t_o
@txt=@t_o.obj
@id=@ocn=@t_o.ocn if defined? @t_o.ocn
- @lv=@t_o.lv.to_s if @t_o.is=='heading'
+ @lv=@t_o.lv.to_s if @t_o.is==:heading
if @md.fns != @@fns
@@fns,@@hname=@md.fns,''
end
@@ -139,7 +139,7 @@ module SiSU_FormatShared
@words=@words.join(' ')
end
def markup_generic(s)
- s=s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'
\1')
+ s=s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'
\1').
gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'
\1').
gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'
\1').
gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"').
@@ -152,7 +152,7 @@ module SiSU_FormatShared
end
def markup_object(t_o)
s=t_o.obj
- s=if t_o.is !='code'
+ s=if t_o.is !=:code
s=markup_generic(s)
if s =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/
wm=s.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)|\S+/)
diff --git a/lib/sisu/v3dv/shared_markup_alt.rb b/lib/sisu/v3dv/shared_markup_alt.rb
index 9719dd3e..dabb765e 100644
--- a/lib/sisu/v3dv/shared_markup_alt.rb
+++ b/lib/sisu/v3dv/shared_markup_alt.rb
@@ -123,13 +123,14 @@ module SiSU_TextRepresentation
gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~').
gsub(/#{Mx[:en_a_o]}([\d*+]+\s+.+?)#{Mx[:en_a_c]}/,'~{\1}~'). # endnote marker marked up
gsub(/#{Mx[:en_b_o]}([\d*+]+\s+.+?)#{Mx[:en_b_c]}/,'~[\1]~') # endnote marker marked up
- if @t_o.is=='heading' or @t_o.is=='para'
+ if @t_o.is==:heading \
+ || @t_o.is==:para
@s=@s.gsub(/ [ ]+/,' ')
@s=@s.gsub(/(?:#{Mx[:nbsp]})+/,' ')
- if @t_o.is=='heading'
+ if @t_o.is==:heading
@s=@t_o.lv + '~ ' + @s
end
- if @t_o.is=='para'
+ if @t_o.is==:para
if @t_o.bullet_
@s='_* ' + @s
end
@@ -139,11 +140,11 @@ module SiSU_TextRepresentation
end
end
end
- if @t_o.is=='block' \
- or @t_o.is=='group' \
- or @t_o.is=='code'
+ if @t_o.is==:block \
+ || @t_o.is==:group \
+ || @t_o.is==:code
@s=@s.gsub(/#{Mx[:nbsp]}/,' ')
- @s="#{@t_o.is}{\n\n#{@s}\n\n}#{@t_o.is}"
+ @s="#{@t_o.is.to_s}{\n\n#{@s}\n\n}#{@t_o.is.to_s}"
@s=@s.gsub(/(?:#{Mx[:br_nl]}|\n)+/m,"\n\n")
end
#dealing with poem and verse calls for change in dal, where start and end verse of poem are marked as such
@@ -162,7 +163,7 @@ module SiSU_TextRepresentation
gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'
\1').
gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'
\1').
gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~')
- if @t_o.is !='code'
+ if @t_o.is !=:code
if @s =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
wm=@s.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)|\S+/)
words=urls(wm)
@@ -176,7 +177,7 @@ module SiSU_TextRepresentation
else
@s=@s.gsub(//m,'>')
end
- if @t_o.is=='paragraph'
+ if @t_o.is==:paragraph
if @t_o.bullet_
@s=@s
end
@@ -184,7 +185,7 @@ module SiSU_TextRepresentation
@s=@s
end
end
- if @t_o.is=='heading'
+ if @t_o.is==:heading
@s=@s
end
else
@@ -291,7 +292,9 @@ module SiSU_TextRepresentation
en_dgst
end
def dgst
- if @t_o.of !='comment' and @t_o.of !='structure' and @t_o.of !='layout'
+ if @t_o.of !=:comment \
+ && @t_o.of !=:structure \
+ && @t_o.of !=:layout
en_dgst,img_dgst={},{}
txt_stripped_dgst=digest(stripped_clean(@t_o))
txt_markup_reverted_dgst=digest(markup_reverted(@t_o))
@@ -300,7 +303,8 @@ module SiSU_TextRepresentation
notes=@t_o.obj.scan(rgx_notes)
endnotes_dgst=endnotes(notes)
rgx_image=/#{Mx[:lnk_o]}(\S+\.(?:png|jpg|gif))\s.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/
- imgs=if (@t_o.is=='para' or @t_o.is=='image') \
+ imgs=if (@t_o.is==:para \
+ || @t_o.is==:image) \
and @t_o.obj =~rgx_image
imgs=@t_o.obj.scan(rgx_image).flatten
line_image=images(imgs)
diff --git a/lib/sisu/v3dv/shared_xml.rb b/lib/sisu/v3dv/shared_xml.rb
index dbaed6d8..6b85d756 100644
--- a/lib/sisu/v3dv/shared_xml.rb
+++ b/lib/sisu/v3dv/shared_xml.rb
@@ -343,7 +343,7 @@ module SiSU_XML_Munge
def markup(dob='')
wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17
dob.obj=tidywords(wordlist).join(' ').strip
- unless dob.is=='table'
+ unless dob.is==:table
dob.obj=dob.obj.gsub(/#{Mx[:br_line]}/u,'
').
gsub(/#{Mx[:br_paragraph]}/u,'
').
gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'
')
@@ -364,13 +364,13 @@ module SiSU_XML_Munge
gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'
\1').
gsub(/<:pb>\s*/,''). #Fix
gsub(/<+[-~]#>+/,'')
- if dob.is !~/^code/
+ if dob.is !=:code
#embeds a red-bullet image -->
dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'
\1').
gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'
\1').
gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'
\1').
gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'
\1')
- dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'
') unless dob.is=='table'
+ dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'
') unless dob.is==:table
dob.obj=dob.obj.gsub(/#{Mx[:br_page]}\s*/,'').
gsub(/#{Mx[:br_page_new]}\s*/,'').
gsub(/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/,'').
@@ -399,7 +399,7 @@ module SiSU_XML_Munge
else
dob.obj=dob.obj.gsub(//m,'>')
end
- if dob.of=='block'
+ if dob.of==:block
dob.obj=dob.obj.gsub(/#{Mx[:gl_bullet]}/,'● ')
end
dob.obj=dob.obj.gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/,
diff --git a/lib/sisu/v3dv/texinfo.rb b/lib/sisu/v3dv/texinfo.rb
index 121cf1ae..145712e1 100644
--- a/lib/sisu/v3dv/texinfo.rb
+++ b/lib/sisu/v3dv/texinfo.rb
@@ -137,19 +137,22 @@ module SiSU_TexInfo
end
def songsheet
begin
- @data=pre
- @data=endnote
- @data=markup
- @data=tail
- output
+ data=@data
+ data=pre(data)
+ data=endnote(data)
+ data=markup(data)
+ objects=tail(data)
+ #output(objects)
+ output(@tex_file)
+ #output(data.compact)
makeinfo #KEEP reinstate when fixed #%
place_info
rescue; STDERR.puts SiSU_Screen::Ansi.new(@md.opt.cmd,$!,$@).rescue
ensure
end
end
- def pre
- data=@data
+ def pre(data)
+ data_new=[]
data.each do |dob|
# DEBUG 2003w16 this is a kludge, because i could not get parameters
# from param, Sort out ... revert to more elegant solution
@@ -161,13 +164,15 @@ module SiSU_TexInfo
gsub(/(^|#{Mx[:gl_c]}|\s)\{(.+?)\}((?:https?|file):\/\/\S+)/,'\1(\2 [linked to:] \3)')
do_mono=SiSU_TexInfoFormat::Texinfo.new(@md,dob)
dob.obj=do_mono.spec_char(dob.obj)
+ data_new << dob
end
- data
+ data_new
end
- def endnote
- data,data_new=@data,[]
+ def endnote(data)
+ data_new=[]
data.each do |dob|
- if dob.of=~/para|block/
+ if dob.of==:para \
+ || dob.of==:block
dob.obj=dob.obj.gsub(/\s*#{Mx[:en_a_o]}(?:\d+)\s+(.+?)#{Mx[:en_a_c]}/m,' @footnote{ \1} ').
gsub(/\s*#{Mx[:en_a_o]}(\*+)\s+(.+?)#{Mx[:en_a_c]}/m,' @footnote{ \1} ')
end
@@ -176,24 +181,24 @@ module SiSU_TexInfo
data_new
end
def poem
- data=@data
+ data,data_new=@data,[]
@tex_file=[]
@@counting=0
data.each do |dob|
- if dob.is =='code'
+ if dob.is ==:code
@@flag['code']=true
@@counting=1
end
- if dob.is =='verse'
+ if dob.is ==:verse
@@flag['poem']=1
end
if @@flag['code']
if @@flag['code'] \
- and dob.obj =~ /#{Mx[:gr_o]}code[-_](?:end|close)#{Mx[:gr_c]}/ #watch change not tested 200501 #fix
+ && (dob.obj =~ /#{Mx[:gr_o]}code[-_](?:end|close)#{Mx[:gr_c]}/) #watch change not tested 200501 #fix
@@flag['code']=false
end
if @@flag['code'] \
- and dob.obj =~ /\S/
+ && (dob.obj =~ /\S/)
sub_array=dob.obj.dup
@@line_mode=sub_array.scan(/.+/)
Tune.code_lines(@@line_mode)
@@ -201,11 +206,11 @@ module SiSU_TexInfo
end
elsif @@flag['poem']==1
if @@flag['poem']==1 \
- and dob.obj =~ /#{Mx[:gr_o]}verse[-_](?:end|close)#{Mx[:gr_c]}/ #watch change not tested 200501 #fix
+ && (dob.obj =~ /#{Mx[:gr_o]}verse[-_](?:end|close)#{Mx[:gr_c]}/) #watch change not tested 200501 #fix
@@flag['poem']=0
end
if @@flag['poem']==1 \
- and dob.obj =~ /\S/
+ && (dob.obj =~ /\S/)
sub_array=dob.obj.dup
@@line_mode=sub_array.scan(/.+/)
Tune.code_lines(@@line_mode)
@@ -213,13 +218,15 @@ module SiSU_TexInfo
end
end
@tex_file << dob.obj
+ data_new << dob
end
+ data_new
end
def code_lines
data,data_new=@data,[]
data.each do |line|
- if line =~ /\S/ \
- and line !~ /#{Mx[:gr_o]}(code|verse).+/ #fix
+ if (line =~ /\S/) \
+ && (line !~ /#{Mx[:gr_o]}(code|verse).+/) #fix
line=if @@flag['code']
line.gsub(/^\s*(.+)/m,"\\noindent \\marginpar\[left-text\]{\\begin{tiny}#{@@counting}\\end{tiny}}\\1\\")
@@counting+=1 if @@flag['code']
@@ -230,7 +237,7 @@ module SiSU_TexInfo
end
end
def tables
- data=@data
+ data,data_new=@data,[]
@tex_file=[]
@@tableheader=0
data.each do |dob|
@@ -239,10 +246,12 @@ module SiSU_TexInfo
dob.obj=do_mono.longtable # using longtable latex package
end
@tex_file << dob.obj
+ data_new << dob
end
+ data_new
end
- def markup
- data=@data
+ def markup(data)
+ data_new=[]
@tex_file=[]
@row_break='\\\\\\'
@break_page="#{@row_break}\n#{@row_break} \n"
@@ -254,12 +263,12 @@ module SiSU_TexInfo
n_menu,n_submenu=0,0
@submenu,@subsubmenu={},{}
data.each do |dob|
- if dob.is =='heading' \
- and dob.ln.to_s =~ /^[1-3]$/
+ if dob.is ==:heading \
+ && (dob.ln.to_s =~ /^[1-3]$/)
toc=SiSU_TexInfoFormat::Texinfo.new(@md,dob)
texinfo_menu << toc.menu
- elsif dob.is =='heading' \
- and dob.ln.to_s =~ /^[4-6]$/
+ elsif dob.is ==:heading \
+ && (dob.ln.to_s =~ /^[4-6]$/)
toc=SiSU_TexInfoFormat::Texinfo.new(@md,dob)
texinfo_menu << toc.menu
case dob.ln
@@ -278,7 +287,9 @@ module SiSU_TexInfo
else
dob.obj=dob.obj.gsub(/\s*(?:<:?br>|
)\s*/,"\n\n")
end
+ data_new << dob
end
+ data=data_new
texinfo_menu=texinfo_menu.compact
texinfo_menu << "* Dublin Core::"
@tex_file << texinfo_menu
@@ -287,15 +298,16 @@ module SiSU_TexInfo
"@c %% 5\n\n"
n_menu,n_submenu=0,0
@@do_submenu,@@do_subsubmenu=1,1
+ data_new=[]
data.each do |dob|
mono=SiSU_TexInfoFormat::Texinfo.new(@md,dob)
- if dob.is=='heading'
+ if dob.is==:heading
case dob.ln
- when 1; mono.level1
- when 2; mono.level2
- when 3; mono.level3
+ when 1; dob=mono.level1
+ when 2; dob=mono.level2
+ when 3; dob=mono.level3
when 4;
- mono.level4
+ dob=mono.level4
n_menu+=1
@@do_submenu,@@do_subsubmenu=1,1
when 5;
@@ -305,7 +317,7 @@ module SiSU_TexInfo
menu=SiSU_TexInfoFormat::TeXinfoTxt.new(@md,dob,@submenu[n_menu])
dob.obj="#{menu.submenu}#{mono.level5.obj}"
@@do_submenu=0
- else mono.level5
+ else dob=mono.level5
end
when 6;
if @@do_submenu==1
@@ -313,37 +325,42 @@ module SiSU_TexInfo
dob.obj="#{menu.subsubmenu}#{mono.level6.obj}"
@@do_subsubmenu=0
else
- mono.level6
+ dob=mono.level6
end
end
else
if dob.obj !~/\S/
dob.obj=nil
else
- if dob.is=='para' \
- and dob.obj !~/##{dob.ocn}/
+ if dob.is==:para \
+ && (dob.obj !~/##{dob.ocn}/)
dob.obj="#{dob.obj} ##{dob.ocn}"
end
end
end
#%case with endnotes
dob.obj=dob.obj.gsub(/\s*[0-8]\\+(\S+)?\s+/,' ') if dob.obj
- @tex_file << dob.obj if dob.obj and dob.is !~/structure|comment/ #sort exceptions
+ if dob.obj \
+ && (dob.is !=:structure \
+ && dob.is !=:comment)
+ @tex_file << dob.obj
+ end
+ data_new << dob
end
- data=@tex_file
+ data_new
end
def number_titles
- data=@data
+ data,data_new=@data,[]
@tex_file=[]
input=%{#{@md.markup}}[/(num_top\s*=\s*(\d?))?/m,2] # else default usually 4 # this was a bit of a trick required to pass nil to input if nothing matched... #puts input
num_top=input.to_i
t_no1=0; t_no2=0; t_no3=0; t_no4=0;
no1=num_top; no2=(num_top + 1); no3=(num_top + 2); no4=(num_top + 3);
data.each do |dob|
- if @md.markup =~ /num_top/i \
- and dob.obj !~ /#{Rx[:meta]}/
- if dob.obj =~ /^[1-6]\\+(?:~\S+)?\s*/ \
- and dob.obj !~ /<:\d-endnotes>/
+ if (@md.markup =~ /num_top/i) \
+ && (dob.obj !~ /#{Rx[:meta]}/)
+ if (dob.obj =~ /^[1-6]\\+(?:~\S+)?\s*/) \
+ && (dob.obj !~ /<:\d-endnotes>/)
header=dob.obj[//m, 1].gsub(/-/m,'.')
dob.obj=dob.obj.gsub(/^(?:[1-6]\\+(?:~\S+)|<:([12356]|4-.+?-)>)\s*/,
"\\1 #{header} ")
@@ -355,16 +372,18 @@ module SiSU_TexInfo
end
@tex_file << dob.obj
end
- data=@tex_file
+ data_new << dob
end
- def tail
- data=@data
+ def tail(data)
tex=SiSU_TexInfoFormat::Texinfo.new(@md)
- data << tex.dublincore
- data << tex.tail
+ objects=[]
+ data.each do |dob|
+ objects << dob.obj if dob.obj
+ end
+ objects << tex.dublincore << tex.tail
+ objects
end
- def output
- data=@data.compact
+ def output(data)
filename_texinfo=%{#{@env.processing_path.texi}/#{@md.fnb}.texinfo}
file_texinfo=File.new(filename_texinfo,'w+')
puts filename_texinfo if @md.opt.cmd =~/M/
diff --git a/lib/sisu/v3dv/texinfo_format.rb b/lib/sisu/v3dv/texinfo_format.rb
index ed9769fc..0555809d 100644
--- a/lib/sisu/v3dv/texinfo_format.rb
+++ b/lib/sisu/v3dv/texinfo_format.rb
@@ -293,7 +293,7 @@ WOK
"@bye"
end
def clean(dob)
- if dob.is=='heading' \
+ if dob.is==:heading \
and dob.obj !~/##{dob.ocn}/
dob.obj="#{dob.obj} ##{dob.ocn}"
end
@@ -556,7 +556,7 @@ WOK
@md,@dob,@txt=md,dob,txt
end
def clean(dob,txt)
- if dob.is=='heading' \
+ if dob.is==:heading \
and txt !~/##{dob.ocn}/
txt="#{dob.obj} ##{dob.ocn}"
end
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
diff --git a/lib/sisu/v3dv/texpdf_format.rb b/lib/sisu/v3dv/texpdf_format.rb
index b82bf687..fdcdc3d1 100644
--- a/lib/sisu/v3dv/texpdf_format.rb
+++ b/lib/sisu/v3dv/texpdf_format.rb
@@ -123,7 +123,7 @@ module SiSU_TeX_Pdf
def longtable_landscape
end_table='\end{longtable}'
row_break='\\\\\\'
- txt=if @dob.is=='table'
+ txt=if @dob.is==:table
tw=case @dob.tmp[:paper_size]
when /a4/i; @tx.a4.landscape.w #European default, SiSU default
when /letter/i; @tx.letter.landscape.w #U.S. default
@@ -168,7 +168,7 @@ module SiSU_TeX_Pdf
def longtable_portrait
end_table='\end{longtable}'
row_break='\\\\\\'
- txt=if @dob.is=='table'
+ txt=if @dob.is==:table
tw=case @dob.tmp[:paper_size]
when /a4/i; @tx.a4.portrait.w #European default, SiSU default
when /letter/i; @tx.letter.portrait.w #U.S. default
@@ -1176,12 +1176,12 @@ WOK
end
end
class SpecialCharacters
- def initialize(md,str,is='')
+ def initialize(md,str,is=:default)
@md,@txt,@is=md,str,is
@brace_url=SiSU_Viz::Skin.new.url_decoration
@tex2pdf=@@tex3pdf ||=SiSU_Env::SystemCall.new.tex2pdf_engine
end
- def xetex_code_listings(str,is='') # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list
+ def xetex_code_listings(str,is=:default) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list
word=str.scan(/\S+|\n/) #unless line =~/^(?:@\S|%+\s)/
para_array=[]
str=if word
@@ -1194,7 +1194,7 @@ WOK
para_array << w
end
str=para_array.join(' ')
- str=str.strip unless is=='code'
+ str=str.strip unless is==:code
str
else ''
end
@@ -1226,7 +1226,7 @@ WOK
gsub(/
&atild;<\/font><\/sup>/,' ').
gsub(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript
end
- def xetex_special_characters_1(str,is='') # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list
+ def xetex_special_characters_1(str,is=:default) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list
#str=Iconv.conv('ISO-8859-1', 'UTF-8', @txt) # `require': iconv will be deprecated in the future, use String#encode instead.
word=str.scan(/\S+|\n/) #unless line =~/^(?:@\S|%+\s)/
para_array=[]
@@ -1249,7 +1249,7 @@ WOK
para_array << w
end
str=para_array.join(' ')
- str=str.strip unless is=='code'
+ str=str.strip unless is==:code
str
else ''
end
@@ -1258,7 +1258,7 @@ WOK
gsub(/#{Mx[:br_eof]}/,'').
gsub(/#{Mx[:br_endnotes]}/,'')
#problem sequence ->
- str=str.gsub(/&(?:nbsp);|#{Mx[:nbsp]}/,'\hardspace') unless is=='code' # < SiSU special character also LaTeX
+ str=str.gsub(/&(?:nbsp);|#{Mx[:nbsp]}/,'\hardspace') unless is==:code # < SiSU special character also LaTeX
str=str.gsub(/&(?:lt|#060);/,'\lt'). # < SiSU special character also LaTeX
gsub(/#{Mx[:gl_o]}#(?:gt|062)#{Mx[:gl_c]}/,'\gt'). # > SiSU special character also LaTeX
gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'\curlyopen'). # { SiSU special character also LaTeX
@@ -1282,7 +1282,7 @@ WOK
gsub(/&atild;<\/font><\/sup>/,' ').
gsub(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript
end
- def xetex_special_characters_2(str,is='')
+ def xetex_special_characters_2(str,is=:default)
str=str.gsub(/#{Mx[:gl_o]}#156#{Mx[:gl_c]}/,'\oe ').
gsub(/\$/,'\$').
gsub(/\#/,'\#').
@@ -1293,7 +1293,7 @@ WOK
end
str=str.gsub(/\{/,'\{').
gsub(/\}/,'\}')
- str=if is=='code'
+ str=if is==:code
str.gsub(/&/,'{\\\&}').
gsub(/\\~(\\\{)/,'{$\tilde$}\1').
gsub(/(\\\})\\~/,'\1{$\tilde$}').
@@ -1316,7 +1316,7 @@ WOK
'\begin{scriptsize}\url{\1}\end{scriptsize}'). #special case \{ e.g. \}http://url
gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,
'\begin{scriptsize}\\url{\1}\end{scriptsize}') #specially escaped url no decoration
- unless is=='code'
+ unless is==:code
str=str.gsub(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?=\s|$))/,
"\\1#{@brace_url.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@brace_url.tex_close}\\3") #url matching with decoration positive lookahead, sequence issue with { linked }http://url cannot use \b at start
end
@@ -1334,7 +1334,7 @@ WOK
gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$").
gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$").
gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\begin{monosp}\1\end{monosp}')
- unless is=='code'
+ unless is==:code
str=str.gsub(/"(.+?)"/,'“\1”'). # quote marks / quotations open & close " need condition exclude for code
gsub(/\s+"/,' “'). # open "
gsub(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*"/,'\1“'). #fix Mx[:lv_o] # open "
diff --git a/lib/sisu/v3dv/xhtml.rb b/lib/sisu/v3dv/xhtml.rb
index 050e16d8..5d17128c 100644
--- a/lib/sisu/v3dv/xhtml.rb
+++ b/lib/sisu/v3dv/xhtml.rb
@@ -192,9 +192,10 @@ WOK
tags
end
def xml_structure(dob,type='norm')
- if dob.is =~/para|heading/
+ if dob.is ==:para \
+ || dob.is ==:heading
named=name_tags(dob)
- if dob.is=='heading'
+ if dob.is==:heading
lv=dob.ln
n=dob.ln - 1
n3=dob.ln + 2
@@ -295,7 +296,7 @@ WOK
end
if not @rcdc
x=SiSU_XML_Format::FormatSeg.new(@md,dob)
- if dob.is=='heading'
+ if dob.is==:heading
xml_structure(dob)
dob.obj=case dob.ln
when 1; x.heading_body1
@@ -306,25 +307,25 @@ WOK
when 6; x.heading_body6
end
else
- if dob.is =='verse'
+ if dob.is ==:verse
poem_structure(dob)
- elsif dob.is =='group'
+ elsif dob.is ==:group
group_structure(dob)
- elsif dob.is =='block'
+ elsif dob.is ==:block
block_structure(dob)
- elsif dob.is =='code'
+ elsif dob.is ==:code
code_structure(dob)
- elsif dob.is =='table'
+ elsif dob.is ==:table
table_structure(dob)
- elsif dob.is =='para' \
+ elsif dob.is ==:para \
and dob.indent.to_s =~/[1-9]/ \
and dob.bullet_==true
xml_structure(dob,"indent_bullet#{dob.indent}")
- elsif dob.is =='para' \
+ elsif dob.is ==:para \
and dob.indent.to_s =~/[1-9]/ \
and dob.indent == dob.hang
xml_structure(dob,"indent#{dob.indent}")
- elsif dob.is=='para' \
+ elsif dob.is==:para \
and dob.hang.to_s =~/[0-9]/ \
and dob.indent != dob.hang
xml_structure(dob,"hang#{dob.hang.to_s}_indent#{dob.indent.to_s}")
diff --git a/lib/sisu/v3dv/xml.rb b/lib/sisu/v3dv/xml.rb
index 776c0376..1187e02e 100644
--- a/lib/sisu/v3dv/xml.rb
+++ b/lib/sisu/v3dv/xml.rb
@@ -204,7 +204,7 @@ WOK
@@xml[:sc]=sc
end
def xml_structure(dob,type='norm')
- if dob.is=='heading'
+ if dob.is==:heading
lv=dob.ln
n=dob.ln - 1
n3=dob.ln + 2
@@ -306,7 +306,7 @@ WOK
@trans.char_enc.utf8(dob) if @sys.locale =~/utf-?8/i #% utf8
dob=@trans.markup(dob)
if @rcdc==false \
- and (dob.is =~/^meta/ \
+ and (dob.is ==:meta \
and dob.obj =~/Document Information/)
@rcdc=true
end
@@ -319,7 +319,7 @@ WOK
if defined? dob.ocn \
and dob.ocn.to_s =~/\d+/
x=SiSU_XML_Format::FormatSeg.new(@md,dob)
- if dob.is=='heading'
+ if dob.is==:heading
xml_structure(dob)
dob.obj=case dob.ln
when 1; x.heading_body1
@@ -330,25 +330,25 @@ WOK
when 6; x.heading_body6
end
else
- if dob.is=='verse'
+ if dob.is==:verse
poem_structure(dob)
- elsif dob.is=='group'
+ elsif dob.is==:group
group_structure(dob)
- elsif dob.is=='block'
+ elsif dob.is==:block
block_structure(dob)
- elsif dob.is=='code'
+ elsif dob.is==:code
code_structure(dob)
- elsif dob.is=='table' # FIX, check css, will need to modify
+ elsif dob.is==:table # FIX, check css, will need to modify
table_structure(dob)
- elsif dob.is =~ /^para/ \
+ elsif dob.is ==:para \
and dob.indent.to_s =~/[1-9]/ \
and dob.bullet_==true
xml_structure(dob,"indent_bullet#{dob.indent}")
- elsif dob.is =~ /^para/ \
+ elsif dob.is ==:para \
and dob.indent.to_s =~/[1-9]/ \
and dob.indent == dob.hang
xml_structure(dob,"indent#{dob.indent}")
- elsif dob.is =~ /^para/ \
+ elsif dob.is ==:para \
and dob.hang.to_s =~/[0-9]/ \
and dob.indent != dob.hang
xml_structure(dob,"hang#{dob.hang.to_s}_indent#{dob.indent.to_s}")
diff --git a/lib/sisu/v3dv/xml_dom.rb b/lib/sisu/v3dv/xml_dom.rb
index ae45100d..e63f7ad7 100644
--- a/lib/sisu/v3dv/xml_dom.rb
+++ b/lib/sisu/v3dv/xml_dom.rb
@@ -165,7 +165,7 @@ WOK
end
def xml_element(dob,xml_el='',xml_content='',type='norm')
n=n1=n2=n3=0
- if dob.is=='heading'
+ if dob.is==:heading
lv=dob.ln
n=dob.ln - 1
n1=dob.ln
@@ -200,7 +200,7 @@ WOK
end
def xml_structure(dob,type='norm')
n=n1=n2=n3=0
- if dob.is=='heading'
+ if dob.is==:heading
lv=dob.ln
n=dob.ln - 1
n1=dob.ln
@@ -344,7 +344,7 @@ WOK
@trans.char_enc.utf8(dob) if @sys.locale =~/utf-?8/i #% utf8
dob=@trans.markup(dob)
if @rcdc==false \
- and (dob.is =~/^meta/ \
+ and (dob.is ==:meta \
and dob.obj =~/Document Information/)
@rcdc=true
end
@@ -353,9 +353,9 @@ WOK
if not @rcdc
if defined? dob.ocn \
and dob.ocn.to_s =~/\d+/
- format_scroll=SiSU_XML_Format::FormatScroll.new(@md,dob) if dob.is=='para' and dob.indent ##FIX
+ format_scroll=SiSU_XML_Format::FormatScroll.new(@md,dob) if dob.is==:para and dob.indent ##FIX
x=SiSU_XML_Format::FormatSeg.new(@md,dob)
- if dob.is=='heading'
+ if dob.is==:heading
if dob.ln==1
type="heading_section_#{dob.ln.to_s}"
xml_markup(dob)
@@ -388,32 +388,32 @@ WOK
end
else
ocn=dob.ocn
- if dob.is=='verse'
+ if dob.is==:verse
type='verse'
poem_structure(dob) #redo
- elsif dob.is=='group'
+ elsif dob.is==:group
type='group'
group_structure(dob) #redo
- elsif dob.is=='block'
+ elsif dob.is==:block
type='block'
block_structure(dob) #redo
- elsif dob.is=='code'
+ elsif dob.is==:code
type='code'
code_structure(dob) #redo
- elsif dob.is=='table' # tables come as single block #work area 2005w13
+ elsif dob.is==:table # tables come as single block #work area 2005w13
type='table'
table_structure(dob)
- elsif dob.is=='para' \
+ elsif dob.is==:para \
and dob.indent.to_s =~/[1-9]/ \
and dob.bullet_
type="indent_bullet#{dob.indent.to_s}"
xml_markup(dob)
- elsif dob.is=='para' \
+ elsif dob.is==:para \
and dob.indent.to_s =~/[1-9]/ \
and dob.indent == dob.hang
type="indent#{dob.indent.to_s}"
xml_markup(dob)
- elsif dob.is=='para' \
+ elsif dob.is==:para \
and dob.hang.to_s =~/[0-9]/ \
and dob.indent != dob.hang
type="hang#{dob.hang.to_s}_indent#{dob.indent.to_s}"
diff --git a/lib/sisu/v3dv/xml_format.rb b/lib/sisu/v3dv/xml_format.rb
index 71a0bd68..50a9f5ac 100644
--- a/lib/sisu/v3dv/xml_format.rb
+++ b/lib/sisu/v3dv/xml_format.rb
@@ -1026,7 +1026,7 @@ WOK
@ocn=if defined? t_o.ocn; t_o.ocn.to_s
else nil
end
- @headname=if t_o.is=='heading' and defined? t_o.name; t_o.name
+ @headname=if t_o.is==:heading and defined? t_o.name; t_o.name
else nil
end
else
diff --git a/lib/sisu/v3dv/xml_scaffold.rb b/lib/sisu/v3dv/xml_scaffold.rb
index 1ae31d0f..f43daacf 100644
--- a/lib/sisu/v3dv/xml_scaffold.rb
+++ b/lib/sisu/v3dv/xml_scaffold.rb
@@ -110,13 +110,13 @@ module SiSU_XML_Scaffold
def structure_outline(data)
puts "\ninfo outline --->\n\n"
data.each do |o|
- puts "#{o.ocn} #{o.ln} #{o.obj}" if o.is =~/^heading/
+ puts "#{o.ocn} #{o.ln} #{o.obj}" if (o.is ==:heading || o.is ==:heading_insert)
end
end
def structure_simple(data)
puts "\nheading outline --->\n\n"
data.each_with_index do |o,i|
- if o.is =~ /^heading/; puts "<#{@s[o.ln]}>#{o.ocn} #{o.ln} #{o.obj}#{@s[o.ln]}>"
+ if (o.is ==:heading || o.is ==:heading_insert); puts "<#{@s[o.ln]}>#{o.ocn} #{o.ln} #{o.obj}#{@s[o.ln]}>"
end
end
end
@@ -125,7 +125,7 @@ module SiSU_XML_Scaffold
h=[0,false,false,false]
puts "<#{@s[0]}>"
data.each_with_index do |o,i|
- if o.is =~/^heading/
+ if (o.is ==:heading || o.is ==:heading_insert)
case o.ln
when 1
structure_build_tag_close(o.ln,h)
--
cgit v1.2.3