From ec9282e23d3262a2746f9837e0bc57e9aa7a48d5 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Sun, 24 Feb 2008 21:05:47 +0000 Subject: enable conversion from sst to various forms of input xml and back including 0.66 tags sst_to_s_xml (sax/dom/node) semantic xml mockup naive conversion of known abbreviated tags, in flux, e.g. sisu --to-sax autonomy_markup0.sst back to sst markup with: sisu --from-sxml autonomy_markup0.sxs.xml sst_to_s_dom fix to footnote/endnote conversion --- lib/sisu/v0/sst_to_s_xml_dom.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'lib/sisu/v0/sst_to_s_xml_dom.rb') diff --git a/lib/sisu/v0/sst_to_s_xml_dom.rb b/lib/sisu/v0/sst_to_s_xml_dom.rb index a1c81532..f9c190bf 100644 --- a/lib/sisu/v0/sst_to_s_xml_dom.rb +++ b/lib/sisu/v0/sst_to_s_xml_dom.rb @@ -1,3 +1,4 @@ +# coding: utf-8 =begin * Name: SiSU @@ -161,7 +162,7 @@ module SiSU_simple_xml_model_dom para.gsub!(/~\{([*+]+)\s+(.+?)\}~/, '\1\2 ') para.gsub!(/~\{(.+?)\}~/, - '\2 ') + '\1 ') end def xml_head(meta) txt=meta.text @@ -356,7 +357,7 @@ WOK (0..6).each { |x| @cont[x]=@level[x]=false } (4..6).each { |x| @xml_contents_close[x]='' } data.each do |para| - para=SiSU_sem::Tags.new(para).rm.all + #para=SiSU_sem::Tags.new(para,@md).rm.all wordlist=para.scan(/\S+|\n/) #\n needed for tables, check though added 2005w17 para=tidywords(wordlist).join(' ').strip para.gsub!(/<[-~]#>/,'') @@ -546,10 +547,19 @@ WOK include SiSU_Env def initialize(data,md) @data,@md=data,md + @trans=SiSU_XML_munge::Trans.new(@md) end def xml @sisu=[] @data.each do |para| + if para !~/^\s*(?:%+ |<:code>)/ + if @md.sem_tag and para =~/[:;]\{|\}[:;]/ + para=@trans.xml_semantic_tags(para) + end + if para =~/[:;]\{|\}[:;]/ + para=SiSU_sem::Tags.new(para,@md).rm.all + end + end para.gsub!(/\/\{(.+?)\}\//,'\1') para.gsub!(/\*\{(.+?)\}\*/,'\1') para.gsub!(/!\{(.+?)\}!/,'\1') -- cgit v1.2.3