aboutsummaryrefslogtreecommitdiffhomepage
path: root/data/sisu/v3/conf/convert/modify.rb
diff options
context:
space:
mode:
Diffstat (limited to 'data/sisu/v3/conf/convert/modify.rb')
-rw-r--r--data/sisu/v3/conf/convert/modify.rb39
1 files changed, 31 insertions, 8 deletions
diff --git a/data/sisu/v3/conf/convert/modify.rb b/data/sisu/v3/conf/convert/modify.rb
index 5f4f9ae0..858ffe08 100644
--- a/data/sisu/v3/conf/convert/modify.rb
+++ b/data/sisu/v3/conf/convert/modify.rb
@@ -1,4 +1,5 @@
#!/usr/bin/env ruby
+# encoding: utf-8
=begin
* Name: modify.rb
* Author: Ralph Amissah
@@ -51,6 +52,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 +95,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 +172,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 +213,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 +229,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 +265,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 _