From 91f5be6f02bb6c3cd0ba26ff62acb603a33e741f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 22 Aug 2007 23:56:23 +0100 Subject: version bump to 0.57, minor addition to markup (a header to heading shortcut) and sisurc.yml update for additional search form option (hyperestraier) * markup addition, headings, shortcut for top level title (and author) :A~ @title @author (also available for level 2 (or 3) author) [version bump] * param markup identifier (and identifier) updated to identify markup addition in 0.57, :A~ @title * html search form in navigation band/banner and promo, adjustments, hyperestraier option offered in promo, requires change in sisurc.yml * sisurc.yml requires changes to make use search form options, [version bump] sample updated and commented out --- lib/sisu/v0/css.rb | 1 + lib/sisu/v0/dal_syntax.rb | 5 +- lib/sisu/v0/help.rb | 11 +-- lib/sisu/v0/html_format.rb | 2 +- lib/sisu/v0/html_promo.rb | 52 +++++++---- lib/sisu/v0/html_scroll.rb | 4 - lib/sisu/v0/odf.rb | 9 +- lib/sisu/v0/param.rb | 8 +- lib/sisu/v0/param_identify_markup.rb | 7 +- lib/sisu/v0/sst_identify_markup.rb | 22 ++++- lib/sisu/v0/sysenv.rb | 176 +++++++++++++++++++++++------------ 11 files changed, 193 insertions(+), 104 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v0/css.rb b/lib/sisu/v0/css.rb index df53f46a..d1e6832a 100644 --- a/lib/sisu/v0/css.rb +++ b/lib/sisu/v0/css.rb @@ -434,6 +434,7 @@ WOK } li { background: url(../image/bullet_red.png) no-repeat 0px 6px; + /* list-style-type: disc; */ padding-left: 20px; display: block; font-family: #{fonts}; diff --git a/lib/sisu/v0/dal_syntax.rb b/lib/sisu/v0/dal_syntax.rb index dfa7478d..703d9f1b 100644 --- a/lib/sisu/v0/dal_syntax.rb +++ b/lib/sisu/v0/dal_syntax.rb @@ -185,7 +185,7 @@ module Syntax # _2 <:i2> #indent paragraph 2 steps # _3 <:i3> #indent paragraph 3 steps # _4 <:i4> #indent paragraph 4 steps - # _* #bullet (list) + # _* #bullet (list) ● # _1* #bullet (list) indented # _1* #bullet (list) indented # # #numbered (list) level 1 @@ -209,6 +209,9 @@ module Syntax line=line_array.join(' ') line=line.strip end + line.gsub!(/^(1~\??) @title\s+(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1 #{@md.title} - #{@md.subtitle},
\\2#{@md.dc_creator}") + line.gsub!(/^(1~\??) @title\s*$/,"\\1 #{@md.title} - #{@md.subtitle}") # + line.gsub!(/^([23]~\??) (?:(by\s+)?(?:@creator|@author))\s*$/,"\\1 \\2#{@md.dc_creator}") # line.gsub!(/<(https?:\/\/\S+?)>/,'< \1 >') #catch problem markup line.gsub!(/<:=(\S+?)>/,'{ c_\1.png 14x14 }http://www.jus.uio.no/sisu') #adjustment 2005w30 line.gsub!(//,'<:\1>') #escaped special character diff --git a/lib/sisu/v0/help.rb b/lib/sisu/v0/help.rb index 4e7a60f9..e22808d1 100644 --- a/lib/sisu/v0/help.rb +++ b/lib/sisu/v0/help.rb @@ -1498,7 +1498,7 @@ WOK sisu-0.38 is provided with 0.38 markup samples sample marked up documents are provided in directory: - #{@cX.green}sisu-exampless/sample/document_samples_sisu_markup/#{@cX.off} + #{@cX.green}sisu-examples/sample/document_samples_sisu_markup/#{@cX.off} and online #{@cX.green}www.jus.uio.no/sisu#{@cX.off} WOK @@ -1710,7 +1710,7 @@ WOK Note on databases built By default, [unless otherwise specified] databases are built on a directory basis, from collections of documents within that directory. The name of the directory you choose to work from is used as the database name, - i.e. if you are working in a directory called #{@cX.blue}#{@env.path.home}/ebook#{@cX.off} the database #{@cX.blue}ebook#{@cX.off} is used. [otherwise a manual mapping for the collection is necessary] + i.e. if you are working in a directory called #{@cX.blue}#{@env.path.home}/ebook#{@cX.off} the database #{@cX.blue}SiSU_ebook#{@cX.off} is used. [otherwise a manual mapping for the collection is necessary] WOK help_search help_general @@ -1728,9 +1728,6 @@ WOK See the documentation for hyperestraier #{@cX.blue} http://hyperestraier.sourceforge.net/ - http://hyperestraier.sourceforge.net/intro-en.html - http://hyperestraier.sourceforge.net/uguide-en.html - http://hyperestraier.sourceforge.net/pguide-en.html file:///usr/share/doc/hyperestraier/index.html #{@cX.off} #{@cX.orange} @@ -1778,14 +1775,14 @@ WOK (ii) edit #{@cX.green}estseek.conf#{@cX.off}, with attention to the lines starting 'indexname:' and 'replace:': #{@cX.green} indexname: #{@env.path.webserv}/casket - replace: ^file://#{@env.path.webserv}{{!}}#{@env.url.webrick_base} + replace: ^file://#{@env.path.webserv}{{!}}#{@env.url.webserv_host_base} replace: /index\.html?${{!}}/ #{@cX.off} (C) to test using webrick, start webrick: #{@cX.green} sisu -W #{@cX.off} and try open the url: #{@cX.blue} - #{@env.url.webrick_base}/cgi-bin/estseek.cgi #{@cX.off} + #{@env.url.webserv_host_base}/cgi-bin/estseek.cgi #{@cX.off} WOK end diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index c568a509..29700e83 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -208,7 +208,7 @@ module SiSU_HTML_Format end def search env=SiSU_Env::Info_env.new(@md.fns,@md) - env.widget.search_form + env.widget.search_form('sisusearch',nil,nil,true) end def manifest %{ diff --git a/lib/sisu/v0/html_promo.rb b/lib/sisu/v0/html_promo.rb index cc60f4c9..c4e18184 100644 --- a/lib/sisu/v0/html_promo.rb +++ b/lib/sisu/v0/html_promo.rb @@ -143,25 +143,35 @@ module SiSU_HTML_promo def blurb @prod['blurb'] ? %{

#{@prod['blurb']}

} : '' end - def search_form + def search_form_sisu(table=true) db=if @prod['db']=~/\S+/ @prod['db']=~/^SiSU_\S+/ ? @prod['db'] : "SiSU_#{@prod['db']}" - elsif defined? @rc['search']['db'] and @rc['search']['db'] =~/\S+/ - @rc['search']['db']=~/^SiSU_\S+/ ? @prod['search']['db'] : "SiSU_#{@prod['db']}" + elsif defined? @rc['search']['sisu']['db'] and @rc['search']['sisu']['db'] =~/\S+/ + @rc['search']['sisu']['db']=~/^SiSU_\S+/ ? @prod['search']['sisu']['db'] : "SiSU_#{@prod['db']}" else nil end - #target=@prod['target']=~/^\S+/ ? @prod['target'] : '_top' action=if @prod['action']=~/^http:\/\// @prod['action'] - elsif defined? @rc['search']['action'] and @rc['search']['action'] =~/^http:\/\// - @rc['search']['action'] + elsif defined? @rc['search']['sisu']['action'] and @rc['search']['sisu']['action'] =~/^http:\/\// + @rc['search']['sisu']['action'] else nil end form=if action and db - '
' + @env.widget.search_form(action,db) + '
' + @env.widget.search_form('sisusearch',action,db,table) else '' end end + def search_form_hyperestraier(table=true) + action=if defined? @rc['search']['hyperestraier']['action'] and @rc['search']['hyperestraier']['action'] =~/^http:\/\// + @rc['search']['hyperestraier']['action'] + else nil + end + form=if action + '
' + @env.widget.search_form('hyperestraier',action,'',table) + else '' + end + form + end def links if @prod['links'] #and @prod['links'] == Array links_a=[] @@ -268,10 +278,15 @@ WOK #{cell.links} WOK end - def output_form_search(type,id) + def output_form_search_sisu(type,id) prod_id=id.gsub(/id_/,'') cell=cell(@ad[:promo][type][id],prod_id) - cell.search_form + cell.search_form_sisu(false) + end + def output_form_search_hyperestraier(type,id) + prod_id=id.gsub(/id_/,'') + cell=cell(@ad[:promo][type][id],prod_id) + cell.search_form_hyperestraier(false) end def output_form_book(type,id) prod_id=id.gsub(/id_/,'') @@ -329,7 +344,10 @@ WOK when /sponsor/ output_form_sponsor(type,id) when /search/ - output_form_search(type,id) + if id=~/hyperestraier/ + output_form_search_hyperestraier(type,id) + else output_form_search_sisu(type,id) + end when /book/ output_form_book(type,id) when /journal/ @@ -338,13 +356,13 @@ WOK output_form_conference(type,id) end end - def advert_extract_single(type,id) #extracts single item of type with id - #type === book,journal,conference,sponsor - id=id.to_s.gsub(/^(\d)/,'id_\1') - if defined? @ad[:promo][type][id] and @ad[:promo][type][id] - output_form_select(type,id) - end - end + #def advert_extract_single(type,id) #extracts single item of type with id + # #type === book,journal,conference,sponsor + # id=id.to_s.gsub(/^(\d)/,'id_\1') + # if defined? @ad[:promo][type][id] and @ad[:promo][type][id] + # output_form_select(type,id) + # end + #end def advert_extract_subject(category) #extracts products from category/subject list adverts=[] if defined? @ad[:promo_list][category] and @ad[:promo_list][category] diff --git a/lib/sisu/v0/html_scroll.rb b/lib/sisu/v0/html_scroll.rb index 3739f660..b2cfb497 100644 --- a/lib/sisu/v0/html_scroll.rb +++ b/lib/sisu/v0/html_scroll.rb @@ -140,7 +140,6 @@ module SiSU_HTML_scroll format_seg=SiSU_HTML_Format_type::Format_seg.new(@md,one,two) para=format_seg.no_paranum end - #para=para.gsub(/ [2-6]~\S+ /,'') #and @md.cmd =~/[VM]/ #arbitrary, watch problematic as too general para='' if (para =~// and para =~/^(?:\^~\d+\s|)/) # hmmm re-adjusted 200507, for alt endnote which should again be matched ^~ ... not in response to problem though if para =~/<:center>/ #rules changed now a

