From 2708d32e438edcddabdc6d62fc6898cbbe07f2a9 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sat, 1 May 2010 08:58:49 -0400 Subject: *{emphasis}* display configurable as being bold, italics or underscore * markup for *{emphasis}* configurable as being displayed as bold, italics or underscore, the default is that emphasis output is in bold so there is no change unless configured, either in sisurc.yml (default: emphasis: 'bold'), or the markup source document header @make: :emphasis: 'bold' --- lib/sisu/v2/dal_syntax.rb | 23 +++++++++++++++++------ lib/sisu/v2/param.rb | 8 +++++--- lib/sisu/v2/sysenv.rb | 19 ++++++++++++++----- 3 files changed, 36 insertions(+), 14 deletions(-) diff --git a/lib/sisu/v2/dal_syntax.rb b/lib/sisu/v2/dal_syntax.rb index 59620856..2b1da084 100644 --- a/lib/sisu/v2/dal_syntax.rb +++ b/lib/sisu/v2/dal_syntax.rb @@ -70,12 +70,23 @@ module SiSU_Syntax url_and_stub=SiSU_Env::Info_env.new.url @output_url="#{url_and_stub.remote}" @env=SiSU_Env::Info_env.new - emph_italics=((@env.markup_emphasis =~/italics/) \ - || (defined? @md.make.emphasis && @md.make.emphasis =~/italics/)) \ - ? true : false - @emph=emph_italics \ - ? ({:o =>Mx[:fa_italics_o], :c =>Mx[:fa_italics_c] }) \ - : ({:o =>Mx[:fa_bold_o], :c =>Mx[:fa_bold_c] }) + emph_set=if defined? @md.make.emphasis \ + and not @md.make.emphasis.nil? + @md.make.emphasis + else @env.markup_emphasis + end + @emph=case emph_set + when /bold/ + emph_italics=false + {:o =>Mx[:fa_bold_o], :c =>Mx[:fa_bold_c] } + when /italics/ + emph_italics=true + {:o =>Mx[:fa_italics_o], :c =>Mx[:fa_italics_c] } + when /underscore/ + emph_italics=false + {:o =>Mx[:fa_underscore_o], :c =>Mx[:fa_underscore_c] } + else p __LINE__.to_s + '::' + __FILE__ + end @http_m=%r{\{.+?\}https?://\S+|https?:\S+|\.\.\/\S+|\S+?\.png\b|[*]~\S+|^#{Mx[:meta_o]}.+|#{Mx[:gr_o]}(?:code|group|alt|verse)(?:-end)?#{Mx[:gr_c]}|#{Mx[:fa_o]}:br#{Mx[:fa_c]}} @manmkp_ital=emph_italics \ ? '[i/*]\\{.+?\\}[i/*]' \ diff --git a/lib/sisu/v2/param.rb b/lib/sisu/v2/param.rb index c2ee0737..5df8271e 100644 --- a/lib/sisu/v2/param.rb +++ b/lib/sisu/v2/param.rb @@ -658,9 +658,11 @@ module SiSU_Param { :str =>'\b(?:' + m + ')\b', :regx => y } end def emphasis - (@h['emphasis'] =~/italics?/) \ - ? 'italics' \ - : 'bold' + if @h['emphasis'] =~/bold/; 'bold' + elsif @h['emphasis'] =~/italics?/; 'italics' + elsif @h['emphasis'] =~/under(?:line|score)/; 'underscore' + else nil + end end def plaintext_wrap if @h['plaintext_wrap'].to_s =~/\d\d+/ \ diff --git a/lib/sisu/v2/sysenv.rb b/lib/sisu/v2/sysenv.rb index 4a2f7ee0..5f3695de 100644 --- a/lib/sisu/v2/sysenv.rb +++ b/lib/sisu/v2/sysenv.rb @@ -876,11 +876,20 @@ module SiSU_Env : (defaults[:concord_max]) end def markup_emphasis - ((defined? @rc['default']['emphasis']) \ - && @rc['default']['emphasis'] \ - && (@rc['default']['emphasis']=~/italic/)) \ - ? 'italics' \ - : 'bold' + if defined? @rc['default']['emphasis'] \ + and @rc['default']['emphasis'] \ + and @rc['default']['emphasis']=~/bold/ + 'bold' + elsif defined? @rc['default']['emphasis'] \ + and @rc['default']['emphasis'] \ + and @rc['default']['emphasis']=~/italic/ + 'italics' + elsif defined? @rc['default']['emphasis'] \ + and @rc['default']['emphasis'] \ + and @rc['default']['emphasis']=~/underscore/ + 'underscore' + else 'bold' + end end def plaintext_wrap ((defined? @rc['default']['text_wrap']) \ -- cgit v1.2.3