aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v0
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v0')
-rw-r--r--lib/sisu/v0/dal.rb1
-rw-r--r--lib/sisu/v0/dal_syntax.rb1
-rw-r--r--lib/sisu/v0/help.rb11
-rw-r--r--lib/sisu/v0/shared_sem.rb110
-rw-r--r--lib/sisu/v0/sst_identify_markup.rb126
-rw-r--r--lib/sisu/v0/sst_to_s_xml_dom.rb2
-rw-r--r--lib/sisu/v0/sst_to_s_xml_node.rb2
-rw-r--r--lib/sisu/v0/sst_to_s_xml_sax.rb2
8 files changed, 206 insertions, 49 deletions
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/help.rb b/lib/sisu/v0/help.rb
index c4037431..35448cd6 100644
--- a/lib/sisu/v0/help.rb
+++ b/lib/sisu/v0/help.rb
@@ -1548,14 +1548,17 @@ WOK
sisu --help header
sisu --help structure [sisu --help heading]
- for older standard markup:
- sisu --help example37
+ to check markup version in file:
+ sisu --identify [filename].sst
+
+ for brief descriptive summary of markup history
+ sisu --query-history
+ or if for a particular version
+ sisu --query-0.38
for markup:
sisu --help example38
- sisu-0.38 is provided with 0.38 markup samples
-
sample marked up documents are provided in directory:
#{@cX.green}sisu-examples/sample/document_samples_sisu_markup/#{@cX.off}
and online
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 <http://www.gnu.org/licenses/>.
+
+ If you have Internet connection, the latest version of the GPL should be
+ available at these locations:
+ <http://www.fsf.org/licensing/licenses/gpl.html>
+ <http://www.gnu.org/copyleft/gpl.html>
+
+ <http://www.jus.uio.no/sisu/gpl.fsf/toc.html>
+ <http://www.jus.uio.no/sisu/gpl.fsf/doc.html>
+ <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt>
+
+ * SiSU uses:
+ * Standard SiSU markup syntax,
+ * Standard SiSU meta-markup syntax, and the
+ * Standard SiSU object citation numbering and system
+
+ * Hompages:
+ <http://www.jus.uio.no/sisu>
+ <http://www.sisudoc.org>
+
+ * Download:
+ <http://www.jus.uio.no/sisu/SiSU/download.html>
+
+ * Ralph Amissah
+ <ralph@amissah.com>
+ <ralph.amissah@gmail.com>
+
+ ** 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_identify_markup.rb b/lib/sisu/v0/sst_identify_markup.rb
index 403ad329..0f60b916 100644
--- a/lib/sisu/v0/sst_identify_markup.rb
+++ b/lib/sisu/v0/sst_identify_markup.rb
@@ -113,7 +113,7 @@ WOK
or cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/
@declared_markup=$1
end
- @flag_57,@flag_38=false,false
+ @flat_65,@flag_57,@flag_38=false,false,false
cont.each_with_index do |y,i|
if y =~/^(?:0\{?~links?|@links?:)\s/ \
and f =~/(?:\.sst|\.ssm|\.ssi|\.s[123])/
@@ -121,55 +121,81 @@ WOK
else ' (post 0.20.4 header links)'
end
end
- if @flag_57 \
- or y =~/^:?A~\?? @title/
- version='0.57'
- markup=Markup_inform.new(version,'0.57' + oldlinks,@declared_markup,@declared_type)
- @flag_57=true
- break
+ unless @flag_38
+ if (y =~/^:?A~/ and f =~/(?:\.sst|\.ssm|\.ssi)/)
+ version='0.38'
+ markup=Markup_inform.new(version,'0.38' + oldlinks,@declared_markup,@declared_type)
+ @flag_38=true
+ end
end
- if @flag_38 \
- or (y =~/^:?A~/ and f =~/(?:\.sst|\.ssm|\.ssi)/)
- version='0.38'
- markup=Markup_inform.new(version,'0.38' + oldlinks,@declared_markup,@declared_type)
- @flag_38=true
- break if i >= 200
- if y =~ /(?:~{\*+|~\[\*|~\[\+)\s/
- version='0.42'
- markup=Markup_inform.new(version,'0.42' + oldlinks,@declared_markup,@declared_type)
+ if @flag_38
+ if @flag_65 \
+ or y =~/[a-z+][:;]\{.+?\}[:;][a-z+]/
+ version='0.65'
+ markup=Markup_inform.new(version,'0.65' + oldlinks,@declared_markup,@declared_type)
+ @flag_65=true
break
end
end
- if (y =~/^1~/ and f =~/(?:\.sst|\.ssm|\.ssi)/) \
- and not @flag_38
- version='0.37'
- markup=Markup_inform.new(version,'0.37 is substantially 0.16 - 0.36 markup with new file-extension' + oldlinks,@declared_markup,@declared_type)
- break
- end
- if y =~/^1~/ \
- and f =~/\.([rs])([123])/ \
- and not @flag_38
- t,n=$1,$2
- version='0.16'
- instruct=if t =~/r/
- " (change file extension from .#{t}#{n} to .ssm)"
- else " (change file extension from .#{t}#{n} to .sst)"
+ end
+ unless @flag_65
+ cont.each_with_index do |y,i|
+ if y =~/^(?:0\{?~links?|@links?:)\s/ \
+ and f =~/(?:\.sst|\.ssm|\.ssi|\.s[123])/
+ links=unless y =~/\{.+?\}\S+/; oldlinks=' (pre 0.20.4 header links)'
+ else ' (post 0.20.4 header links)'
+ end
end
- markup=Markup_inform.new(version,'0.16 - 0.36' + instruct + links,@declared_markup,@declared_type)
- break
- end
- if y =~/^0\{~/ \
- and not @flag_38
- version='0.1'
- markup=Markup_inform.new(version,'0.1 - 0.15',@declared_markup,@declared_type)
- break
- end
- if y =~/^0\{{3}/ \
- and not @flag_38
- markup=Markup_inform.new('circa. 1997','old, check date',@declared_markup,@declared_type)
- break
+ if @flag_57 \
+ or (y =~/^:?A~\?? @title/ and f =~/(?:\.sst|\.ssm|\.ssi)/)
+ version='0.57'
+ markup=Markup_inform.new(version,'0.57' + oldlinks,@declared_markup,@declared_type)
+ @flag_57=true
+ break
+ end
+ if @flag_38 \
+ or (y =~/^:?A~/ and f =~/(?:\.sst|\.ssm|\.ssi)/)
+ version='0.38'
+ markup=Markup_inform.new(version,'0.38' + oldlinks,@declared_markup,@declared_type)
+ @flag_38=true
+ break if i >= 200
+ if y =~ /(?:~{\*+|~\[\*|~\[\+)\s/
+ version='0.42'
+ markup=Markup_inform.new(version,'0.42' + oldlinks,@declared_markup,@declared_type)
+ break
+ end
+ end
+ if (y =~/^1~/ and f =~/(?:\.sst|\.ssm|\.ssi)/) \
+ and not @flag_38
+ version='0.37'
+ markup=Markup_inform.new(version,'0.37 is substantially 0.16 - 0.36 markup with new file-extension' + oldlinks,@declared_markup,@declared_type)
+ break
+ end
+ if y =~/^1~/ \
+ and f =~/\.([rs])([123])/ \
+ and not @flag_38
+ t,n=$1,$2
+ version='0.16'
+ instruct=if t =~/r/
+ " (change file extension from .#{t}#{n} to .ssm)"
+ else " (change file extension from .#{t}#{n} to .sst)"
+ end
+ markup=Markup_inform.new(version,'0.16 - 0.36' + instruct + links,@declared_markup,@declared_type)
+ break
+ end
+ if y =~/^0\{~/ \
+ and not @flag_38
+ version='0.1'
+ markup=Markup_inform.new(version,'0.1 - 0.15',@declared_markup,@declared_type)
+ break
+ end
+ if y =~/^0\{{3}/ \
+ and not @flag_38
+ markup=Markup_inform.new('circa. 1997','old, check date',@declared_markup,@declared_type)
+ break
+ end
+ markup='Not a recognised file type '
end
- markup='Not a recognised file type '
end
markup
else Markup_history.new(@opt).help_query
@@ -218,6 +244,14 @@ WOK
def initialize(opt)
@opt=opt
end
+ def sisu_0_65
+ <<WOK
+ SiSU 0.65 same as previous, adds semantic tags
+ /[a-z+][:;]\{.+?\}[:;][a-z+]/
+ e.g. author:{ Ralph last;{Amissah};last }:author
+
+WOK
+ end
def sisu_0_57
<<WOK
SiSU 0.57 is the same as 0.42 with the introduction of some a shortcut to use
@@ -332,7 +366,9 @@ WOK
tell=if @opt.mod.inspect =~/--query/
tell=case @opt.mod.inspect
when /history/
- "#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}\n#{sisu_0_37}\n#{sisu_0_16}\n#{sisu_0_1}"
+ "#{sisu_0_65}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}\n#{sisu_0_37}\n#{sisu_0_16}\n#{sisu_0_1}"
+ when /0.65/
+ "#{sisu_0_65}#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}#{sisu_0_16}"
when /0.57/
"#{sisu_0_57}#{sisu_0_42}#{sisu_0_38}#{sisu_0_16}"
when /0.42/
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