From 7ef4f9a39e2aeffd9731ac0b68caca4c1b8cf03f Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Tue, 21 Aug 2007 21:34:41 +0100 Subject: small fixes to manifest and html_scroll, and adjustment to html navigation band use in concordance and manifest * manifest * use relative link by default * in absence of configured url_root (http://) use info on location on local filesystem (file://) * html outputs, navigation band/banner adjustment, in concordance and manifest * html scroll, fix to document information link in table of contents --- lib/sisu/v0/concordance.rb | 19 +++++++++---------- lib/sisu/v0/dal.rb | 4 ++-- lib/sisu/v0/defaults.rb | 4 +--- lib/sisu/v0/html.rb | 11 ++++++++--- lib/sisu/v0/html_format.rb | 31 +++++++++++++++++++++++++++++++ lib/sisu/v0/html_scroll.rb | 8 ++++---- lib/sisu/v0/manifest.rb | 14 +++++++------- lib/sisu/v0/sysenv.rb | 3 ++- 8 files changed, 64 insertions(+), 30 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v0/concordance.rb b/lib/sisu/v0/concordance.rb index 251d5b58..111741ab 100644 --- a/lib/sisu/v0/concordance.rb +++ b/lib/sisu/v0/concordance.rb @@ -101,6 +101,9 @@ module SiSU_Concordance require "#{SiSU_lib}/param" include SiSU_Param include SiSU_Viz + #revisit, both requires (html & shared_xml) needed for stand alone operation (sisu -w [filename]) + require "#{SiSU_lib}/shared_xml" + require "#{SiSU_lib}/html" def initialize(lnk,md) @md=md @vz=SiSU_Env::Get_init.instance.skin @@ -113,10 +116,11 @@ module SiSU_Concordance @lex_button=%{SiSU home -->} @lnk=lnk @doc_details =< 

Manifest #{@md.dc_title}
    #{@md.dc_creator}

            TOC TOC - table of contents for individual articles

            Full Text Full text (with indexed table of contents)

            PDF portrait pdf version of the document (portrait)

            PDF landscape pdf version of the document (landscape)

Word index links are to html versions of the text the segmented version followed by the scroll (single document) version.
[For segmented text references [T1], [T2] or [T3] appearing without a link, indicates that the word appears in a title (or subtitle) of the text (that is identifiable by the appended object citation number).]

+
 

#{@md.dc_title}

#{@md.dc_creator}

WOK end def create + head_banner=SiSU_HTML_Format_type::Head_toc.new(@md) < @@ -135,15 +139,10 @@ WOK #{@vz.js_top} - - - -
- #{@vz.banner_home_button_only} - - #{@env.widget_static.search_form} -
- #@doc_details

(The word listing/index is Case sensitive: Capitalized words appear before lower case)

+ #{head_banner.concordance_navigation_band('pdf')} + #@doc_details +

Word index links are to html versions of the text the segmented version followed by the scroll (single document) version.
[For segmented text references [T1], [T2] or [T3] appearing without a link, indicates that the word appears in a title (or subtitle) of the text (that is identifiable by the appended object citation number).]

+

(The word listing/index is Case sensitive: Capitalized words appear before lower case)

word (number of occurences)
linked references to word within document
[if number of occurences exceed number of references - word occurs more than once in at least one reference. Footnote/endnotes are either assigned to the paragraph from which they are referenced or ignored, so it is relevant to check the footnotes referenced from within a paragraph as well.] diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index a4e512f2..2e5075d4 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -818,9 +818,9 @@ module SiSU_DAL ocnm=ocnd=ocnv=0 ocnm+=1 header0='<:pn>' - header1="\n1~ Document Information <~0;0:0;m#{ocnm}>" + header1="\n1~ Document Information (metadata) <~0;0:0;m#{ocnm}>" ocnm+=1 - header4="\n4~metadata MetaData <~0;m#{ocnm};m#{ocnm}>" + header4="\n4~metadata Metadata <~0;m#{ocnm};m#{ocnm}>" ocnm+=1; ocnd+=1 head_no_dc="<~0;m#{ocnm};d#{ocnd}>" ocnm+=1; ocnd+=1 diff --git a/lib/sisu/v0/defaults.rb b/lib/sisu/v0/defaults.rb index 3d5a7c40..c46860c3 100644 --- a/lib/sisu/v0/defaults.rb +++ b/lib/sisu/v0/defaults.rb @@ -1380,9 +1380,7 @@ WOK is released under GPLv3 or later, - - http://www.gnu.org/licenses/gpl.html - + #{url_decoration.xml_open}http://www.gnu.org/licenses/gpl.html#{url_decoration.xml_close}

diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index 5bec99bc..0798e604 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -392,10 +392,15 @@ WOK title=if para =~/(<~0;(?:\w|[0-6]:)\d+;\w\d+><#@dp:#@dp>)$/ m=/#{$1}/ para.gsub!(m,'') - linkname - else #if para =~/Document Information/ + if para=~/^\d~\s+Document Information/ + %{#{linkname}} + else linkname + end + else @@toc[:scr] << '
' - link='docinfo' + link=if para =~/<~[1-9];([0-6]):\d+;\w\d+><#@dp:#@dp>$/; $1 + else '' + end %{#{linkname}} end format_toc=SiSU_HTML_Format_type::Format_toc.new(@md,title) diff --git a/lib/sisu/v0/html_format.rb b/lib/sisu/v0/html_format.rb index b78017fd..c568a509 100644 --- a/lib/sisu/v0/html_format.rb +++ b/lib/sisu/v0/html_format.rb @@ -278,6 +278,24 @@ WOK   #{@vz.table_close} +

} + end + def concordance_navigation_band(type='') + if type=~/pdf/ + @tocband_concordance=make_concordance + end + %{ + + +
+ #{@vz.banner_band} + + #@tocband_concordance + +   + #{@vz.png_nav_toc} +   +#{@vz.table_close}

} end def seg_head_navigation_band(type='') @@ -346,6 +364,19 @@ WOK #{wgt.manifest} #{wgt.search} #{wgt.home} +

} + end + def make_concordance + manifest=scroll=seg='' + wgt=Widget.new(@md) + %{ + + #{wgt.seg(@vz.nav_txt_toc_link)}#{wgt.scroll(@vz.nav_txt_doc_link)}#{wgt.pdf}#{wgt.odf} +
+ #{wgt.concordance(@vz.nav_txt_concordance)} + #{wgt.manifest} + #{wgt.search} + #{wgt.home}
} end def head diff --git a/lib/sisu/v0/html_scroll.rb b/lib/sisu/v0/html_scroll.rb index 03108ba9..3739f660 100644 --- a/lib/sisu/v0/html_scroll.rb +++ b/lib/sisu/v0/html_scroll.rb @@ -80,11 +80,11 @@ module SiSU_HTML_scroll @rcdc=false @scr={ :body=>[],:metadata=>[],:owner_details=>[] } data.each do |para| - if para =~/Document Information/ - para.gsub!(/(Document Information)/,'\1') + if para =~/^\d~\s+Document Information/ + para.gsub!(/(Document Information(?: \(metadata\))?)/,'\1') end - if para =~/MetaData/ - para.gsub!(/(MetaData)/,'\1') + if para =~/^\d~metadata\s+Metadata/ + para.gsub!(/(Metadata)/,'\1') end @rcdc=true if @rcdc==false and (para =~/^\d~metadata/ or para =~/^1~\s+Document Information/) if para !~/(^0~||)/ diff --git a/lib/sisu/v0/manifest.rb b/lib/sisu/v0/manifest.rb index bca5cd92..da123216 100644 --- a/lib/sisu/v0/manifest.rb +++ b/lib/sisu/v0/manifest.rb @@ -99,6 +99,7 @@ module SiSU_Manifest l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns) @language=l[:l] @translate=SiSU_Translate::Source.new(@md,@language) + @url_brace=SiSU_Viz::Skin.new.url_decoration end def output SiSU_Env::SiSU_file.new(@md).mkdir @@ -111,7 +112,7 @@ module SiSU_Manifest size=(File.size("#{@base_path}/#{file}")/1024.00).to_s kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @manifest[:txt] << "#{file} #{id} #{kb}\n" - @manifest[:html] << %{

#{img}#{id}

#{file}

<#@base_url/#{file}>

#{kb}

\n} + @manifest[:html] << %{

#{img}#{id}

#{file}

#{@url_brace.xml_open}#@base_url/#{file}#{@url_brace.xml_close}

#{kb}

\n} end def summarize_source(id,file) sys=SiSU_Env::System_call.new @@ -123,9 +124,8 @@ module SiSU_Manifest size=(File.size("#{@base_path}/#{file}")/1024.00).to_s kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] @manifest[:txt] << "#{file} #{id} #{kb}\n" - @manifest[:html] << %{

#{id}

#{file}   #{dgst[1]}
<#@base_url/#{file}>

#{kb}

+ @manifest[:html] << %{

#{id}

#{file}   #{dgst[1]}
#{@url_brace.xml_open}#@base_url/#{file}#{@url_brace.xml_close}

#{kb}

\n} if kb and kb =~/\d+/ - #@manifest[:html] << %{

#{id}:

#{file}

  <#@base_url/#{file}>

#{dgst[1]}

#{kb}

\n} if kb and kb =~/\d+/ end def languages(id,file) flv=@env.published_manifests?(@base_path) @@ -142,7 +142,7 @@ module SiSU_Manifest flv.each do |l| lang=SiSU_Translate::Source.new(@md,@language,l[:l]).language_list @manifest[:txt] << "#{l[:m]} #{lang}\n" - @manifest[:html] << %{

#{lang}

#{lang}

#@base_url/#{l[:m]}

 

\n} + @manifest[:html] << %{

#{lang}

#{lang}

#{@url_brace.xml_open}#@base_url/#{l[:m]}#{@url_brace.xml_close}

 

\n} end end def metadata(id,info) @@ -153,7 +153,7 @@ module SiSU_Manifest elsif url =~/^\.\.\//; url.gsub(/^\.(\.)?/,@env.url.root) else url end - @manifest[:html] << %{

