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/shared_markup_alt.rb | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) (limited to 'lib/sisu/v3dv/shared_markup_alt.rb') 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) -- cgit v1.2.3