diff options
author | Ralph Amissah <ralph@amissah.com> | 2008-02-14 02:55:46 +0000 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2008-02-14 02:55:46 +0000 |
commit | 6d345eaef2cf02fd5b4a97cc87513ce0aa081d44 (patch) | |
tree | 2779d4c7d7970dbdec328ebd9001e1c624a0cd4f | |
parent | introduce syntax highlighting for new syntax markers (diff) |
enable identification of new markup
-rw-r--r-- | lib/sisu/v0/help.rb | 11 | ||||
-rw-r--r-- | lib/sisu/v0/sst_identify_markup.rb | 126 |
2 files changed, 88 insertions, 49 deletions
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/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/ |