From 7e3cee576368c095fe491014bd279eb280c598ba Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 3 Feb 2012 20:41:32 -0500 Subject: v3dv, dal +, use symbols to identify document objects type (is) and group (of) * (dal & code affected as a result) --- lib/sisu/v3dv/po4a.rb | 56 +++++++++++++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'lib/sisu/v3dv/po4a.rb') 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 -- cgit v1.2.3