diff options
author | Ralph Amissah <ralph@amissah.com> | 2011-10-31 21:47:10 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2011-10-31 21:47:10 -0400 |
commit | df67ba29ce1cb1b336177accedef6df3b09c32f5 (patch) | |
tree | 44e0d613bd5db99d867f02fcea5cfc9ce5b4d1a6 /data | |
parent | v3: concordance, information to terminal, minor (diff) |
v3: conf/convert/modify.rb minor fixes
Diffstat (limited to 'data')
-rw-r--r-- | data/doc/sisu/CHANGELOG_v3 | 2 | ||||
-rw-r--r-- | data/sisu/v3/conf/convert/modify.rb | 39 |
2 files changed, 33 insertions, 8 deletions
diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 4600fe26..8d5639f5 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -26,6 +26,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.1.2.orig.tar.xz * concordance, information to terminal, minor + * conf/convert/modify.rb minor fixes + %% 3.1.1.orig.tar.xz (2011-10-15:41/6) http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.1.1 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.1.1-1 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 _ |