From 452f2c20ea361d68e7533f2bd45a6d5b215ed700 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 19 Sep 2008 19:03:07 -0400 Subject: sample sisu markup "Free as in Freedom": book index markers included, and; identify markup helpers updated * sample sisu markup "Free as in Freedom": book index markers included * identify markup helpers updated --- lib/sisu/v0/param.rb | 4 +++- lib/sisu/v0/param_identify_markup.rb | 15 +++++++++++---- lib/sisu/v0/sst_identify_markup.rb | 31 ++++++++++++++++++++++++++++--- 3 files changed, 42 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v0/param.rb b/lib/sisu/v0/param.rb index 7994487d..02d20ed7 100644 --- a/lib/sisu/v0/param.rb +++ b/lib/sisu/v0/param.rb @@ -217,7 +217,6 @@ module SiSU_Param fns_array=@data.dup skip unless fns_array # consider @markup_version=SiSU_Markup_type::Markup_identify.new(fns_array,@opt).markup_version? #% determine markup version - if @markup_version >= 0.65 then @sem_tag=true end if fns_array[0] =~ /^(?:% )?(?:SiSU\s+(?:master\s+)?[\d.]*|sisu-[\d.]+)$/ #check markup and markup version if fns_array[0] =~ /^(?:% )?(?:SiSU\s+(?:master\s+)?|sisu-)[\d.]+$/ #check markup and markup version @markup_version_declared=fns_array[0].match(/^(?:% )?(?:SiSU\s+(?:master\s+)?|sisu-)([\d.]+)$/)[1] @@ -644,6 +643,9 @@ module SiSU_Param end @ec[:audio] << para.scan(@rgx_audio).uniq if para =~@rgx_audio #embedded content @ec[:multimedia] << para.scan(@rgx_mm).uniq if para =~@rgx_mm #embedded content + unless @sem_tag + @sem_tag=true if para=~/[:;]\{.+?\}[:;][a-z+]/ #refix later + end end #% here endeth the document loop if @ec[:image].length > 0 @ec[:image].flatten! diff --git a/lib/sisu/v0/param_identify_markup.rb b/lib/sisu/v0/param_identify_markup.rb index 056fcc49..e86e51cd 100644 --- a/lib/sisu/v0/param_identify_markup.rb +++ b/lib/sisu/v0/param_identify_markup.rb @@ -77,7 +77,7 @@ module SiSU_Markup_type or @cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/ @version_declared=$1 end - @flat_66,@flag_57,@flag_38=false,false,false + @flag_66,@flag_57,@flag_38=false,false,false @cont.each_with_index do |y,i| if y =~/^(?:0\{?~links?|@links?:)\s/ links=unless y =~/\{.+?\}\S+/; oldlinks=' (pre 0.20.4 header links)' @@ -86,23 +86,30 @@ module SiSU_Markup_type end unless @flag_38 if y =~/^:?A~/ - version='0.38' + version=0.38 @version_determined=version @flag_38=true end end if @flag_38 + if @flag_69 \ + or y =~/^=\{.+?\}\s*$/ + version=0.69 + @flag_69=true + @version_determined=version + break + end if @flag_66 \ or y =~/[:;]\{.+?\}[:;][a-z+]/ version='0.66' - @version_determined=version @flag_66=true + @version_determined=version break end end end @flag_57,@flag_38=false,false - unless @flag_66 + unless @flag_66 or @flag_69 @cont.each_with_index do |y,i| if @flag_57 \ or y =~/^:?A~\?? @title/ diff --git a/lib/sisu/v0/sst_identify_markup.rb b/lib/sisu/v0/sst_identify_markup.rb index a9eb4d32..3fbac3f3 100644 --- a/lib/sisu/v0/sst_identify_markup.rb +++ b/lib/sisu/v0/sst_identify_markup.rb @@ -114,7 +114,7 @@ WOK or cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/ @declared_markup=$1 end - @flat_66,@flag_57,@flag_38=false,false,false + @flag_66,@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])/ @@ -130,6 +130,13 @@ WOK end end if @flag_38 + if @flag_69 \ + or y =~/^=\{.+?\}\s*$/ + version='0.69' + markup=Markup_inform.new(version,'0.69' + oldlinks,@declared_markup,@declared_type) + @flag_69=true + break + end if @flag_66 \ or y =~/[a-z+][:;]\{.+?\}[:;][a-z+]/ version='0.66' @@ -139,7 +146,7 @@ WOK end end end - unless @flag_66 + unless @flag_66 or @flag_69 cont.each_with_index do |y,i| if y =~/^(?:0\{?~links?|@links?:)\s/ \ and f =~/(?:\.sst|\.ssm|\.ssi|\.s[123])/ @@ -245,6 +252,22 @@ WOK def initialize(opt) @opt=opt end + def sisu_0_69 + <