diff options
author | Ralph Amissah <ralph@amissah.com> | 2010-03-17 15:43:23 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2010-03-17 15:43:23 -0400 |
commit | 3a05470820f9bc3a88eeb6eb97599a8eb895f325 (patch) | |
tree | cba8ea1ed592d7a3fb3c6199035d2caf6d985ce5 /lib/sisu/v2/plaintext.rb | |
parent | debian: NEWS.Debian, changelog, control, sisu.install, sisu.lintian-overrides... (diff) | |
parent | plaintext docoration (more flexible markings) (diff) |
Merge branch 'upstream' into debian/sid
Diffstat (limited to 'lib/sisu/v2/plaintext.rb')
-rw-r--r-- | lib/sisu/v2/plaintext.rb | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/lib/sisu/v2/plaintext.rb b/lib/sisu/v2/plaintext.rb index 4e7cb2f1..ddc82839 100644 --- a/lib/sisu/v2/plaintext.rb +++ b/lib/sisu/v2/plaintext.rb @@ -237,10 +237,14 @@ WOK times=wrapped.length times=78 if times > 78 @plaintext[:body] << case lv - when 1; wrapped.upcase << @br << '*'*times << @br - when 2..3; wrapped.upcase << @br << '='*times << @br - when 4; wrapped.upcase << @br << '-'*times << @br - when 5..6; wrapped.upcase << @br << '.'*times << @br + when 1; wrapped.upcase << @br << Px[:lv1]*times << @br + when 2; wrapped.upcase << @br << Px[:lv2]*times << @br + when 3; wrapped.upcase << @br << Px[:lv3]*times << @br + #when 2..3; wrapped.upcase << @br << Px[:lv2_3]*times << @br + when 4; wrapped.upcase << @br << Px[:lv4]*times << @br + when 5; wrapped.upcase << @br << Px[:lv5]*times << @br + when 6; wrapped.upcase << @br << Px[:lv6]*times << @br + #when 5..6; wrapped.upcase << @br << Px[:lv5_6]*times << @br end else @plaintext[:body] << wrapped << @br # main text, contents, body KEEP @@ -266,15 +270,23 @@ WOK fix=[] data.each do |dob| dob.obj.gsub!(/#{Mx[:gr_o]}Th?#{Mx[:tc_p]}.+/um,"#{@br}#{table_message}") #fix - dob.obj.gsub!(/.+?#{Mx[:gl_o]}-##{Mx[:gl_c]}/,'') # remove dummy headings (used by html) #check - dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'*\1*') - dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'/\1/') - dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'_\1_') - dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'[\1]') - dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^\1^') - dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'+\1+') - dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"') - dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'-\1-') + dob.obj.gsub!(/.+?#{Mx[:gl_o]}-##{Mx[:gl_c]}/,'') # remove dummy headings (used by html) #check also [~-]# + dob.obj.gsub!(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/, + "#{Px[:bold_o]}\\1#{Px[:bold_c]}") + dob.obj.gsub!(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/, + "#{Px[:italics_o]}\\1#{Px[:italics_c]}") + dob.obj.gsub!(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/, + "#{Px[:underscore_o]}\\1#{Px[:underscore_c]}") + dob.obj.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/, + "#{Px[:subscript_o]}\\1#{Px[:subscript_c]}") + dob.obj.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/, + "#{Px[:superscript_o]}\\1#{Px[:superscript_c]}") + dob.obj.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/, + "#{Px[:insert_o]}\\1#{Px[:insert_c]}") + dob.obj.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/, + "#{Px[:cite_o]}\\1#{Px[:cite_c]}") + dob.obj.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/, + "#{Px[:strike_o]}\\1#{Px[:strike_c]}") unless dob.is=='code' dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1') dob.obj.gsub!(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]') @@ -305,11 +317,11 @@ WOK dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _> _< dob.obj.gsub!(/(^|[^}])_([<>])/m,'\1\2') # _<_< end - dob.obj.gsub!(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,'') # remove page breaks + dob.obj.gsub!(/#{Mx[:br_page]}\s*|#{Mx[:br_page_new]}/,'') # remove page breaks dob.obj.gsub!(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1') dob.obj.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1') - dob.obj.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'') # remove name links - dob.obj.gsub!(/ |#{Mx[:nbsp]}/,' ') # decide on + dob.obj.gsub!(/#{Mx[:mk_o]}:name#(\S+?)#{Mx[:mk_c]}/,'') # remove name links + dob.obj.gsub!(/ |#{Mx[:nbsp]}/,' ') # decide on dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") dob.obj.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}image/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") dob.obj.gsub!(/(?:^|[^_\\])\{\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*\}\S+/,'[image: "\1"]') |