#{lnk}

  <#{static}>

\n} + @manifest[:html] << %{

#{lnk}

  #{@url_brace.xml_open}#{static}#{@url_brace.xml_close}

\n} end def output_tests if FileTest.file?("#@base_path/#{@md.fn[:toc]}")==true @@ -455,13 +455,13 @@ module SiSU_Manifest banner_table=if vz.banner_home_button_only !~ /http:\/\/www\.jus\.uio\.no\/sisu/ and vz.banner_home_button_only !~ /sisu\.home\.png/ < -#{vz.banner_home_button}

TOC linked #@base_url/#{file}

#{@env.widget_static.search_form}SiSU --> +#{vz.banner_band}

#{@url_brace.xml_open}#@base_url/#{file}#{@url_brace.xml_close}

#{@env.widget_static.search_form}SiSU --> WOK else < -SiSU -->

TOC linked #@base_url/#{file}

#{@env.widget_static.search_form} +SiSU -->

#{@url_brace.xml_open}#@base_url/#{file}#{@url_brace.xml_close}

#{@env.widget_static.search_form} WOK end diff --git a/lib/sisu/v0/sysenv.rb b/lib/sisu/v0/sysenv.rb index 10ec5e33..9052ac91 100644 --- a/lib/sisu/v0/sysenv.rb +++ b/lib/sisu/v0/sysenv.rb @@ -1275,7 +1275,8 @@ module SiSU_Env end def root if defined? @rc['webserv']['url_root'] and @rc['webserv']['url_root'] =~/http:\/\//; "#{@rc['webserv']['url_root']}/#@stub_pwd" - else "http://localhost/#@stub_pwd" + elsif defined? @rc['webserv']['url_root'] and @rc['webserv']['url_root'] =~/localhost/; "http://localhost/#@stub_pwd" + else "file://#{path.output}" end end def remote -- cgit v1.2.3