From 3ca7f281d098dcc96ad89dba85839764856ac703 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 11 Oct 2010 22:27:20 -0400 Subject: sisu_convert, basic conversion script, preliminary fix --- CHANGELOG_v2 | 3 ++ data/doc/sisu/v2/CHANGELOG | 3 ++ data/sisu/v2/conf/convert/sisu_convert | 72 +++++++++++++++++----------------- 3 files changed, 42 insertions(+), 36 deletions(-) diff --git a/CHANGELOG_v2 b/CHANGELOG_v2 index 77e66fd0..16fabd8a 100644 --- a/CHANGELOG_v2 +++ b/CHANGELOG_v2 @@ -18,6 +18,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_2.7.6.orig.tar.gz sisu_2.7.6-1.dsc sisu_2.7.6-1.diff.gz + * sisu_convert, basic conversion script (seldom used/tested) start to get it + working again + * CHANGELOG v2 recount where some requests came from %% 2.7.5.orig.tar.gz (2010-10-09:40/6) diff --git a/data/doc/sisu/v2/CHANGELOG b/data/doc/sisu/v2/CHANGELOG index 1415cd46..c70db845 100644 --- a/data/doc/sisu/v2/CHANGELOG +++ b/data/doc/sisu/v2/CHANGELOG @@ -18,6 +18,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_2.7.6.orig.tar.gz sisu_2.7.6-1.dsc sisu_2.7.6-1.diff.gz + * sisu_convert, basic conversion script (seldom used/tested) start to get it + working again + * CHANGELOG v2 recount where some requests came from %% 2.7.5.orig.tar.gz (2010-10-09:40/6) diff --git a/data/sisu/v2/conf/convert/sisu_convert b/data/sisu/v2/conf/convert/sisu_convert index 7be075fc..a3a12189 100644 --- a/data/sisu/v2/conf/convert/sisu_convert +++ b/data/sisu/v2/conf/convert/sisu_convert @@ -8,16 +8,12 @@ # * Name: SiSU information Structuring Universe # * Author: Ralph@Amissah.com # * Description: document conversion tool, to sisu from other formats -# * arch-tag: document conversion tool to sisu markup -# * $Date: 2004/10/16 15:51:06 $ -# * $Id: sisu_convert,v 1.37 2004/10/16 15:51:06 ralph Exp $ # * License: GPL 3 or later # * Notes: word conversion uses wvWare and wvSiSU.xml (a modified/stripped wvHtml.xml) # * http://wvware.sourceforge.net/ # * http://sourceforge.net/projects/wvware # * |sisu.lnk|@|^| # * -# * |zxy_param.rb|@|^| module CONVERT class MyOutput def initialize(data, filename, instruct) @@ -27,47 +23,45 @@ module CONVERT end def headerBasic <(Chapter|Article)(.+?)<\/b>/i,'4~ \1 \2') #watch case insensitivity - para.gsub!(/^(Part|Section|Book)(.+?)<\/b>/i,'3~ \1 \2') #watch case insensitivity - para.gsub!(/^(\d+\.\d+\.\d+\.?)(.+?)<\/b>/i,'6~ \1 \2') #numeric, decide what to do, can be different - para.gsub!(/^(\d+\.\d+\.?)(.+?)<\/b>/i,'5~ \1 \2') #numeric, decide what to do, can be different + para.gsub!(/^(Chapter|Article)(.+?)<\/b>/i,'1~ \1 \2') #watch case insensitivity + para.gsub!(/^(Part|Section|Book)(.+?)<\/b>/i,':C~ \1 \2') #watch case insensitivity + para.gsub!(/^(\d+\.\d+\.\d+\.?)(.+?)<\/b>/i,'3~ \1 \2') #numeric, decide what to do, can be different + para.gsub!(/^(\d+\.\d+\.?)(.+?)<\/b>/i,'2~ \1 \2') #numeric, decide what to do, can be different para.gsub!(/^(\d.+?)<\/b>/i,'4~ \1 \2') #numeric, decide what to do, can be different #para.gsub!(/^([\d.]+?)<\/b>/i,'4~ \1 \2') #numeric, decide what to do, can be different para.gsub!(/(.+?)<\/u>/,'_{\1}_') - para.gsub!(/(.+?)<\/b>/,'*{\1}*') + para.gsub!(/(.+?)<\/b>/,'!{\1}!') para.gsub!(/(.+?)<\/i>/,'/{\1}/') tuned_file << para unless para == nil end @@ -468,14 +462,19 @@ def do_word(argv, instruct) end def do_html(argv, instruct) argv.each do |f| - if f =~/.+?\.html$/ - @argv << f[/(.+?)\.html$/, 1] + if f =~/.+?\.html?$/ + @argv << f[/(.+?)\.html?$/, 1] else print "not .html? << #{f} >> " end end @argv.each do |filename| - file_array=IO.readlines("#{filename}.html","\n\r") + file_end=if FileTest.file?("#{filename}.html") + 'html' + elsif FileTest.file?("#{filename}.htm") + 'htm' + end + file_array=IO.readlines("#{filename}.#{file_end}","\n\r") CONVERT::Html.new(file_array,filename,instruct).songsheet # metaverse created here end end @@ -505,13 +504,14 @@ def cases(argv, instruct) end end $KCODE='u' -branch='v0' -SiSU_lib="sisu/#{branch}" +branch='v2' +@argv=Array.new +argv=$* +SiSU_version_dir=(argv.inspect=~/--v1/) ? 'v1' : 'v2' +SiSU_lib="sisu/#{SiSU_version_dir}" require "#{SiSU_lib}/sysenv" include SiSU_Env @dir=SiSU_Env::Info_env.new -@argv=Array.new -argv=$* instruct = "#{argv[0].to_s}" argv.shift instruct.chomp! -- cgit v1.2.3