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/dal_syntax.rb | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'lib/sisu/v3dv/dal_syntax.rb') diff --git a/lib/sisu/v3dv/dal_syntax.rb b/lib/sisu/v3dv/dal_syntax.rb index a8ece51e..73bb6a64 100644 --- a/lib/sisu/v3dv/dal_syntax.rb +++ b/lib/sisu/v3dv/dal_syntax.rb @@ -135,7 +135,10 @@ module SiSU_DAL_Syntax dob=SiSU_Sem::Tags.new(dob,@md).rm.all end def breaks(dob) - if dob.is !~/^(?:meta|comment|code|table)/ + if dob.is !=:meta \ + && dob.is !=:comment \ + && dob.is !=:code \ + && dob.is !=:table dob.obj=dob.obj.gsub(/ \\\\(?: |$)/,"#{Mx[:br_line]}"). gsub(/(?:<:?br>|
)/,"#{Mx[:br_line]}") # depreciated end @@ -147,7 +150,11 @@ module SiSU_DAL_Syntax and @md.make.italics[:str]) \ or (defined? @vz.markup_make_italic[:str] \ and @vz.markup_make_italic[:str]) - dob.obj=if dob.is !~/^(?:meta|heading|code|comment)/ + dob.obj=if dob.is !=:meta \ + && dob.is !=:heading \ + && dob.is !=:heading_insert \ + && dob.is !=:code \ + && dob.is !=:comment word=dob.obj.scan(@line_scan_ital) word=word.flatten.compact line_array=[] @@ -202,7 +209,12 @@ module SiSU_DAL_Syntax and @md.make.bold[:str]) \ or (defined? @vz.markup_make_bold[:str] \ and @vz.markup_make_bold[:str]) - dob.obj=if dob.is !~/^(?:meta|heading|code|comment|table)/ + dob.obj=if dob.is !=:meta \ + && dob.is !=:heading \ + && dob.is !=:heading_insert \ + && dob.is !=:code \ + && dob.is !=:comment \ + && dob.is !=:table line_array=[] word=dob.obj.scan(@line_scan_bold) word=word.flatten.compact @@ -227,10 +239,13 @@ module SiSU_DAL_Syntax else dob.obj end else - dob.obj=if dob.is !~/^(?:heading|comment|meta)/ \ + dob.obj=if (dob.is !=:heading \ + && dob.is !=:heading_insert \ + && dob.is !=:comment \ + && dob.is !=:meta) \ and dob.obj =~ /^!_\s+/ embolden(dob.obj) - elsif dob.is=='heading' \ + elsif dob.is==:heading \ and dob.ln.to_s =~/[7-9]/ embolden(dob.obj) else dob.obj @@ -297,7 +312,10 @@ module SiSU_DAL_Syntax # # #numbered (list) level 1 # _# #numbered (list) level 2 dob=dob.dup - if dob.is !~/^(?:meta|comment|code|table)/ + if dob.is !=:meta \ + && dob.is !=:comment \ + && dob.is !=:code \ + && dob.is !=:table line_array=[] word=dob.obj.scan(/\S+|\n/) #unless line =~/^(?:#{Mx[:meta_o]}|%+\s)/ #visit if word @@ -315,7 +333,7 @@ module SiSU_DAL_Syntax gsub(/~\{(.+?)\}~/m,Mx[:en_a_o] + '\1' + Mx[:en_a_c]). gsub(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]). #default if markup does not specify gsub(/~\[(.+?)\]~/m,Mx[:en_b_o] + '\1' + Mx[:en_b_c]) - if dob.is =='heading' \ + if dob.is ==:heading \ and dob.ln ==1 dob.obj=dob.obj.gsub(/\s*@title\b/," #{@md.title.full}") dob.obj=if defined? @md.creator.author \ @@ -329,7 +347,7 @@ module SiSU_DAL_Syntax and defined? @md.title.full \ and defined? @md.creator \ and @md.creator - if dob.is =='heading' + if dob.is ==:heading dob.obj=dob.obj.gsub(/^\s*@title\s*$/,@md.title.full) if dob.lv =~/1/ dob.obj=if dob.lv =~/[23]/ \ and defined? @md.creator.author \ @@ -426,9 +444,9 @@ module SiSU_DAL_Syntax "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2"). #any remaining linked text or image, check need gsub(/\{\s*(.+?)\s*\}(image)/, "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked image - elsif dob.is=='table' + elsif dob.is==:table dob=fontface(dob) - elsif dob.is =='code' + elsif dob.is ==:code dob.obj=dob.obj.gsub(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: '). gsub(/(^|#{Mx[:gl_c]}|\s)<(br(?: \/)?)>([\s,.]|$)/,'\1<\2>\3') #convert

back, clumsy if dob.number_ -- cgit v1.2.3