(.*)/.match(para).captures @@ -153,9 +152,6 @@ module SiSU_HTML_scroll unless @rcdc; @scr[:body] << para unless para =~/\A\s*\Z/ else @scr[:metadata] << para end - #unless meta; @scr[:body] << para unless para =~/\A\s*\Z/ - #else @scr[:metadata] << meta - #end end end @scr diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index f6d6d942..11d14bf2 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -465,16 +465,15 @@ module SiSU_ODF para=para_array.join(' ') para=para.strip end - para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\\1 ') # bullet_red.png - #para.gsub!(/^_\*\s+/,'· ') #bullet + para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1 ') # bullet_red.png + #para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1 ') #bullet + #para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\1● ') # bullet utf8, make smaller if used + #para.gsub!(/^_\*\s+/,' ') #bullet para.gsub!(/^(<:i[1-9]>)\s+_\*\s+/,'\1 · ') #bullet - #para.gsub!(/^(<:i[1-9]>\s+)?_\*\s+/,'\\1 ') # bullet_red.png - #para.gsub!(/^(<:i[1-9]>)\s+_\*\s+/,'\1 · ') #bullet para.gsub!(/
/,'
') para.gsub!(/<:p[bn]>/,' ') para.gsub!(/©/,'©') #too arbitrary para.gsub!(/.+?<-#>/,'') # remove dummy headings (used by html) #check - #para.gsub!(/_\*\s+/,'* ') # bullet markup, marked down para.gsub!(/(.+?)<\/b>/,'\1') para.gsub!(/(.+?)<\/i>/,'\1') para.gsub!(/(.+?)<\/u>/,'\1') diff --git a/lib/sisu/v0/param.rb b/lib/sisu/v0/param.rb index 186901a1..9462d8d2 100644 --- a/lib/sisu/v0/param.rb +++ b/lib/sisu/v0/param.rb @@ -199,10 +199,10 @@ module SiSU_Param fns_array=@data.dup skip unless fns_array # consider @markup_version=SiSU_Markup::Markup_identify.new(fns_array,@opt).markup_version? #% determine markup version - if fns_array[0] =~ /^(?:% )?(?:SiSU\s+[\d.]*|sisu-[\d.]+)$/ #check markup and markup version - if fns_array[0] =~ /^(?:% )?(?:SiSU\s+|sisu-)[\d.]+$/ #check markup and markup version - @markup_version_declared=fns_array[0].match(/^(?:% )?(?:SiSU\s+|sisu-)([\d.]+)$/)[1] - sm_a,sm_b,sm_c=fns_array[0].match(/^(?:% )?(?:SiSU\s+|sisu-)([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?$/)[1..3] + 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] + sm_a,sm_b,sm_c=fns_array[0].match(/^(?:% )?(?:SiSU\s+(?:master\s+)?|sisu-)([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?$/)[1..3] sm_c ||=0 sv=if @cmd =~/[VMv]/; "SiSU version (#{@sisu_version[:version]})" else '' diff --git a/lib/sisu/v0/param_identify_markup.rb b/lib/sisu/v0/param_identify_markup.rb index 21e796e8..93c8bf79 100644 --- a/lib/sisu/v0/param_identify_markup.rb +++ b/lib/sisu/v0/param_identify_markup.rb @@ -71,8 +71,13 @@ module SiSU_Markup elsif @cont[0] =~ /^(?:%\s+)?SiSU\s+([0-9](?:\.[0-9]+){1,2})/ or @cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/ @version_declared=$1 end - @flag_38=false + @flag_57,@flag_38=false,false @cont.each_with_index do |y,i| + if @flag_57 or y =~/^:?A~\?? @title/ + @version_determined=0.57 + @flag_57=true + break + end if @flag_38 or y =~/^:?A~/ @version_determined=0.38 @flag_38=true diff --git a/lib/sisu/v0/sst_identify_markup.rb b/lib/sisu/v0/sst_identify_markup.rb index e7a3c9eb..19601c13 100644 --- a/lib/sisu/v0/sst_identify_markup.rb +++ b/lib/sisu/v0/sst_identify_markup.rb @@ -107,13 +107,19 @@ WOK elsif cont[0] =~ /^(?:%\s+)?SiSU\s+([0-9](?:\.[0-9]+){1,2})/ or cont[0] =~ /^(?:%\s+)?sisu-([0-9](?:\.[0-9]+){1,2})/ @declared_markup=$1 end - @flag_38=false + @flag_57,@flag_38=false,false 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 + 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 + 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) @@ -196,6 +202,16 @@ WOK def initialize(opt) @opt=opt end + def sisu_0_57 + < + if table + table_open='' + table_close='' + else + table_open='' + table_close='
' + end + form=if create_form_sisu and type=~/sisusearch/ and + defined? rc['search']['sisu'] + < +#{table_open}
-

