diff options
author | Ralph Amissah <ralph@amissah.com> | 2012-01-10 22:27:33 -0500 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2012-01-10 22:27:33 -0500 |
commit | 9d687db126f64614d5ef05bf51e43429e7c03bd7 (patch) | |
tree | e7981baf6eca76bd82480701ae928289b665c2eb /data/sisu/v2/conf | |
parent | v2 v3: 3.1.11 version & changelog "opened" (diff) |
v2: modify, sisu markup version script (take from v3)
Diffstat (limited to 'data/sisu/v2/conf')
-rw-r--r-- | data/sisu/v2/conf/convert/modify.rb | 44 |
1 files changed, 33 insertions, 11 deletions
diff --git a/data/sisu/v2/conf/convert/modify.rb b/data/sisu/v2/conf/convert/modify.rb index 5f4f9ae0..c3fe47c9 100644 --- a/data/sisu/v2/conf/convert/modify.rb +++ b/data/sisu/v2/conf/convert/modify.rb @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# encoding: utf-8 =begin * Name: modify.rb * Author: Ralph Amissah @@ -36,13 +37,12 @@ http://www.gnu.org/copyleft/gpl.html http://www.jus.uio.no/sisu/gpl3.fsf - © Ralph Amissah 1997, current 2006. - All Rights Reserved. + (C) Ralph Amissah 1997, current 2009. + All Rights Reserved. * Ralph Amissah: ralph@amissah.com ralph.amissah@gmail.com - * Notes: configure rc in ~/.sisu/sisurc.yaml =end module SiSU_Modify class Convert_markup @@ -51,6 +51,7 @@ module SiSU_Modify @description="This is a script that contains canned text conversions for reuse" end def current_match_and_replace #Disable, edit manually + clean_non_regular_characters #convert_pre_37_to_38_experimental end def message(text) @@ -93,6 +94,27 @@ WOK exit end #%% substitutions to be made + def clean_non_regular_characters + #/[^ a-zA-Z0-9,.!?;:/={}()%@#~\[\]"'´&$_+^-] + #/[^ a-zA-Z0-9,.!?;:/={}()%@#~\[\]"'´&$_+^•’‘`“”–ffifffflfifl-] + #message(%w{[^ a-zA-Z0-9,.!?;:/={}()%@#~\[\]"'´&$_+^-]}) + message(%q{clean non regular characters}) + [ + [/’/, "'"], + [/‘/, "'"], + [/´/, "'"], + [/`/, "'"], + [/[“”]/, '"'], + [/–/, '-'], + [/ff/, 'ff'], + [/ffi/, 'ffi'], + [/ffl/, 'ffl'], + [/fi/, 'fi'], + [/fl/, 'fl'], + [/^•/, '_* '], + [/•/, '*'] + ] + end def convert_pre_37_to_38_experimental message('convert sisu markup from 0.37 to 0.38 experimental (rad)') [ @@ -149,13 +171,13 @@ WOK p @files mr=nil #%% changes to make m match, r replace --------------------------> - if @cf =~/--help/: help + if @cf =~/--help/; help else message("WARNING, proceed at your own risk,\npermanent changes requested for the above named files\n best that you check (manually) what this file is set to do\n conversions set are at the top of the file") mr=case @cf - when /--convert|default/: current_match_and_replace - when /--(?:(?:37)?to38|rad)/: convert_pre_37_to_38_experimental - when /--(?:(?:38)?to37)/: convert_38_experimental_to_37 + when /--convert|default/; current_match_and_replace + when /--(?:(?:37)?to38|rad)/; convert_pre_37_to_38_experimental + when /--(?:(?:38)?to37)/; convert_38_experimental_to_37 else help end end @@ -190,7 +212,7 @@ WOK puts "match in #{i}" @flag_start=true cont.each do |y| - if y =~end_processing: @flag_end=true + if y =~end_processing; @flag_end=true end if @flag_start and not @flag_end match_and_replace.each do |m,r| @@ -206,11 +228,11 @@ WOK #end #if y =~m1 #end - if y=~/^\s*$/: @empty1=true + if y=~/^\s*$/; @empty1=true else @empty1=false end @file.puts y unless (@empty1==true and @empty2==true) - if y=~/^\s*$/: @empty2=true + if y=~/^\s*$/; @empty2=true else @empty2=false end #@file << y + "\n" @@ -242,7 +264,7 @@ match_and_replace=Array.new #WOK # exit #end -unless f.length > 0: f=Dir.glob("[a-z]*.ss?") #restricted to sisu type files, it need not be +unless f.length > 0; f=Dir.glob("[a-z]*.ss?") #restricted to sisu type files, it need not be end #f=Dir.glob("{bin,conf,data,lib}/**/*.rb") #sisu development #f=Dir.glob("[^_]/**/*") #all files subdirectories beneath pwd except those starting with _ |