From 7322b33b2e7c958ab404c45cfb4c051b25da407f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Thu, 14 Feb 2008 03:00:29 +0000 Subject: for now render new markup syntax inactive --- lib/sisu/v0/dal.rb | 1 + lib/sisu/v0/dal_syntax.rb | 1 + lib/sisu/v0/shared_sem.rb | 110 +++++++++++++++++++++++++++++++++++++++ lib/sisu/v0/sst_to_s_xml_dom.rb | 2 + lib/sisu/v0/sst_to_s_xml_node.rb | 2 + lib/sisu/v0/sst_to_s_xml_sax.rb | 2 + 6 files changed, 118 insertions(+) create mode 100644 lib/sisu/v0/shared_sem.rb (limited to 'lib') diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index e31dba69..5edc77be 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -65,6 +65,7 @@ module SiSU_DAL require "#{SiSU_lib}/dal_syntax" require "#{SiSU_lib}/dal_doc_str" require "#{SiSU_lib}/i18n" + require "#{SiSU_lib}/shared_sem" include SiSU_Env include SiSU_Param include SiSU_Viz diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb index 4224973d..a6c48af0 100644 --- a/lib/sisu/v0/dal_syntax.rb +++ b/lib/sisu/v0/dal_syntax.rb @@ -109,6 +109,7 @@ module Syntax end def pre(line) line=line.dup + line=SiSU_sem::Tags.new(line).rm.all if line =~/\{(?:t|table)(?:~h)?\s*c?[\d; ]*\}/; line.gsub!(/(\n)/,';;\1') #markup for alternative tables end line diff --git a/lib/sisu/v0/shared_sem.rb b/lib/sisu/v0/shared_sem.rb new file mode 100644 index 00000000..da989999 --- /dev/null +++ b/lib/sisu/v0/shared_sem.rb @@ -0,0 +1,110 @@ +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + Sematic tags + + * Author: Ralph Amissah + + * Copyright: (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007, + 2008 Ralph Amissah All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, + 2007 Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see . + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + + + + + + + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + + + + * Download: + + + * Ralph Amissah + + + + ** Description: system environment, resource control and configuration details + +=end +module SiSU_sem + class Tags + def initialize(para) + @para=para + end + def rgx + def each_csc + /[a-z]+[:;]\{|\}[:;][a-z]+/ + end + def each_c + /[a-z]+:\{|\}:[a-z]+/ + end + def each_sc + /[a-z]+;\{|\};[a-z]+/ + end + def pair_csc + /(([a-z]+)(?::\{(.+?)\}:\2|;\{(.+?)\};\2))/ + #/(([a-z]+);\{(.+?)\};\2)/ + #/(([a-z]+)([:;])\{(.+?)\}\3\2)/ + end + def pair_c + /(([a-z]+):\{(.+?)\}:\2)/ + end + def pair_sc + /(([a-z]+);\{.+?\};\2)/ + end + def whole_csc_ae + /(([a-z]+)(?::\[(.+?)\]:\2|;\[(.+?)\];\2))/ + end + self + end + def rm + def sem_marker_parts + @para.gsub!(rgx.each_csc,'') + @para + end + def sem_marker_added_extra_parts + @para.gsub!(rgx.whole_csc_ae,'') + @para + end + def all + sem_marker_parts + sem_marker_added_extra_parts + end + self + end + end +end +__END__ diff --git a/lib/sisu/v0/sst_to_s_xml_dom.rb b/lib/sisu/v0/sst_to_s_xml_dom.rb index 355cef2b..a1c81532 100644 --- a/lib/sisu/v0/sst_to_s_xml_dom.rb +++ b/lib/sisu/v0/sst_to_s_xml_dom.rb @@ -66,6 +66,7 @@ module SiSU_simple_xml_model_dom include SiSU_Env require "#{SiSU_lib}/dal_doc_str" require "#{SiSU_lib}/shared_xml" + require "#{SiSU_lib}/shared_sem" require "#{SiSU_lib}/xml_format" include SiSU_XML_format include SiSU_XML_munge @@ -355,6 +356,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 wordlist=para.scan(/\S+|\n/) #\n needed for tables, check though added 2005w17 para=tidywords(wordlist).join(' ').strip para.gsub!(/<[-~]#>/,'') diff --git a/lib/sisu/v0/sst_to_s_xml_node.rb b/lib/sisu/v0/sst_to_s_xml_node.rb index 346b48fa..b6d7c9b2 100644 --- a/lib/sisu/v0/sst_to_s_xml_node.rb +++ b/lib/sisu/v0/sst_to_s_xml_node.rb @@ -67,6 +67,7 @@ module SiSU_simple_xml_model_node require "#{SiSU_lib}/dal_syntax" require "#{SiSU_lib}/dal_doc_str" require "#{SiSU_lib}/shared_xml" + require "#{SiSU_lib}/shared_sem" require "#{SiSU_lib}/xml_format" include SiSU_XML_format include SiSU_XML_munge @@ -398,6 +399,7 @@ WOK @data=@data.join.split("\n\n") @data=SiSU_document_structure::Code.new(@md,@data).code @data.each do |para| + para=SiSU_sem::Tags.new(para).rm.all data << SiSU_document_structure::Structure.new(@md,para).structure end data=Syntax::Markup.new(@md,data).songsheet diff --git a/lib/sisu/v0/sst_to_s_xml_sax.rb b/lib/sisu/v0/sst_to_s_xml_sax.rb index 0528bc09..5e4eb5ea 100644 --- a/lib/sisu/v0/sst_to_s_xml_sax.rb +++ b/lib/sisu/v0/sst_to_s_xml_sax.rb @@ -66,6 +66,7 @@ module SiSU_simple_xml_model_sax include SiSU_Env require "#{SiSU_lib}/dal_doc_str" require "#{SiSU_lib}/shared_xml" + require "#{SiSU_lib}/shared_sem" require "#{SiSU_lib}/xml_format" include SiSU_XML_format include SiSU_XML_munge @@ -261,6 +262,7 @@ WOK data << SiSU_document_structure::Structure.new(@md,para).structure end data.each do |para| + para=SiSU_sem::Tags.new(para).rm.all para=@trans.markup_light(para) @trans.char_enc.utf8(para) if @sys.locale =~/utf-?8/i #% utf8 if para =~/\A(?:@|0~)(\S+?):?\s+(.+?)\Z/m # for headers -- cgit v1.2.3