diff options
Diffstat (limited to 'lib/sisu/v4/dal_syntax.rb')
-rw-r--r-- | lib/sisu/v4/dal_syntax.rb | 55 |
1 files changed, 26 insertions, 29 deletions
diff --git a/lib/sisu/v4/dal_syntax.rb b/lib/sisu/v4/dal_syntax.rb index fba2e765..b62fbad8 100644 --- a/lib/sisu/v4/dal_syntax.rb +++ b/lib/sisu/v4/dal_syntax.rb @@ -63,15 +63,15 @@ module SiSU_DAL_Syntax end class Markup def initialize(md='',data='') - @data,@md=data,md + @md,@data=md,data @vz=SiSU_Viz::Defaults.new @data_new=[] url_and_stub=SiSU_Env::InfoEnv.new.url @output_url="#{url_and_stub.remote}" @env=SiSU_Env::InfoEnv.new - emph_set=if defined? @md.make.emphasis \ - and not @md.make.emphasis.nil? - @md.make.emphasis + emph_set=if defined? @md.emphasis_set_to \ + and not @md.emphasis_set_to.nil? + @md.emphasis_set_to else @env.markup_emphasis end @emph=case emph_set @@ -94,25 +94,22 @@ module SiSU_DAL_Syntax tail_m_bold=%{(?:(?:#{Mx[:fa_italics_c]})?(?:\s|[.,;:?!'")]|~\^|~\\\{\s|$))?} bold_line=%{^!_\s.+?(?:#{Mx[:br_line]}|\n|$)} ital_line=%{^/_\s.+?(?:#{Mx[:br_line]}|\n|$)} - @line_scan_ital=if defined? @md.make.italics[:str] \ - and defined? @vz.markup_make_italic[:str] - /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|(?:#{@md.make.italics[:str]}|#{@vz.markup_make_italic[:str]})#{tail_m_ital}|\S+|\n/i - elsif defined? @md.make.italics[:str] - /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@md.make.italics[:str]}#{tail_m_ital}|\S+|\n/i + @line_scan_ital=if defined? @md.italics_match_list[:str] + /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@md.italics_match_list[:str]}#{tail_m_ital}|\S+|\n/i elsif defined? @vz.markup_make_italic[:str] /#{@http_m}|#{bold_line}|#{@manmkp_ital}#{tail_m_ital}|#{@vz.markup_make_italic[:str]}#{tail_m_ital}|\S+|\n/i end @manmkp_bold=emph_italics \ ? '^!_\s.+?(?:\n|$)|[!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[!]' : '^!_\s.+?(?:\n|$)|[*!b]\\{.+?\\}[*!b]|[*!][a-zA-Z0-9\-_]+[*!]' - @line_scan_bold=if (defined? @md.make.bold[:str] \ - and @md.make.bold[:str]) \ + @line_scan_bold=if (defined? @md.bold_match_list[:str] \ + and @md.bold_match_list[:str]) \ and (defined? @vz.markup_make_bold[:str] \ and @vz.markup_make_bold[:str]) - /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.make.bold[:str]}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/i - elsif defined? @md.make.bold[:str] \ - and @md.make.bold[:str] - /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.make.bold[:str]})#{tail_m_bold}|\S+|\n/i + /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.bold_match_list[:str]}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/i + elsif defined? @md.bold_match_list[:str] \ + and @md.bold_match_list[:str] + /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@md.bold_match_list[:str]})#{tail_m_bold}|\S+|\n/i elsif defined? @vz.markup_make_bold[:str] \ and @vz.markup_make_bold[:str] /#{@http_m}|#{bold_line}|(?:#{@manmkp_bold}|#{@vz.markup_make_bold[:str]})#{tail_m_bold}|\S+|\n/i @@ -152,8 +149,8 @@ module SiSU_DAL_Syntax end def wordlist_italics(dob) dob=dob.dup - if (defined? @md.make.italics[:str] \ - and @md.make.italics[:str]) \ + if (defined? @md.italics_match_list[:str] \ + and @md.italics_match_list[:str]) \ or (defined? @vz.markup_make_italic[:str] \ and @vz.markup_make_italic[:str]) dob.obj=if dob.is !=:meta \ @@ -166,9 +163,9 @@ module SiSU_DAL_Syntax line_array=[] word.each do |w| unless /#{@manmkp_ital}|#{@http_m}/.match(w) - if defined? @md.make.italics[:regx] \ - and @md.make.italics[:regx] - w=w.gsub(@md.make.italics[:regx], + if defined? @md.italics_match_list[:regx] \ + and @md.italics_match_list[:regx] + w=w.gsub(@md.italics_match_list[:regx], "#{Mx[:fa_italics_o]}\\1#{Mx[:fa_italics_c]}") elsif defined? @vz.markup_make_italic \ and @vz.markup_make_italic @@ -237,15 +234,15 @@ module SiSU_DAL_Syntax end def substitutions(dob) dob=dob.dup - dob=if defined? @md.make.substitute[:match_and_replace] \ - and @md.make.substitute[:match_and_replace].is_a?(Array) + dob=if defined? @md.substitution_match_list[:match_and_replace] \ + and @md.substitution_match_list[:match_and_replace].is_a?(Array) dob=if dob.is !=:meta \ && dob.is !=:heading_insert \ && dob.is !=:code \ && dob.is !=:comment \ && dob.is !=:table - if dob.obj =~/#{@md.make.substitute[:matches]}/ - @md.make.substitute[:match_and_replace].each do |x| + if dob.obj =~/#{@md.substitution_match_list[:matches]}/ + @md.substitution_match_list[:match_and_replace].each do |x| dob.obj=if x[:case_s]==:i dob.obj.gsub(/#{x[:match]}/mi,x[:replace]) else @@ -262,8 +259,8 @@ module SiSU_DAL_Syntax end def wordlist_bold(dob) dob=dob.dup - if (defined? @md.make.bold[:str] \ - and @md.make.bold[:str]) \ + if (defined? @md.bold_match_list[:str] \ + and @md.bold_match_list[:str]) \ or (defined? @vz.markup_make_bold[:str] \ and @vz.markup_make_bold[:str]) dob.obj=if dob.is !=:meta \ @@ -277,9 +274,9 @@ module SiSU_DAL_Syntax word=word.flatten.compact word.each do |w| unless /#{@manmkp_bold}|#{@http_m}/.match(w) - if defined? @md.make.bold[:regx] \ - and @md.make.bold[:regx] #document header: @bold: [bold word list] - w=w.gsub(@md.make.bold[:regx],"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") + if defined? @md.bold_match_list[:regx] \ + and @md.bold_match_list[:regx] #document header: @bold: [bold word list] + w=w.gsub(@md.bold_match_list[:regx],"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") elsif defined? @vz.markup_make_bold \ and @vz.markup_make_bold #defaults adjusted bold word list w=w.gsub(@vz.markup_make_bold,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}") |