+
@@ -891,23 +917,43 @@ module SiSU_Env txt -
- + +#{table_close} - } +WOK + elsif create_form_hyperestraier and type=~/hyperestraier/ and + defined? rc['search']['hyperestraier'] + < +#{table_open} + +
+ + +
+ + + +hyperestraier search + +#{table_close} + +WOK else '' end + form end def search_form_static(action=nil,db=nil) rc=SiSU_Env::Get_init.instance.yamlrc - create_form=if action and db and action =~/http:\/\// and db =~/\S+/ + create_form=if rc['search']['sisu']['flag']==true and + action and db and action =~/http:\/\// and db =~/\S+/ true elsif widget.search_fixed? - db=if rc['search']['db']=~/\S+/ - rc['search']['db']=~/^SiSU_\S+/ ? rc['search']['db'] : "SiSU_#{rc['search']['db']}" + db=if rc['search']['sisu']['flag']==true and rc['search']['sisu']['db']=~/\S+/ + rc['search']['sisu']['db']=~/^SiSU_\S+/ ? rc['search']['sisu']['db'] : "SiSU_#{rc['search']['sisu']['db']}" else nil end - action=rc['search']['action'] + action=rc['search']['sisu']['action'] true else false end @@ -915,7 +961,7 @@ module SiSU_Env %{ -
+
@@ -946,12 +992,13 @@ module SiSU_Env @flag={ :ad=>false,:md=>false,:sk=>false,:rc=>false } def search? flag=if defined? @rc['search'] and - defined? @rc['search']['action'] and @rc['search']['action'] =~/http:\/\// and - defined? @rc['search']['db'] and @rc['search']['db'] =~/\S+/ - defined? @rc['search']['db'] and @rc['search']['db'] =~/\S+/ + defined? @rc['search']['sisu'] and + defined? @rc['search']['sisu']['action'] and @rc['search']['sisu']['action'] =~/http:\/\// and + defined? @rc['search']['sisu']['db'] and @rc['search']['sisu']['db'] =~/\S+/ + defined? @rc['search']['sisu']['db'] and @rc['search']['sisu']['db'] =~/\S+/ flag=if defined? @vz.widget_search and @vz.widget_search == true true - elsif defined? @rc['search']['flag'] and @rc['search']['flag'] == true + elsif defined? @rc['search']['sisu']['flag'] and @rc['search']['sisu']['flag'] == true true else false @@ -962,12 +1009,13 @@ module SiSU_Env end def search_fixed? flag=if defined? @rc['search'] and - defined? @rc['search']['action'] and @rc['search']['action'] =~/http:\/\// and - defined? @rc['search']['db'] and @rc['search']['db'] =~/\S+/ - defined? @rc['search']['db'] and @rc['search']['db'] =~/\S+/ + defined? @rc['search']['sisu'] and + defined? @rc['search']['sisu']['action'] and @rc['search']['sisu']['action'] =~/http:\/\// and + defined? @rc['search']['sisu']['db'] and @rc['search']['sisu']['db'] =~/\S+/ + defined? @rc['search']['sisu']['db'] and @rc['search']['sisu']['db'] =~/\S+/ flag=if defined? @vz.widget_search and @vz.widget_search == true true - elsif defined? @rc['search']['flag'] and @rc['search']['flag'] == true + elsif defined? @rc['search']['sisu']['flag'] and @rc['search']['sisu']['flag'] == true true else false @@ -978,21 +1026,23 @@ module SiSU_Env end def search_form(action=nil,db=nil) rc=SiSU_Env::Get_init.instance.yamlrc - create_form=if action and db and action =~/http:\/\// and db =~/\S+/ + create_form=if defined? rc['search']['sisu']['flag'] and + rc['search']['sisu']['flag']==true and + action and db and action =~/http:\/\// and db =~/\S+/ true - elsif widget_static.search? - db=if rc['search']['db']=~/\S+/ - rc['search']['db']=~/^SiSU_\S+/ ? rc['search']['db'] : "SiSU_#{rc['search']['db']}" + elsif widget_static.search? and rc['search']['sisu']['flag']==true + db=if rc['search']['sisu']['db']=~/\S+/ + rc['search']['sisu']['db']=~/^SiSU_\S+/ ? rc['search']['sisu']['db'] : "SiSU_#{rc['search']['sisu']['db']}" else nil end - action=rc['search']['action'] + action=rc['search']['sisu']['action'] true else false end if create_form and @fnb and @fnb=~/\S+/ %{ - +
@@ -1007,7 +1057,7 @@ module SiSU_Env elsif create_form %{ - +
@@ -1370,7 +1420,9 @@ module SiSU_Env "#{path.webserv}/#@stub_pwd".gsub(/#{path.webserv_dir}/,"#{url.hostname}/#@stub_pwd") elsif defined? @rc['webserv']['webrick_url'] and @rc['webserv']['webrick_url'] == false "file://#{path.webserv}/#@stub_pwd" - else "#{url.hostname}:#{webserv_port_cgi}/#@stub_pwd" + elsif webserv_port_cgi =~/\S+/ + "#{url.hostname}:#{webserv_port_cgi}/#@stub_pwd" + else "#{url.hostname}/#@stub_pwd" end end def webserv_base #web url for local webserv (localhost, or hostname) @@ -1394,8 +1446,8 @@ module SiSU_Env end end def sample_search_form_title - if defined? @rc['search']['title'] and @rc['search']['title'] =~/\S+/ - @rc['search']['title'] + if defined? @rc['search']['sisu']['title'] and @rc['search']['sisu']['title'] =~/\S+/ + @rc['search']['sisu']['title'] else %{SiSU search form (sample):} end end -- cgit v1.2.3