diff options
67 files changed, 803 insertions, 2117 deletions
diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index 79293dca..ce9abf00 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -13,13 +13,35 @@ Reverse Chronological: %% Development branch UNSTABLE v3 branch once stable will supersede & replace current stable v2 branch +%% 3.1.13.orig.tar.xz (2012-02-03:05/5) +http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.1.13 +http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.1.13-1 +http://www.jus.uio.no/sisu/pkg/src/sisu_3.1.13.orig.tar.xz + sisu_3.1.13.orig.tar.xz + sisu_3.1.13-1.dsc + sisu_3.1.13-1.debian.tar.gz + +* v3 v3dv, path & url links, updates for multi output directory structure + possibilities (fixes) + +* v3dv, dal (& code affected as a result), use symbols to identify document + objects type (is) and group (of) + +* v3dv, epub, html, some cleaning of redundancy + +* v3dv, texinfo BROKEN, since 3.1.12 at least + +* v3 v3dv, vim syntax highlighting, patch from Thilo Six <T.Six@gmx.de> applied + Re: <http://thread.gmane.org/gmane.editors.vim.devel/32151> & + <http://vimdoc.sourceforge.net/htmldoc/options.html#cpo-l> + %% 3.1.12.orig.tar.xz (2012-01-23:04/1) http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/sisu_3.1.12 http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/sisu_3.1.12-1 http://www.jus.uio.no/sisu/pkg/src/sisu_3.1.12.orig.tar.xz - sisu_3.1.12.orig.tar.xz - sisu_3.1.12-1.dsc - sisu_3.1.12-1.debian.tar.gz + 18c7fa9dcbd1a2b901012c6946c4ff8feca45e049f35ca988487c631a1cfaf92 1680904 sisu_3.1.12.orig.tar.xz + ace21c0aba04d24b20ce3768aad58c93a80481840661ce505b06c3318c0370f1 1389 sisu_3.1.12-1.dsc + 6bd103940b907edd6622be163131b21d139e2d301be6b0219fd366c514725bbd 291315 sisu_3.1.12-1.debian.tar.gz * texpdf, tampering with "safe" special character transformations, a fix (that may introduce new issues, watch) [in response to report of a pdf title bug diff --git a/data/sisu/v3/conf/editor-syntax-etc/vim/syntax/sisu.vim b/data/sisu/v3/conf/editor-syntax-etc/vim/syntax/sisu.vim index bfcfc3e6..4545ee8f 100644 --- a/data/sisu/v3/conf/editor-syntax-etc/vim/syntax/sisu.vim +++ b/data/sisu/v3/conf/editor-syntax-etc/vim/syntax/sisu.vim @@ -11,6 +11,8 @@ elseif exists("b:current_syntax") finish else endif +let s:cpo_save = &cpo +set cpo&vim "% "Errors: syn match sisu_error contains=sisu_link,sisu_error_wspace "<![^ei]\S\+!>" @@ -260,3 +262,5 @@ hi def link sisu_error_sem_marker Error hi def link sisu_error_wspace Error hi def link sisu_error Error let b:current_syntax = "sisu" +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/data/sisu/v3/conf/editor-syntax-etc/vim/syntax/sisu_next.vim b/data/sisu/v3/conf/editor-syntax-etc/vim/syntax/sisu_next.vim index 61504dbd..257e1cba 100644 --- a/data/sisu/v3/conf/editor-syntax-etc/vim/syntax/sisu_next.vim +++ b/data/sisu/v3/conf/editor-syntax-etc/vim/syntax/sisu_next.vim @@ -11,6 +11,8 @@ elseif exists("b:current_syntax") finish else endif +let s:cpo_save = &cpo +set cpo&vim "% "Errors: syn match sisu_error contains=sisu_link,sisu_error_wspace "<![^ei]\S\+!>" @@ -275,3 +277,5 @@ hi def link sisu_error_sem_marker Error hi def link sisu_error_wspace Error hi def link sisu_error Error let b:current_syntax = "sisu" +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/data/sisu/v3/v/version.yml b/data/sisu/v3/v/version.yml index 78011058..2729abab 100644 --- a/data/sisu/v3/v/version.yml +++ b/data/sisu/v3/v/version.yml @@ -1,5 +1,5 @@ --- -:version: 3.1.12 -:date_stamp: 2012w04/1 -:date: "2012-01-23" +:version: 3.1.13 +:date_stamp: 2012w05/5 +:date: "2012-02-03" :project: SiSU diff --git a/data/sisu/v3dv/conf/editor-syntax-etc/vim/syntax/sisu.vim b/data/sisu/v3dv/conf/editor-syntax-etc/vim/syntax/sisu.vim index bfcfc3e6..4545ee8f 100644 --- a/data/sisu/v3dv/conf/editor-syntax-etc/vim/syntax/sisu.vim +++ b/data/sisu/v3dv/conf/editor-syntax-etc/vim/syntax/sisu.vim @@ -11,6 +11,8 @@ elseif exists("b:current_syntax") finish else endif +let s:cpo_save = &cpo +set cpo&vim "% "Errors: syn match sisu_error contains=sisu_link,sisu_error_wspace "<![^ei]\S\+!>" @@ -260,3 +262,5 @@ hi def link sisu_error_sem_marker Error hi def link sisu_error_wspace Error hi def link sisu_error Error let b:current_syntax = "sisu" +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/data/sisu/v3dv/conf/editor-syntax-etc/vim/syntax/sisu_next.vim b/data/sisu/v3dv/conf/editor-syntax-etc/vim/syntax/sisu_next.vim index 61504dbd..257e1cba 100644 --- a/data/sisu/v3dv/conf/editor-syntax-etc/vim/syntax/sisu_next.vim +++ b/data/sisu/v3dv/conf/editor-syntax-etc/vim/syntax/sisu_next.vim @@ -11,6 +11,8 @@ elseif exists("b:current_syntax") finish else endif +let s:cpo_save = &cpo +set cpo&vim "% "Errors: syn match sisu_error contains=sisu_link,sisu_error_wspace "<![^ei]\S\+!>" @@ -275,3 +277,5 @@ hi def link sisu_error_sem_marker Error hi def link sisu_error_wspace Error hi def link sisu_error Error let b:current_syntax = "sisu" +let &cpo = s:cpo_save +unlet s:cpo_save diff --git a/data/sisu/v3dv/v/version.yml b/data/sisu/v3dv/v/version.yml index 2e506e6d..ea289dd5 100644 --- a/data/sisu/v3dv/v/version.yml +++ b/data/sisu/v3dv/v/version.yml @@ -1,5 +1,5 @@ --- -:version: 3.2.0~pre_3.1.12 -:date_stamp: 2012w04/1 -:date: "2012-01-23" +:version: 3.2.0~pre_3.1.13 +:date_stamp: 2012w05/5 +:date: "2012-02-03" :project: SiSU diff --git a/lib/sisu/v3/concordance.rb b/lib/sisu/v3/concordance.rb index a94531b6..96101585 100644 --- a/lib/sisu/v3/concordance.rb +++ b/lib/sisu/v3/concordance.rb @@ -115,7 +115,7 @@ module SiSU_Concordance @fnb=@md.fnb @lex_button=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="#{@file.path_rel_links.html_seg_2}_sisu/image/sisu.png" alt="SiSU home -->"></a>} @doc_details =<<WOK -<table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right"> </td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.fn[:toc]}" #{@vz.js_toc}><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.author}</p></td></tr></table> +<table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right"> </td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.file.base_filename.html_segtoc}" #{@vz.js_toc}><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.author}</p></td></tr></table> WOK end def create diff --git a/lib/sisu/v3/dal_doc_str.rb b/lib/sisu/v3/dal_doc_str.rb index c7d3087c..7bc36e11 100644 --- a/lib/sisu/v3/dal_doc_str.rb +++ b/lib/sisu/v3/dal_doc_str.rb @@ -528,219 +528,6 @@ module SiSU_document_structure_extract h={ obj: str, ocn_: false } SiSU_document_structure::Object_para.new.paragraph(h) end - def metadata - meta=[] - dir=SiSU_Env::Info_env.new(@md.fns) - base_html="#{dir.url.root}/#{@md.fnb}" - l=SiSU_Env::Standardise_language.new(@md.opt.lng).language - language=l[:n] - tr=SiSU_Translate::Source.new(@md,language) - meta << @pb - h={ ln: 2, obj: 'Metadata', ocn_: false } - meta << SiSU_document_structure::Object_heading.new.heading(h) - h={ ln: 4, name: 'metadata', obj: 'Metadata', autonum_: false, ocn_: false } - meta << SiSU_document_structure::Object_heading.new.heading(h) #add ocnm - s="Document Manifest @\n #{base_html}/#{@md.fn[:manifest]}" - meta << meta_para(s) - s="#{Mx[:fa_bold_o]}Dublin Core#{Mx[:fa_bold_c]} (DC)" #add ocnm - meta << meta_para(s) - s="#{Mx[:fa_italics_o]}DC tags included with this document are provided here.#{Mx[:fa_italics_c]}" #add ocnm - meta << meta_para(s) - if defined? @md.title.full \ - and @md.title.full=~/\S+/ - s="#{tr.full_title}: #{Mx[:fa_underscore_o]}#{@md.title.full}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.creator.author \ - and @md.creator.author=~/\S+/ - s="\n#{tr.author}: #{Mx[:fa_underscore_o]}#{@md.creator.author}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.creator.translator \ - and @md.creator.translator=~/\S+/ - s="#{tr.translator}: #{Mx[:fa_underscore_o]}#{@md.creator.translator}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.creator.illustrator \ - and @md.creator.illustrator=~/\S+/ - s="#{tr.illustrator}: #{Mx[:fa_underscore_o]}#{@md.creator.illustrator}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.creator.prepared_by \ - and @md.creator.prepared_by=~/\S+/ - s="\n#{tr.prepared_by}: #{Mx[:fa_underscore_o]}#{@md.creator.prepared_by}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.creator.digitized_by \ - and @md.creator.digitized_by=~/\S+/ - s="#{tr.digitized_by}: #{Mx[:fa_underscore_o]}#{@md.creator.digitized_by}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.rights.all \ - and @md.rights.all=~/\S+/ - s="\n#{tr.rights}: #{Mx[:fa_underscore_o]}#{@md.rights.all}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.notes.description \ - and @md.notes.description=~/\S+/ - s="#{tr.description}: #{Mx[:fa_underscore_o]}#{@md.notes.description}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.subject \ - and @md.classify.subject=~/\S+/ - s="#{tr.subject}: #{Mx[:fa_underscore_o]}#{@md.classify.subject}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.publisher \ - and @md.publisher=~/\S+/ - s="\n#{tr.publisher}: #{Mx[:fa_underscore_o]}#{@md.publisher}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.creator.contributor \ - and @md.creator.contributor=~/\S+/ - s="\n#{tr.contributor}: #{Mx[:fa_underscore_o]}#{@md.creator.contributor}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.notes.abstract \ - and @md.notes.abstract=~/\S+/ - s="\n#{tr.abstract}: #{Mx[:fa_underscore_o]}#{@md.notes.abstract}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.date.created \ - and @md.date.created=~/\S+/ - s="\n#{tr.date_created}: #{Mx[:fa_underscore_o]}#{@md.date.created}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.date.issued \ - and @md.date.issued=~/\S+/ - s="\n#{tr.date_issued}: #{Mx[:fa_underscore_o]}#{@md.date.issued}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.date.available \ - and @md.date.available=~/\S+/ - s="\n#{tr.date_available}: #{Mx[:fa_underscore_o]}#{@md.date.available}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.date.modified \ - and @md.date.modified=~/\S+/ - s="\n#{tr.date_modified}: #{Mx[:fa_underscore_o]}#{@md.date.modified}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.date.valid \ - and @md.date.valid=~/\S+/ - s="\n#{tr.date_valid}: #{Mx[:fa_underscore_o]}#{@md.date.valid}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.date.published \ - and @md.date.published=~/\S+/ - s="\n#{tr.date}: #{Mx[:fa_underscore_o]}#{@md.date.published}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.loc \ - and @md.classify.loc=~/\S+/ - s="\n#{tr.cls_loc}: #{Mx[:fa_underscore_o]}#{@md.classify.loc}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.dewey \ - and @md.classify.dewey=~/\S+/ - s="\n#{@cls_dewey}: #{Mx[:fa_underscore_o]}#{@md.classify.dewey}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.pg \ - and @md.classify.pg=~/\S+/ - s="\n#{tr.cls_gutenberg}: #{Mx[:fa_underscore_o]}#{@md.classify.pg}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.isbn \ - and @md.classify.isbn=~/\S+/ - s="\n#{tr.cls_isbn}: #{Mx[:fa_underscore_o]}#{@md.classify.isbn}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.notes.comment \ - and @md.notes.comment=~/\S+/ - s="\n#{tr.comments}: #{Mx[:fa_underscore_o]}#{@md.notes.comment}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.notes.prefix_a \ - and @md.notes.prefix_a=~/\S+/ - s="\n#{tr.prefix_a}: #{Mx[:fa_underscore_o]}#{@md.notes.prefix_a}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.notes.prefix_b \ - and @md.notes.prefix_b=~/\S+/ - s="\n#{tr.prefix_b}: #{Mx[:fa_underscore_o]}#{@md.notes.prefix_b}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.identifier \ - and @md.classify.identifier=~/\S+/ - s="\n#{tr.identifier}: #{Mx[:fa_underscore_o]}#{@md.classify.identifier}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.original.source \ - and @md.original.source=~/\S+/ - s="\n#{tr.source}: #{Mx[:fa_underscore_o]}#{@md.original.source}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.title.language \ - and @md.title.language=~/\S+/ - s="\n#{tr.language}: #{Mx[:fa_underscore_o]}#{@md.title.language}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.original.language \ - and @md.original.language=~/\S+/ - s="\n#{tr.language_original}: #{Mx[:fa_underscore_o]}#{@md.original.language}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.format \ - and @md.classify.format=~/\S+/ - s="\n#{tr.format}: #{Mx[:fa_underscore_o]}#{@md.classify.format}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.relation \ - and @md.classify.relation=~/\S+/ - s="\n#{tr.relation}: #{Mx[:fa_underscore_o]}#{@md.classify.relation}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.coverage \ - and @md.classify.coverage=~/\S+/ - s="\n#{tr.coverage}: #{Mx[:fa_underscore_o]}#{@md.classify.coverage}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.keywords \ - and @md.classify.keywords=~/\S+/ - s="\n#{tr.keywords}: #{Mx[:fa_underscore_o]}#{@md.classify.keywords}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - s="#{Mx[:fa_bold_o]}Version Information#{Mx[:fa_bold_c]}" - meta << meta_para(s) - if defined? @md.fns \ - and @md.fns=~/\S+/ - s="#{tr.sourcefile}: #{Mx[:fa_underscore_o]}#{@md.fns}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.file_encoding \ - and @md.file_encoding=~/\S+/ - s="Filetype: #{Mx[:fa_underscore_o]}#{@md.file_encoding}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.dgst \ - and @md.dgst.class==Array - s="Source Digest: #{@md.dgst[0]} #{Mx[:fa_underscore_o]}#{@md.dgst[1]}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.dgst_skin \ - and @md.dgst_skin.class==Array - s="Skin Digest: #{@md.dgst_skin[0]} #{Mx[:fa_underscore_o]}#{@md.dgst_skin[1]}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - s="#{Mx[:fa_bold_o]}Generated#{Mx[:fa_bold_c]}" - meta << meta_para(s) - s="#{tr.last_generated}: #{Mx[:fa_underscore_o]}#{Time.now}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - s="#{tr.sisu_version}: #{Mx[:fa_underscore_o]}#{@md.sisu_version[:project]}#{Mx[:fa_underscore_c]} #{Mx[:fa_underscore_o]}#{@md.sisu_version[:version]}#{Mx[:fa_underscore_c]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" - meta << meta_para(s) - meta - end def build_lines(type='') data=@data data.each do |line| diff --git a/lib/sisu/v3/epub_concordance.rb b/lib/sisu/v3/epub_concordance.rb index 66864775..c2a289a2 100644 --- a/lib/sisu/v3/epub_concordance.rb +++ b/lib/sisu/v3/epub_concordance.rb @@ -74,9 +74,6 @@ module SiSU_EPUB_Concordance def read begin @env,@md=@particulars.env,@particulars.md - loc=@env.url.output_tell - tool=((@md.opt.cmd =~/[MVv]/) ? "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:concordance]}" : '') - SiSU_Screen::Ansi.new(@md.opt.cmd,"Concordance",tool).grey_title_hi unless @md.opt.cmd =~/q/ wordmax=@env.concord_max unless @md.wc_words.nil? if @md.wc_words < wordmax @@ -106,7 +103,7 @@ module SiSU_EPUB_Concordance @fnb=@md.fnb @lex_button=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="../_sisu/image/sisu.png" alt="SiSU home -->"></a>} @doc_details =<<WOK -<table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right"> </td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.fn[:toc]}" #{@vz.js_toc}><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.creator.author}</p></td></tr></table> +<table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right"> </td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.file.base_filename.epub}" #{@vz.js_toc}><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.creator.author}</p></td></tr></table> WOK end def create diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index 40fe8816..31bae51b 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -1718,50 +1718,12 @@ WOK </html>} end end - class Widget < Head_information - def initialize(md) - super(md) - @md=md - @cf_defaults=SiSU_Env::Info_processing_flag.new - end - def home - %{<td align="center" bgcolor=#{@vz.color_band2}> - <a href="../index.html" target="_top"> - #{@vz.png_homepage}</a> -</td> -} - end - def search - env=SiSU_Env::Info_env.new(@md.fns,@md) - env.widget.search_form('sisusearch',nil,nil,true) - end - def manifest - %{<td align="center" bgcolor=#{@vz.color_band2}> - <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}> - #{@vz.nav_txt_manifest} - </a> -</td>} - end - end - class XML - end class Head_toc < Head_information def initialize(md) super(md) @md=md @tocband_segtoc=make_seg end - def concordance_navigation_band(type='') - if type=~/pdf/ - @tocband_concordance=make_concordance - end - %{<p class="align_right"> - <a href="index.html" target="_top"> - #{@vz.epub_png_nav_toc} - </a> -</p> -} - end def seg_head_navigation_band firstseg=%{<a href="#{@md.firstseg}#{Sfx[:epub_xhtml]}" target="_top"> #{@vz.epub_png_nav_nxt} @@ -1778,30 +1740,17 @@ WOK ? '' : %{<p class="align_right">#{firstseg}</p>} end - def manifest_link(text) #watch fix removed font size 2 - %{ <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>#{text}</a>} + def manifest_link(text) + %{ <a href="#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}" target="_top" #{@vz.js_manifest}>#{text}</a>} end def concordance_link(text) #watch fix removed font size 2 if @md.concord_make - %{<a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}> + %{<a href="#{@md.file.base_filename.html_concordance}" target="_top" #{@vz.js_concordance}> #{text} </a>} else '' end end - def make_concordance - manifest=scroll=seg='' - wgt=Widget.new(@md) - %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{wgt.seg(@vz.nav_txt_toc_link)}#{wgt.scroll(@vz.nav_txt_doc_link)}#{wgt.pdf}#{wgt.odf} -<td align="center" bgcolor=#{@vz.color_band2}> - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - end def head %{#{doc_type} <head> @@ -1815,7 +1764,7 @@ WOK if @md.concord_make %{#{@vz.margin_css} <h4 class="toc"> - <a href="./#{@md.fn[:concordance]}" #{@vz.js_concordance}> + <a href="./#{@md.file.base_filename.html_concordance}" #{@vz.js_concordance}> <i>Concordance</i> </a> </h4> @@ -1879,10 +1828,6 @@ WOK </h4> #{@vz.table_close}} end - def seg_metadata - @metalink=%{./#{@md.fn[:metadata]}} - metadata - end end class Head_seg < Head_information def initialize(md) @@ -1896,225 +1841,15 @@ WOK #{@md.html_title} </title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -#{@vz.font_css_table_file} +#{@css.xhtml_epub} </head> -#{@vz.color_body} -#{@vz.js_top}} - end - def title_banner(title,subtitle,creator) - end - def dot_control_pre_next - %{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> -<tr><td align="left"> - <a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker-1]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_prev}> - #{@vz.png_nav_dot_pre} - </a> -</td> -<td align="center"> - <a href="#{@index}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_toc}> - #{@vz.png_nav_dot_toc} - </a> -</td> -<td align="right"> - <a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker+1]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_next}> - #{@vz.png_nav_dot_nxt} - </a> -#{@vz.table_close}} - end - def dot_control_pre - %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> -<tr><td align="left"> - <a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker-1]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_prev}> - #{@vz.png_nav_dot_pre} - </a> -</td> -<td align="center"> - <a href="#{@index}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_toc}> - #{@vz.png_nav_dot_toc} - </a> -</td> -<td align="right"> - <a href="#{@md.fn[:toc]}" target="_top" #{@vz.js_next}> - #{@vz.png_nav_dot_nxt} - </a> -#{@vz.table_close}} - end - def toc_nav(f_pre=false,f_nxt=false,use=1) - pre=nxt='' - toc=%{<a href="#{@index}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_toc}> - #{@vz.epub_png_nav_toc} -</a> -} - pre=%{<a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker-use]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_prev}> - #{@vz.epub_png_nav_pre} -</a> -} if f_pre==true - nxt=%{<a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker+1]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_next}> - #{@vz.epub_png_nav_nxt} - </a> -} if f_nxt==true - DISABLE[:epub][:internal_navigation] \ - ? '' - : %{<p class="align_right"> -#{pre} -#{toc} -#{nxt} -</p> -} - end - def toc_next2 - pre,nxt=false,true - toc_nav(false,true).dup - end - def toc_pre_next2 - toc_nav(true,true).dup - end - def toc_pre2 - toc_nav(true,false).dup - end - def manifest_link(text) - %{<a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}> - #{text} - </a>} - end - def concordance_link(text) - if @md.concord_make - %{<a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}> - #{text} - </a>} - else '' - end - end - def doc_types #used in seg_nav_band ### - scroll=seg='' - wgt=Widget.new(@md) - x=if @md.concord_make - %{ -<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{wgt.seg(@vz.nav_txt_toc_link)} - #{wgt.scroll(@vz.nav_txt_doc_link)} - #{wgt.pdf}#{wgt.odf} -<td align="center" bgcolor=#{@vz.color_band2}> - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - else - %{ -<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{wgt.seg(@vz.nav_txt_toc_link)} - #{wgt.scroll(@vz.nav_txt_doc_link)} - #{wgt.pdf}#{wgt.odf} -<td align="center" bgcolor=#{@vz.color_band2}> - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - end - end - def navigation_table - %{<table summary="navigation segment table" width=#{@vz.table_width_1} border="0" bgcolor="white" cellpadding="0"> -<tr><th width="#{@@indent['leve_1']}" align="right"> -</td> -<td valign="top"> - <font size=2>} - end - def navigation_table1 - %{<table summary="navigation segment table1" width=#{@vz.table_width_1} border="0" cellpadding=#{@vz.table_cellpad_box} bgcolor=#{@vz.color_table1} align="left"> -<tr><td valign="top"> - <font size="2">} - end - def navigation_table2 - %{<table summary="navigation segment table2" width=#{@vz.table_width_2} border="0" cellpadding=#{@vz.table_cellpad_box} bgcolor=#{@vz.color_table2} align="left"> -<tr><td valign="top"> - <font size="2">} - end - def heading_advert_local_1 - dir=SiSU_Env::Info_env.new(@fns) - %{ <p class="center"> -<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center"> -<tr><td align="center" bgcolor="white"> - <a href="http://#{@md.ad_url}#{Sfx[:epub_xhtml]}" target="_top"> - <img border="0" src="#{dir.url.images_epub}/#{@md.ad_png}" alt="#{@md.ad_alt}" /> - </a> -#{@vz.table_close} -</p>} - end - def heading_advert_local_2 - dir=SiSU_Env::Info_env.new(@fns) - %{ <p class="center"> -<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center"> -<tr><td align="center" bgcolor="white"> - <a href="#{@md.ad_url}#{Sfx[:epub_xhtml]}" target="_top"> - <img border="0" src="#{dir.url.images_epub}/#{@md.ad_png}" alt="#{@md.ad_alt}" /> - </a> -#{@vz.table_close} -</p>} - end - def heading_advert_external - dir=SiSU_Env::Info_env.new(@fns) - %{ <p class="center"> -<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center"> -<tr><td align="center" bgcolor="white"> - <a href="#{@md.ad_url}#{Sfx[:epub_xhtml]}" target="external"> - <img border="0" src="#{dir.url.images_epub}/#{@md.ad_png}" alt="#{@md.ad_alt}" /> - </a> -#{@vz.table_close} -</p>} - end - def navigation_band(segtocband) #change name to navigaion_band_banner - %{#{segtocband} -} - end - def navigation_band_bottom(segtocband,seg_table_top_control) #change name to navigaion_band_bannerless - %{ -<div class="main_column"> - <table summary="segment navigation band" bgcolor=#{@vz.color_band1} width="100%"><tr> - <td width="70%" align="center"> - #{doc_types} - </td> - <td width="30%" align="right"> - #{segtocband} - </td></tr> - </table> - #{seg_table_top_control} -</div> -} +#{@vz.color_body}} end def endnote_mark %{ <hr class="endnote" /> } end - def endnote_section_open -%{ -<div class="endnote"> -} - end - def endnote_section_close -%{ -</div> -} #revisit - end - def head - %{#{doc_type} -<head> - <title> - #{@seg_name_xhtml[@seg_name_xhtml_tracker]} - - #{@md.html_title} - </title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -#{@css.xhtml_epub} -</head> -#{@vz.color_body}} - end - def toc_metadata - @metalink=%{./#{@md.fn[:metadata]}} - toc_metadata - end def title_banner(title,subtitle,creator) end end diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb index 6ad278f4..5e08968a 100644 --- a/lib/sisu/v3/epub_segments.rb +++ b/lib/sisu/v3/epub_segments.rb @@ -70,8 +70,6 @@ module SiSU_EPUB_seg filename_seg << @seg[:title] << @seg[:nav] if @type=='endnotes' @seg[:headings]=[] - format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md) - @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author) txt_obj={ txt: 'Endnotes', ocn_display: ''} format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj) @seg[:headings] << format_seg.title_heading1 @@ -79,8 +77,6 @@ module SiSU_EPUB_seg elsif @type=='idx' @seg[:headings]=[] format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md) - @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author) - txt_obj={ txt: 'Index', ocn_display: ''} format_seg=SiSU_EPUB_Format::Format_seg.new(@md,txt_obj) @seg[:headings] << format_seg.title_heading1 filename_seg << @seg[:heading_idx] << @seg[:headings] << %{\n<div class="content">\n} << @seg[:idx] << '</div>' @@ -132,10 +128,9 @@ WOK @@loop_count=@@seg_total=@@tracker=0 @@is4=@@is3=@@is2=@@is1=0 @@heading1=@@heading2=@@heading3=@@heading4=0 - @@seg[:nav],@@seg[:title],@@seg[:headings],@@seg[:main],@@seg[:idx],@@seg[:tail],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(10){[]} + @@seg[:title],@@seg[:headings],@@seg[:main],@@seg[:idx],@@seg[:tail],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(8){[]} @@seg[:heading_endnotes]='' @@tablehead,@@number_of_cols=0,0 - @@segtocband=nil @@fns_previous='' attr_reader :seg_name_xhtml,:seg_name_xhtml_tracker def initialize(md='',data='') @@ -298,30 +293,16 @@ WOK end def heading_art(dob) format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md) - if dob.is=='heading' \ - and dob.ln =~/^[1-6]/ - @@seg[:dot_nav]= (@@tracker < @@seg_total-1) \ - ? format_head_seg.dot_control_pre_next - : format_head_seg.dot_control_pre - end @@seg[:title]=format_head_seg.head end def head(dob) clean=/<!.*?!>|<:.*?>$/ - format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md) - if @@tracker < @@seg_total-1 - @@segtocband=(@@tracker==0) \ - ? format_head_seg.toc_next2 - : format_head_seg.toc_pre_next2 - else @@segtocband=format_head_seg.toc_pre2 #if format_head_seg.toc_pre2 - end @p_num ||= '' if @@is1==1 if defined? @md.creator.author \ and @md.creator.author @author=%{<b>#{@md.creator.author}</b>\n} end - @@seg[:nav] << format_head_seg.navigation_band(@@segtocband) ocn=if @@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix else '' end @@ -452,8 +433,7 @@ WOK @@seg[:close] << format_head_seg.xhtml_close end def reinitialise - @@seg[:title],@@seg[:dot_nav],@@seg[:nav],@@seg[:headings],@@seg[:main],@@seg[:tail],@@seg[:credits]=Array.new(8){[]} - @@segtocband=nil + @@seg[:title],@@seg[:headings],@@seg[:main],@@seg[:tail],@@seg[:credits]=Array.new(5){[]} end def cleanup reinitialise diff --git a/lib/sisu/v3/html.rb b/lib/sisu/v3/html.rb index f1fab3c4..85c1d602 100644 --- a/lib/sisu/v3/html.rb +++ b/lib/sisu/v3/html.rb @@ -146,7 +146,7 @@ module SiSU_HTML @md.opt.cmd=@md.opt.cmd.gsub(/H/,'h') @md.file_type='html' if @md.opt.cmd =~/[hon]/ directories - newfilename=%{#{@env.path.output}/#{@md.fnb}/#{@md.fn[:index]}} if @md.file_type =~/html/ + newfilename=%{#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_segtoc}} if @md.file_type =~/html/ dal_array=@particulars.dal_array # dal file drawn here @tuned_file_array=SiSU_HTML_Tune::Tune.new(dal_array,@md).songsheet @tuned_file_array diff --git a/lib/sisu/v3/html_format.rb b/lib/sisu/v3/html_format.rb index e852780a..3dd0cecc 100644 --- a/lib/sisu/v3/html_format.rb +++ b/lib/sisu/v3/html_format.rb @@ -176,7 +176,7 @@ module SiSU_HTML_Format end def seg(text) %{<td align="center" bgcolor="#99CC66"> - <a href="#{@md.fn[:toc]}" target="_top" #{@vz.js_doc}> + <a href="#{@md.file.base_filename.html_segtoc}" target="_top" #{@vz.js_doc}> #{text} </a> </td> @@ -253,7 +253,7 @@ module SiSU_HTML_Format if @md.concord_make \ and @md.wc_words < 300000 #max word count for display of concordance here as would now be a large file %{<td align="center" bgcolor=#{@vz.color_band2}> - <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}> + <a href="#{@md.file.base_filename.html_concordance}" target="_top" #{@vz.js_concordance}> #{text} </a> </td>} @@ -336,13 +336,13 @@ WOK def manifest_link(text) # @file=SiSU_Env::SiSU_file.new(@md) if @md %{<font size=2> - <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>#{text}</a> + <a href="#{@md.file.base_filename.manifest}" target="_top" #{@vz.js_manifest}>#{text}</a> </font>} end def concordance_link(text) if @md.concord_make %{<font size=2> - <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}> + <a href="#{@md.file.base_filename.html_concordance}" target="_top" #{@vz.js_concordance}> #{text} </a> </font>} @@ -406,7 +406,7 @@ WOK if @md.concord_make %{#{@vz.margin_css} <h4 class="toc"> - <a href="./#{@md.fn[:concordance]}" #{@vz.js_concordance}> + <a href="./#{@md.file.base_filename.html_concordance}" #{@vz.js_concordance}> <i>Concordance</i> </a> </h4> @@ -431,7 +431,7 @@ WOK Quick Ref.: </li> <li class="ref"> - <a href="#{@md.fn[:manifest]}" alt="Document Manifest" target="_top"> + <a href="#{@md.file.base_filename.manifest}" alt="Document Manifest" target="_top"> Manifest </a> </li> @@ -452,7 +452,7 @@ WOK Quick Ref.: </li> <li class="ref"> - <a href="#{@md.fn[:manifest]}" alt="Document Manifest" target="_top"> + <a href="#{@md.file.base_filename.manifest}" alt="Document Manifest" target="_top"> Manifest </a> </li> @@ -553,10 +553,6 @@ WOK </h4> #{@vz.table_close}} end - def seg_metadata - @metalink=%{./#{@md.fn[:metadata]}} - metadata - end def seg_tail %{ <div class="main_column"> @@ -625,24 +621,6 @@ WOK def initialize(md) #(md='') super(md) end - def head - rdf=SiSU_XML_tags::RDF.new(@md) - %{#{doc_type} -<head> - <title> - #{@seg_name_html[@seg_name_html_tracker]} - - #{@md.html_title} - </title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -#{rdf.metatag_html} -#{@vz.font_css_table_file} -</head> -#{@vz.color_body} -<a name="top" id="top"></a> -<a name="up" id="up"></a> -<a name="start" id="start"></a> -#{@vz.js_top}} - end def title_banner(title,subtitle,creator) end def dot_control_pre_next @@ -676,7 +654,7 @@ WOK def dot_control_pre pre="#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.lang_code_insert}#{Sfx[:html]}" up="#{@toc}#{@md.lang_code_insert}#{Sfx[:html]}" - nxt="#{@md.fn[:toc]}" + nxt="#{@md.file.base_filename.html_segtoc}" %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> <tr><td align="left"> <a href="#{pre}" target="_top" #{@vz.js_prev}> @@ -738,7 +716,7 @@ WOK end def manifest_link(text) %{<font size=2> - <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}> + <a href="#{@md.file.base_filename.manifest}" target="_top" #{@vz.js_manifest}> #{text} </a> </font>} @@ -746,7 +724,7 @@ WOK def concordance_link(text) if @md.concord_make %{<font size=2> - <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}> + <a href="#{@md.file.base_filename.html_concordance}" target="_top" #{@vz.js_concordance}> #{text} </a> </font>} @@ -865,24 +843,6 @@ WOK </div> } #revisit end - def head - rdf=SiSU_XML_tags::RDF.new(@md) - %{#{doc_type} -<head> - <title> - #{@seg_name_html[@seg_name_html_tracker]} - - #{@md.html_title} - </title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -#{rdf.metatag_html} -#{@css.html} -</head> -#{@vz.color_body} -<a name="top" id="top"></a> -<a name="up" id="up"></a> -<a name="start" id="start"></a> -#{@vz.js_top}} - end def head_seg rdf=SiSU_XML_tags::RDF.new(@md) %{#{doc_type} @@ -901,10 +861,6 @@ WOK <a name="start" id="start"></a> #{@vz.js_top}} end - def toc_metadata - @metalink=%{./#{@md.fn[:meatadata]}} - toc_metadata - end def title_banner(title,subtitle,creator) %{ <div class="summary"> diff --git a/lib/sisu/v3/manpage.rb b/lib/sisu/v3/manpage.rb index 2dcccb5a..8cbdb47c 100644 --- a/lib/sisu/v3/manpage.rb +++ b/lib/sisu/v3/manpage.rb @@ -176,7 +176,7 @@ GSUB .TP Other versions of this document: .TP -manifest: <#{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:manifest]}> + manifest: <#{@md.file.output_path.digest.url}/#{@md.file.base_filename.digest}> .TP at: <#{vz.url_site}> .TP diff --git a/lib/sisu/v3/odf.rb b/lib/sisu/v3/odf.rb index 4cf46d99..6cdbd57b 100644 --- a/lib/sisu/v3/odf.rb +++ b/lib/sisu/v3/odf.rb @@ -154,8 +154,8 @@ module SiSU_ODF else '' end url=@md.fnb - fn=@md.fn[:manifest] - manifest="#{@env.url.root}/#{@md.fnb}/#{@md.fn[:manifest]}" + fn=@md.file.base_filename.manifest + manifest="#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}" @@odf[:tail] << %{<text:p text:style-name="P_normal">Available document outputs: <br /> <<text:a xlink:type="simple" xlink:href="#{manifest}">#{manifest}</text:a>></text:p>} @@odf[:tail] << %{\n<text:p text:style-name="P_normal">SiSU: <<text:a xlink:type="simple" xlink:href="http://www.jus.uio.no/lm">www.jus.uio.no/sisu</text:a>> and <<text:a xlink:type="simple" xlink:href="http://www.sisudoc.org">www.sisudoc.org</text:a>></text:p>} @@odf[:tail] << "\n</office:text></office:body></office:document-content>" @@ -719,7 +719,7 @@ WOK od.puts para unless para =~/\A\s*\Z/ end od.close - opendoc=@md.fn[:odf] + opendoc=@md.file.base_filename.odt #watch where output by language FileUtils::mkdir_p(@md.file.output_path.odt.dir) unless FileTest.directory?(@md.file.output_path.odt.dir) if FileTest.directory?(@env.processing_path.odt) pwd=Dir.pwd diff --git a/lib/sisu/v3/plaintext.rb b/lib/sisu/v3/plaintext.rb index 533e35df..f9a2a235 100644 --- a/lib/sisu/v3/plaintext.rb +++ b/lib/sisu/v3/plaintext.rb @@ -200,12 +200,12 @@ WOK @plaintext[:tail] <<<<WOK #{@br} plaintext (plain text): - #{base_url}/#{@md.fn[:plain]}#{@br} + #{@md.file.output_path.txt.url}/#{@md.file.base_filename.txt}#{@br} Other versions of this document: #{@br} manifest: - #{base_url}/#{@md.fn[:manifest]}#{@br} + #{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}#{@br} at: - #{@env.url.root}#{@br} + #{@md.file.output_path.base.url}#{@br} #{sc} * #{generator} diff --git a/lib/sisu/v3/shared_metadata.rb b/lib/sisu/v3/shared_metadata.rb index 06d382c3..ca81998b 100644 --- a/lib/sisu/v3/shared_metadata.rb +++ b/lib/sisu/v3/shared_metadata.rb @@ -1001,7 +1001,7 @@ WOK language=l[:n] tr=SiSU_Translate::Source.new(@md,language) tag="Document Manifest @" - inf="#{@br}#{base_html}/#{@md.fn[:manifest]}" + inf="#{@br}#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}" meta << meta_para(tag,inf) if defined? @md.title.full \ and @md.title.full=~/\S+/ diff --git a/lib/sisu/v3/texpdf_format.rb b/lib/sisu/v3/texpdf_format.rb index 76fc5d37..25cb0c63 100644 --- a/lib/sisu/v3/texpdf_format.rb +++ b/lib/sisu/v3/texpdf_format.rb @@ -1551,16 +1551,6 @@ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu } \\\\ \\end{small}}& WOK end - def manifest_info - url=@md.fnb.gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1') - fn=@md.fn[:manifest].gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1') -<<WOK -{\\begin{footnotesize} -\\\\ For alternative output formats of this document check: -\\\\ #{@brace_url.tex_open}\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{fn}}{#{@vz.url_root_http}/#{url}/#{fn}}\\end{scriptsize}#{@brace_url.tex_close} -\\end{footnotesize}}& -WOK - end def endnotes #not used should be inserted before MetaData section which preceeds doc_tail, but is "part of document" <<WOK \\subsection*{Endnotes} diff --git a/lib/sisu/v3/update.rb b/lib/sisu/v3/update.rb index e46743ec..5b5430e2 100644 --- a/lib/sisu/v3/update.rb +++ b/lib/sisu/v3/update.rb @@ -83,42 +83,48 @@ module SiSU_Update_control_flag @env=SiSU_Env::Info_env.new(@md.fns) out=@env.path.output @base_path="#{out}/#{@md.fnb}" + @pdf_fn=SiSU_Env::SiSU_file.new(@md).base_filename end def set_flags #-mNhwpoabxXyv flag='-v' - if FileTest.file?("#{@base_path}/#{@md.fn[:doc]}")==true + if FileTest.file?("#{@md.file.output_path.txt.dir}/#{@md.file.base_filename.txt}")==true flag=flag + 'a' end - if FileTest.file?("#{@base_path}/#{@md.fn[:toc]}")==true \ - or FileTest.file?("#{@base_path}/#{@md.fn[:doc]}")==true + if FileTest.file?("#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_seg}")==true + or FileTest.file?("#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_scroll}")==true flag=flag + 'h' end - if FileTest.file?("#{@base_path}/#{@md.fn[:xhtml]}")==true + if FileTest.file?("#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}")==true flag=flag + 'b' end - if FileTest.file?("#{@base_path}/#{@md.fn[:sax]}")==true + if FileTest.file?("#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}")==true flag=flag + 'x' end - if FileTest.file?("#{@base_path}/#{@md.fn[:dom]}")==true + if FileTest.file?("#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}")==true flag=flag + 'X' end - if FileTest.file?("#{@base_path}/#{@md.fn[:odf]}")==true + if FileTest.file?("#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}")==true + flag=flag + 'e' + end + if FileTest.file?("#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}")==true flag=flag + 'o' end - if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_p]}")==true \ - or FileTest.file?("#{@base_path}/#{@md.fn[:pdf_l]}")==true + if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_p_a4}")==true \ + or FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_l_a4}")==true \ + or FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_p_letter}")==true \ + or FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_l_letter}")==true flag=flag + 'p' end - if FileTest.file?("#{@base_path}/#{@md.fn[:concordance]}")==true + if FileTest.file?("#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}")==true flag=flag + 'w' end - if FileTest.file?("#{@base_path}/#{@md.fn[:digest]}")==true + if FileTest.file?("#{@md.file.output_path.digest.dir}/#{@md.file.base_filename.digest}")==true flag=flag + 'N' end - if FileTest.file?("#{@base_path}/#{@md.fns}")==true + if FileTest.file?("#{@md.file.output_path.src.dir}/#{@md.file.base_filename.src}")==true flag=flag + 's' end - if FileTest.file?("#{@base_path}/sisupod.tgz")==true + if FileTest.file?("#{@md.file.output_path.sisupod.dir}/#{@md.file.base_filename.sisupod}")==true flag=flag + 'S' end puts flag diff --git a/lib/sisu/v3/xhtml.rb b/lib/sisu/v3/xhtml.rb index 7f910e47..6f8c6da5 100644 --- a/lib/sisu/v3/xhtml.rb +++ b/lib/sisu/v3/xhtml.rb @@ -83,9 +83,10 @@ module SiSU_XHTML unless @opt.cmd =~/q/ path=@env.path.output_tell loc=@env.url.output_tell - - tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}#{path}/#{@md.fnb}/#{@md.fn[:xhtml]}\n\t#{@env.program.xml_viewer} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}#{path}/#{@md.fnb}/#{@md.fn[:xhtml]}" - elsif @opt.cmd =~/v/; "#{@env.program.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}" + tool=if @opt.cmd =~/[MV]/ + "#{@env.program.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}" + elsif @opt.cmd =~/v/ + "#{@env.program.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}" else "[#{@opt.f_pth[:lng_is]}] #{@opt.fns}" end @opt.cmd=~/[MVvz]/ \ diff --git a/lib/sisu/v3/xml_format.rb b/lib/sisu/v3/xml_format.rb index 39e5d7b8..c0d9d622 100644 --- a/lib/sisu/v3/xml_format.rb +++ b/lib/sisu/v3/xml_format.rb @@ -406,89 +406,6 @@ WOK </html>} end end - class Widget < Head_information - def initialize(md) - super(md) - @md=md - @cf_defaults=SiSU_Env::Info_processing_flag.new - end - def home - %{<td align="center" bgcolor=#{@vz.color_band2}> - <a href="../index.html" target="_top"> - #{@vz.png_homepage}</a> -</td> -} - end - def scroll(text) - if @md.fns =~ /\.(?:-|ssm\.)?sst$/ - scroll=%{<td align="center" bgcolor=#{@vz.color_band2}> - <a href="#{@md.fn[:doc]}" target="_top" #{@vz.js_doc}> - #{text} - </a> -</td> -} - end - end - def seg(text) - %{<td align="center" bgcolor="#99CC66"> - <a href="#{@md.fn[:toc]}" target="_top" #{@vz.js_doc}> - #{text} - </a> -</td> -} - end - def search - env=SiSU_Env::Info_env.new(@md.fns,@md) - env.widget.search_form('sisusearch',nil,nil,true) - end - def manifest - %{<td align="center" bgcolor=#{@vz.color_band2}> - <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}> - #{@vz.nav_txt_manifest} - </a> -</td>} - end - def pdf - pdf=if @md.programs[:pdf] \ - and @cf_defaults.cf_0 =~/p/ - %{ -<td align="center" bgcolor=#{@vz.color_band2}> - <a href="#{@md.fn[:pdf_p]}" target="_top" #{@vz.js_portrait}> - #{@vz.nav_txt_pdf_portrait} - </a> -</td> -<td align="center" bgcolor=#{@vz.color_band2}> - <a href="#{@md.fn[:pdf_l]}" target="_top" #{@vz.js_landscape}> - #{@vz.nav_txt_pdf_landscape} - </a> -</td> -} - else '' - end - end - def odf - odf=if @cf_defaults.cf_0 =~/o/ - %{ -<td align="center" bgcolor=#{@vz.color_band2}> - <a href="#{@md.fn[:odf]}" target="_top" #{@vz.js_odf}> - #{@vz.nav_txt_odf} - </a> -</td>} - else '' - end - end - def concordance(text) - if @md.concord_make \ - and @md.wc_words < 300000 #max word count for display of concordance here as would now be a large file - %{<td align="center" bgcolor=#{@vz.color_band2}> - <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}> - #{text} - </a> - </td>} - else '' - end - end - end class XML end class Head_toc < Head_information @@ -571,21 +488,6 @@ WOK #{@vz.table_close} <p />} end - def manifest_link(text) - %{<font size=2> - <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>#{text}</a> - </font>} - end - def concordance_link(text) - if @md.concord_make - %{<font size=2> - <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}> - #{text} - </a> - </font>} - else '' - end - end def make_seg_scroll_pdf wgt=Widget.new(@md) scroll=%{<td align="center" bgcolor=#{@vz.color_band2}> @@ -650,60 +552,6 @@ WOK <a name="start" id="start"></a> #{@vz.js_top}} end - def concordance - if @md.concord_make - %{#{@vz.margin_css} - <h4 class="toc"> - <a href="./#{@md.fn[:concordance]}" #{@vz.js_concordance}> - <i>Concordance</i> - </a> - </h4> -#{@vz.table_close}} - else - %{#{@vz.margin_css} -#{@vz.table_close}} - end - end - def links_guide_vertical_open #??? - url=(((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/) ? @vz.url_hp : @vz.url_home) - %{ -<div id="vertical_links"> - <ul id="vertical"> - <li class="refbold"> - <a href="#{url}" #{@vz.js_home}> - #{@vz.txt_hp} - </a> - </li> - <li class="ref"> - Quick Ref.: - </li> - <li class="ref"> - <a href="#{@md.fn[:manifest]}" target="_top"> - Manifest - </a> - </li> -<!- quick ref -!>} - end - def links_guide_horizontal_open #??? - url=(((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/) ? @vz.url_hp : @vz.url_home) - %{ -<div id="horizontal_links"> - <ul id="horizontal"> - <li class="refbold"> - <a href="#{url}" #{@vz.js_home}> - #{@vz.txt_hp} - </a> - </li> - <li class="ref"> - Quick Ref.: - </li> - <li class="ref"> - <a href="#{@md.fn[:manifest]}" target="_top"> - Manifest - </a> - </li> -<!- quick ref -!>} - end def links_guide_open(type='horizontal') if type=='vertical'; links_guide_vertical_open else links_guide_horizontal_open @@ -795,10 +643,6 @@ WOK </h4> #{@vz.table_close}} end - def seg_metadata - @metalink=%{./#{@md.fn[:metadata]}} - metadata - end def seg_tail %{ <div class="main_column"> @@ -906,24 +750,6 @@ WOK </a> #{@vz.table_close}} end - def dot_control_pre - %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> -<tr><td align="left"> - <a href="#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" #{@vz.js_prev}> - #{@vz.png_nav_dot_pre} - </a> -</td> -<td align="center"> - <a href="#{@index}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" #{@vz.js_toc}> - #{@vz.png_nav_dot_toc} - </a> -</td> -<td align="right"> - <a href="#{@md.fn[:toc]}" target="_top" #{@vz.js_next}> - #{@vz.png_nav_dot_nxt} - </a> -#{@vz.table_close}} - end def toc_nav(f_pre=false,f_nxt=false,use=1) pre=nxt='' toc=%{<td align="center" bgcolor=#{@vz.color_band1}> @@ -959,23 +785,6 @@ WOK def toc_pre2 toc_nav(true,false,2).dup end - def manifest_link(text) - %{<font size=2> - <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}> - #{text} - </a> - </font>} - end - def concordance_link(text) - if @md.concord_make - %{<font size=2> - <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}> - #{text} - </a> - </font>} - else '' - end - end def doc_types #used in seg_nav_band ### scroll=seg='' wgt=Widget.new(@md) @@ -1137,10 +946,6 @@ WOK <a name="start" id="start"></a> #{@vz.js_top}} end - def toc_metadata - @metalink=%{./#{@md.fn[:meatadata]}} - toc_metadata - end def title_banner(title,subtitle,creator) %{ <div class="summary"> diff --git a/lib/sisu/v3dv/concordance.rb b/lib/sisu/v3dv/concordance.rb index e51514c3..82c53e7a 100644 --- a/lib/sisu/v3dv/concordance.rb +++ b/lib/sisu/v3dv/concordance.rb @@ -115,7 +115,7 @@ module SiSU_Concordance @fnb=@md.fnb @lex_button=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="#{@file.path_rel_links.html_seg_2}_sisu/image/sisu.png" alt="SiSU home -->"></a>} @doc_details =<<WOK -<table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right"> </td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.fn[:toc]}" #{@vz.js_toc}><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.author}</p></td></tr></table> +<table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right"> </td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.file.base_filename.html_segtoc}" #{@vz.js_toc}><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.author}</p></td></tr></table> WOK end def create @@ -238,8 +238,9 @@ WOK @dal_array.each do |line| if defined? line.ocn \ and line.ocn.to_s =~/\d/ - if line.is =~/heading/ \ - and line.ln==4 + if (line.is ==:heading \ + || line.is ==:heading_insert) \ + && line.ln==4 @seg=line.name end ocn=line.ocn.to_s diff --git a/lib/sisu/v3dv/constants.rb b/lib/sisu/v3dv/constants.rb index d39c56ea..439dee68 100644 --- a/lib/sisu/v3dv/constants.rb +++ b/lib/sisu/v3dv/constants.rb @@ -273,8 +273,8 @@ puts "#{__FILE__} #{__LINE__} #{o.inspect}" puts __FILE__ + ' ' + __LINE__.to_s + '--> ' + o.inspect puts %{-\t#{__FILE__}::#{__LINE__}::#{caller}:\n"#{name}"} p "\t" + txt.obj + " << #{__FILE__} #{__LINE__} >>" -p (__FILE__ + ' ' + __LINE__.to_s + '--> ' + dob.inspect) if dob.is=='heading' -data.each {|o| p (__FILE__ + ' ' + __LINE__.to_s + '--> ' + o.inspect) if o.is=='heading'} +p (__FILE__ + ' ' + __LINE__.to_s + '--> ' + dob.inspect) if dob.is==:heading +data.each {|o| p (__FILE__ + ' ' + __LINE__.to_s + '--> ' + o.inspect) if o.is==:heading} puts "#{__FILE__} #{__LINE__} #{para}" if @opt.cmd =~/M/ puts "#{__FILE__} #{__LINE__} #{t_o}" if @opt.cmd =~/M/ dr ┌ 9484 dR ┍ 9485 Dr ┎ 9486 DR ┏ 9487 dl ┐ 9488 dL ┑ 9489 Dl ┒ 9490 LD ┓ 9491 ur └ 9492 uR ┕ 9493 Ur ┖ 9494 UR ┗ 9495 ul ┘ 9496 uL ┙ 9497 Ul ┚ 9498 UL ┛ 9499 vr ├ diff --git a/lib/sisu/v3dv/dal.rb b/lib/sisu/v3dv/dal.rb index d5a4a948..bd8d32dd 100644 --- a/lib/sisu/v3dv/dal.rb +++ b/lib/sisu/v3dv/dal.rb @@ -349,7 +349,7 @@ module SiSU_DAL print %{OF: #{o.of}; } end if defined? o.is - print %{IS: #{o.is}; } + print %{IS: #{o.is.to_s}; } end if defined? o.ocn print %{OCN: #{o.ocn}; } @@ -386,15 +386,15 @@ module SiSU_DAL @data.each do |o| if defined? o.ocn filename_txt.puts case o.is - when 'heading' - "[#{o.is} #{o.lv}~#{o.name} [#{o.ocn}]] #{o.obj}" - else "[#{o.is} [#{o.ocn}]] #{o.obj}" + when :heading + "[#{o.is.to_s} #{o.lv}~#{o.name} [#{o.ocn}]] #{o.obj}" + else "[#{o.is.to_s} [#{o.ocn}]] #{o.obj}" end else filename_txt.puts case o.is - when 'meta' + when :meta "[m~#{o.tag}] #{o.obj}" - else "[#{o.is}] #{o.obj}" + else "[#{o.is.to_s}] #{o.obj}" end end end @@ -402,8 +402,8 @@ module SiSU_DAL @data.each do |o| if defined? o.ocn case o.is - when 'heading' - filename_debug.puts "#{o.is} #{o.lv}~#{o.name} odv=#{o.odv} osp=#{o.osp} [#{o.ocn}] -->\n\t#{o.obj}" + when :heading + filename_debug.puts "#{o.is.to_s} #{o.lv}~#{o.name} odv=#{o.odv} osp=#{o.osp} [#{o.ocn}] -->\n\t#{o.obj}" end end end diff --git a/lib/sisu/v3dv/dal_character_check.rb b/lib/sisu/v3dv/dal_character_check.rb index 4ec95f82..e5ab7578 100644 --- a/lib/sisu/v3dv/dal_character_check.rb +++ b/lib/sisu/v3dv/dal_character_check.rb @@ -68,7 +68,7 @@ module SiSU_DAL_CharacterCheck @tuned_file,@endnote_array=[],[] endnote_no=1 data.each do |dob| - unless dob.is =='table' + unless dob.is ==:table dob.obj=dob.obj.strip. gsub(/^[{~}]\s*$/,''). gsub(/~#\s*/,"#{Mx[:pa_non_object_no_heading]}"). @@ -84,7 +84,7 @@ module SiSU_DAL_CharacterCheck gsub(/\\copy(?:right)?\b/,'©'). gsub(/\\trademark\b|\\tm\b/,'®') dob.obj=dob.obj + "\n" - unless dob.is =~/^code/ + unless dob.is ==:code case dob.obj when /\^~/ #% Note must do this first (earlier loop) and then enter gathered data into ~^\d+ sub_dob=dob.obj.dup diff --git a/lib/sisu/v3dv/dal_doc_objects.rb b/lib/sisu/v3dv/dal_doc_objects.rb index c476b0ce..e413993a 100644 --- a/lib/sisu/v3dv/dal_doc_objects.rb +++ b/lib/sisu/v3dv/dal_doc_objects.rb @@ -67,11 +67,11 @@ module SiSU_DAL_DocumentStructure def initialize @tags={} @is=@tmp=@digest=nil - @of='meta' + @of=:meta end def metadata(tags) of= @of #String, classification - group - is= 'meta' #String, classification - specific type + is= :meta #String, classification - specific type tags= tags || ((defined? o.tags) ? o.tags : {}) #String, metadata type/tag obj= nil @of,@is,@tags,@obj=of,is,tags,obj @@ -82,11 +82,11 @@ module SiSU_DAL_DocumentStructure attr_accessor :obj,:is,:of,:tag,:digest,:tmp def initialize @is=@obj=@tag=@digest=@digest=@tmp=nil - @of='meta' + @of=:meta end def metadata(h,o=nil) of= @of #String, classification - group - is= 'meta' #String, classification - specific type + is= :meta #String, classification - specific type tag= h[:tag] || ((defined? o.tag) ? o.tag : nil) #String, metadata type/tag obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use @@ -98,7 +98,7 @@ module SiSU_DAL_DocumentStructure class ObjectHeading attr_accessor :obj,:is,:tags,:of,:lv,:ln,:toc_,:name,:idx,:ocn,:odv,:osp,:node,:parent,:ocn_,:note_,:autonum_,:digest,:tmp def initialize - @of='para' + @of=:para @is=@obj=@lv=@ln=@toc_=@name=@idx=@size=@ocn=@odv=@osp=@node=@parent=@ocn_=@note_=@autonum_=@digest=@tmp=nil @tags=[] end @@ -135,7 +135,7 @@ module SiSU_DAL_DocumentStructure h[:lv]=heading_lv(h[:ln]) end of= @of #String, classification - group - is= 'heading' #String, classification - specific type + is= :heading #String, classification - specific type name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content @@ -162,20 +162,20 @@ module SiSU_DAL_DocumentStructure end def heading_insert(h,o=nil) heading(h,o=nil) - @is= 'heading_insert' #String, classification - specific type + @is= :heading_insert #String, classification - specific type self end end class ObjectPara attr_accessor :obj,:is,:tags,:of,:name,:idx,:bullet_,:indent,:hang,:ocn,:odv,:osp,:parent,:note_,:image_,:ocn_,:digest,:tmp def initialize - @of='para' + @of=:para @is=@obj=@name=@idx=@bullet_=@indent=@hang=@size=@ocn=@odv=@osp=@parent=@note_=@image_=@ocn_=@digest=@tmp=nil @tags=[] end def paragraph(h,o=nil) of= @of #String, classification - group - is= 'para' #String, classification - specific type + is= :para #String, classification - specific type name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content @@ -199,7 +199,7 @@ module SiSU_DAL_DocumentStructure end def docinfo(h,o=nil) of= @of #String, classification - group - is= 'docinfo' #String, classification - specific type + is= :docinfo #String, classification - specific type name= h[:name] || ((defined? o.name) ? o.name : nil) #String, named object? tags= h[:tags] || ((defined? o.tags) ? o.tags : nil) #Array, associated object tags, names if any obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content @@ -225,13 +225,13 @@ module SiSU_DAL_DocumentStructure class ObjectBlockTxt attr_accessor :obj,:is,:of,:tags,:idx,:ocn,:odv,:osp,:parent,:note_,:number_,:ocn_,:digest,:tmp def initialize - @of='block' + @of=:block @is=@obj=@idx=@ocn=@odv=@osp=@parent=@note_=@number_=@ocn_=@digest=@tmp=nil @tags=[] end def code(h,o=nil) of= @of #String, classification - group #alt 'code' - is= 'code' #String, classification - specific type + is= :code #String, classification - specific type tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? @@ -251,7 +251,7 @@ module SiSU_DAL_DocumentStructure end def block(h,o=nil) of= @of #String, classification - group - is= 'block' #String, classification - specific type + is= :block #String, classification - specific type tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? @@ -270,7 +270,7 @@ module SiSU_DAL_DocumentStructure end def group(h,o=nil) of= @of #String, classification - group - is= 'group' #String, classification - specific type + is= :group #String, classification - specific type tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? @@ -289,7 +289,7 @@ module SiSU_DAL_DocumentStructure end def alt(h,o=nil) #see block of= @of #String, classification - group - is= 'alt' #String, classification - specific type + is= :alt #String, classification - specific type tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? @@ -308,7 +308,7 @@ module SiSU_DAL_DocumentStructure end def verse(h,o=nil) #part of poem decide how you deal with this of= @of #String, classification - group - is= 'verse' #String, classification - specific type + is= :verse #String, classification - specific type tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content idx= h[:idx] || ((defined? o.idx) ? o.idx : nil) #String, book index provided? @@ -329,13 +329,13 @@ module SiSU_DAL_DocumentStructure class ObjectTable attr_accessor :obj,:is,:of,:lv,:tags,:name,:idx,:indent,:hang,:size,:ocn,:number,:head_,:cols,:widths,:odv,:osp,:parent,:note_,:ocn_,:digest,:tmp def initialize - @of='block' + @of=:block @is=@obj=@lv=@name=@idx=@indent=@hang=@size=@ocn,@number,@head_,@cols,@widths=@odv=@osp=@parent=@note_=@ocn_=@digest=@tmp=nil @tags=[] end def table(h,o=nil) of= @of #String, classification - group - is= 'table' #String, classification - specific type + is= :table #String, classification - specific type tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any cols= h[:cols] || ((defined? o.cols) ? o.cols : nil) widths= h[:widths] || ((defined? o.widths) ? o.widths : nil) @@ -359,13 +359,13 @@ module SiSU_DAL_DocumentStructure class ObjectImage attr_accessor :obj,:is,:of,:lv,:idx,:size,:ocn,:parent,:note_,:ocn_,:digest,:tmp def initialize - @of='image' + @of=:image @is=@obj=@lv=@idx=@size=@ocn=@parent=@note_=@ocn_=@tmp=@digest=nil @tags=[] end def image(h,o=nil) #not yet used, and what of a paragraph containing several images, consider of= @of #String, classification - group - is= 'image' #String, classification - specific type + is= :image #String, classification - specific type tags= h[:tags] || ((defined? o.tags) ? o.tags : []) #Array, associated object tags, names if any obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content size= h[:size] || ((defined? o.size) ? o.size : nil) @@ -387,12 +387,12 @@ module SiSU_DAL_DocumentStructure class ObjectStructure attr_accessor :obj,:tag,:node,:lv,:ln,:status,:is,:of,:tmp def initialize - @of='structure' + @of=:structure @is=@obj=@node=@lv=@ln=@status=@tmp=nil end def xml_dom(h,o=nil) of= @of #String, classification - group - is= 'xml_dom' #String, classification - specific type + is= :xml_dom #String, classification - specific type obj= h[:obj] || ((defined? o.obj) ? o.obj : '') #String, text content lv= h[:lv] || ((defined? o.lv) ? o.lv : nil) #Alpha-numeric, document structure as used in markup, A-C then 1-6 ln= h[:ln] || ((defined? o.ln) ? o.ln : nil) #Integer, document structure level, for convenience in processing 1-9 @@ -406,12 +406,12 @@ module SiSU_DAL_DocumentStructure class ObjectComment attr_accessor :obj,:is,:of,:tmp def initialize - @of='comment' + @of=:comment @is=@obj=@tmp=nil end def comment(h,o=nil) of= @of #String, classification - group - is= 'comment' #String, classification - specific type + is= :comment #String, classification - specific type obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use @of,@is,@obj,@tmp=of,is,obj,tmp @@ -421,12 +421,12 @@ module SiSU_DAL_DocumentStructure class ObjectLayout attr_accessor :obj,:is,:of,:tmp def initialize - @of='layout' + @of=:layout @is=@obj=@tmp=nil end def break(h,o=nil) #decide how to deal with, perhaps no obj? of= @of #String, classification - group - is= 'break' #String, classification - specific type + is= :break #String, classification - specific type obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use @of,@is,@obj,@tmp=of,is,obj,tmp @@ -434,7 +434,7 @@ module SiSU_DAL_DocumentStructure end def insert(h,o=nil) #decide how to deal with, could mimic paragraph? of= @of #String, classification - group - is= 'insert' #String, classification - specific type + is= :insert #String, classification - specific type obj= h[:obj] || ((defined? o.obj) ? o.obj : nil) #String, text content tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use @of,@is,@obj,@tmp=of,is,obj,tmp diff --git a/lib/sisu/v3dv/dal_doc_str.rb b/lib/sisu/v3dv/dal_doc_str.rb index 91fa9458..a3c697e0 100644 --- a/lib/sisu/v3dv/dal_doc_str.rb +++ b/lib/sisu/v3dv/dal_doc_str.rb @@ -467,10 +467,10 @@ module SiSU_DAL_DocumentStructureExtract gsub(/[ ][ ]/m,"#{Mx[:nbsp]*2}"). gsub(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}") t_o=t_o + Mx[:br_nl] if t_o =~/\S+/ - elsif t_o.is=='group' \ - or t_o.is=='block' \ - or t_o.is=='alt' \ - or t_o.is=='verse' + elsif t_o.is==:group \ + || t_o.is==:block \ + || t_o.is==:alt \ + || t_o.is==:verse t_o.obj=t_o.obj.gsub(/\n/m,"#{Mx[:br_nl]}"). gsub(/[ ][ ]/m,"#{Mx[:nbsp]*2}"). gsub(/#{Mx[:nbsp]}\s/,"#{Mx[:nbsp]*2}") @@ -528,219 +528,6 @@ module SiSU_DAL_DocumentStructureExtract h={ obj: str, ocn_: false } SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h) end - def metadata - meta=[] - dir=SiSU_Env::InfoEnv.new(@md.fns) - base_html="#{dir.url.root}/#{@md.fnb}" - l=SiSU_Env::StandardiseLanguage.new(@md.opt.lng).language - language=l[:n] - tr=SiSU_Translate::Source.new(@md,language) - meta << @pb - h={ ln: 2, obj: 'Metadata', ocn_: false } - meta << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h) - h={ ln: 4, name: 'metadata', obj: 'Metadata', autonum_: false, ocn_: false } - meta << SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h) #add ocnm - s="Document Manifest @\n #{base_html}/#{@md.fn[:manifest]}" - meta << meta_para(s) - s="#{Mx[:fa_bold_o]}Dublin Core#{Mx[:fa_bold_c]} (DC)" #add ocnm - meta << meta_para(s) - s="#{Mx[:fa_italics_o]}DC tags included with this document are provided here.#{Mx[:fa_italics_c]}" #add ocnm - meta << meta_para(s) - if defined? @md.title.full \ - and @md.title.full=~/\S+/ - s="#{tr.full_title}: #{Mx[:fa_underscore_o]}#{@md.title.full}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.creator.author \ - and @md.creator.author=~/\S+/ - s="\n#{tr.author}: #{Mx[:fa_underscore_o]}#{@md.creator.author}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.creator.translator \ - and @md.creator.translator=~/\S+/ - s="#{tr.translator}: #{Mx[:fa_underscore_o]}#{@md.creator.translator}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.creator.illustrator \ - and @md.creator.illustrator=~/\S+/ - s="#{tr.illustrator}: #{Mx[:fa_underscore_o]}#{@md.creator.illustrator}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.creator.prepared_by \ - and @md.creator.prepared_by=~/\S+/ - s="\n#{tr.prepared_by}: #{Mx[:fa_underscore_o]}#{@md.creator.prepared_by}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.creator.digitized_by \ - and @md.creator.digitized_by=~/\S+/ - s="#{tr.digitized_by}: #{Mx[:fa_underscore_o]}#{@md.creator.digitized_by}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.rights.all \ - and @md.rights.all=~/\S+/ - s="\n#{tr.rights}: #{Mx[:fa_underscore_o]}#{@md.rights.all}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.notes.description \ - and @md.notes.description=~/\S+/ - s="#{tr.description}: #{Mx[:fa_underscore_o]}#{@md.notes.description}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.subject \ - and @md.classify.subject=~/\S+/ - s="#{tr.subject}: #{Mx[:fa_underscore_o]}#{@md.classify.subject}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.publisher \ - and @md.publisher=~/\S+/ - s="\n#{tr.publisher}: #{Mx[:fa_underscore_o]}#{@md.publisher}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.creator.contributor \ - and @md.creator.contributor=~/\S+/ - s="\n#{tr.contributor}: #{Mx[:fa_underscore_o]}#{@md.creator.contributor}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.notes.abstract \ - and @md.notes.abstract=~/\S+/ - s="\n#{tr.abstract}: #{Mx[:fa_underscore_o]}#{@md.notes.abstract}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.date.created \ - and @md.date.created=~/\S+/ - s="\n#{tr.date_created}: #{Mx[:fa_underscore_o]}#{@md.date.created}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.date.issued \ - and @md.date.issued=~/\S+/ - s="\n#{tr.date_issued}: #{Mx[:fa_underscore_o]}#{@md.date.issued}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.date.available \ - and @md.date.available=~/\S+/ - s="\n#{tr.date_available}: #{Mx[:fa_underscore_o]}#{@md.date.available}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.date.modified \ - and @md.date.modified=~/\S+/ - s="\n#{tr.date_modified}: #{Mx[:fa_underscore_o]}#{@md.date.modified}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.date.valid \ - and @md.date.valid=~/\S+/ - s="\n#{tr.date_valid}: #{Mx[:fa_underscore_o]}#{@md.date.valid}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.date.published \ - and @md.date.published=~/\S+/ - s="\n#{tr.date}: #{Mx[:fa_underscore_o]}#{@md.date.published}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.loc \ - and @md.classify.loc=~/\S+/ - s="\n#{tr.cls_loc}: #{Mx[:fa_underscore_o]}#{@md.classify.loc}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.dewey \ - and @md.classify.dewey=~/\S+/ - s="\n#{@cls_dewey}: #{Mx[:fa_underscore_o]}#{@md.classify.dewey}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.pg \ - and @md.classify.pg=~/\S+/ - s="\n#{tr.cls_gutenberg}: #{Mx[:fa_underscore_o]}#{@md.classify.pg}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.isbn \ - and @md.classify.isbn=~/\S+/ - s="\n#{tr.cls_isbn}: #{Mx[:fa_underscore_o]}#{@md.classify.isbn}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.notes.comment \ - and @md.notes.comment=~/\S+/ - s="\n#{tr.comments}: #{Mx[:fa_underscore_o]}#{@md.notes.comment}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.notes.prefix_a \ - and @md.notes.prefix_a=~/\S+/ - s="\n#{tr.prefix_a}: #{Mx[:fa_underscore_o]}#{@md.notes.prefix_a}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.notes.prefix_b \ - and @md.notes.prefix_b=~/\S+/ - s="\n#{tr.prefix_b}: #{Mx[:fa_underscore_o]}#{@md.notes.prefix_b}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.identifier \ - and @md.classify.identifier=~/\S+/ - s="\n#{tr.identifier}: #{Mx[:fa_underscore_o]}#{@md.classify.identifier}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.original.source \ - and @md.original.source=~/\S+/ - s="\n#{tr.source}: #{Mx[:fa_underscore_o]}#{@md.original.source}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.title.language \ - and @md.title.language=~/\S+/ - s="\n#{tr.language}: #{Mx[:fa_underscore_o]}#{@md.title.language}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.original.language \ - and @md.original.language=~/\S+/ - s="\n#{tr.language_original}: #{Mx[:fa_underscore_o]}#{@md.original.language}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.format \ - and @md.classify.format=~/\S+/ - s="\n#{tr.format}: #{Mx[:fa_underscore_o]}#{@md.classify.format}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.relation \ - and @md.classify.relation=~/\S+/ - s="\n#{tr.relation}: #{Mx[:fa_underscore_o]}#{@md.classify.relation}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.coverage \ - and @md.classify.coverage=~/\S+/ - s="\n#{tr.coverage}: #{Mx[:fa_underscore_o]}#{@md.classify.coverage}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.classify.keywords \ - and @md.classify.keywords=~/\S+/ - s="\n#{tr.keywords}: #{Mx[:fa_underscore_o]}#{@md.classify.keywords}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - s="#{Mx[:fa_bold_o]}Version Information#{Mx[:fa_bold_c]}" - meta << meta_para(s) - if defined? @md.fns \ - and @md.fns=~/\S+/ - s="#{tr.sourcefile}: #{Mx[:fa_underscore_o]}#{@md.fns}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.file_encoding \ - and @md.file_encoding=~/\S+/ - s="Filetype: #{Mx[:fa_underscore_o]}#{@md.file_encoding}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.dgst \ - and @md.dgst.class==Array - s="Source Digest: #{@md.dgst[0]} #{Mx[:fa_underscore_o]}#{@md.dgst[1]}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - if defined? @md.dgst_skin \ - and @md.dgst_skin.class==Array - s="Skin Digest: #{@md.dgst_skin[0]} #{Mx[:fa_underscore_o]}#{@md.dgst_skin[1]}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - end - s="#{Mx[:fa_bold_o]}Generated#{Mx[:fa_bold_c]}" - meta << meta_para(s) - s="#{tr.last_generated}: #{Mx[:fa_underscore_o]}#{Time.now}#{Mx[:fa_underscore_c]}" - meta << meta_para(s) - s="#{tr.sisu_version}: #{Mx[:fa_underscore_o]}#{@md.sisu_version[:project]}#{Mx[:fa_underscore_c]} #{Mx[:fa_underscore_o]}#{@md.sisu_version[:version]}#{Mx[:fa_underscore_c]} of #{@md.sisu_version[:date_stamp]} (#{@md.sisu_version[:date]})" - meta << meta_para(s) - meta - end def build_lines(type='') lines,lines_new=@data,[] lines.each do |line| @@ -774,9 +561,9 @@ module SiSU_DAL_DocumentStructureExtract @dob end def structure_markup #build structure where structure provided only in meta header - @dob=if @dob.is =~/para/ \ - and ((@dob.hang !~/[1-9]/ and @dob.indent !~/[1-9]/) \ - or (@dob.hang != @dob.indent)) \ + @dob=if @dob.is ==:para \ + && (((@dob.hang !~/[1-9]/) && (@dob.indent !~/[1-9]/)) \ + || (@dob.hang != @dob.indent)) \ and not @dob.bullet_ @dob=case @dob.obj when /^#{@md.lv1}/ @@ -864,12 +651,14 @@ module SiSU_DAL_DocumentStructureExtract parent=node1=node2=node3=node4=node5=node6=nil data.each do |dob| h={} - if (dob.obj !~ regex_exclude_ocn_and_node || dob.is =='code') \ - and dob.of !~/(?:comment|layout|meta)/ \ - and dob.obj !~/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/ \ - and dob.ocn_ + if (dob.obj !~ regex_exclude_ocn_and_node || dob.is ==:code) \ + && (dob.of !=:comment \ + && dob.of !=:layout \ + && dob.of !=:meta) \ + && dob.obj !~/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/ \ + && dob.ocn_ #dob.ln now is determined, and set earlier, check how best to remove this --> - if dob.is=='heading' + if dob.is==:heading ln=case dob.lv when 'A'; 1 when 'B'; 2 @@ -885,7 +674,7 @@ module SiSU_DAL_DocumentStructureExtract if not dob.obj =~/<:#>|~#|-#/ \ or not dob.toc_ # fix this no longer in dob.obj ocn+=1 - if dob.is=='heading' \ + if dob.is==:heading \ and (ln.to_s =~/^[1-9]/ \ or ln.to_s =~@md.lv1 \ or ln.to_s =~@md.lv2 \ @@ -921,26 +710,31 @@ module SiSU_DAL_DocumentStructureExtract end else ocno+=1 - if dob.is=='table' + if dob.is==:table ocnt+=1 ocn_sp,parent="t#{ocnt}",node - elsif dob.is=='code' + elsif dob.is==:code ocnc+=1 ocn_sp,parent="c#{ocnc}",node - elsif dob.is=~/^(?:group|block|alt|verse)/ + elsif dob.is==:group \ + || dob.is==:block \ + || dob.is==:alt \ + || dob.is==:verse ocng+=1 #group, poem ocn_sp,parent="g#{ocng}",node - elsif dob.is=~/image|#{Mx[:lnk_o]}\S+?\.(?:png|jpg|gif)\s+/m + elsif dob.is==:image #check ocni+=1 ocn_sp,parent="i#{ocni}",node else ocnp+=1 #paragraph ocn_sp,parent="p#{ocnp}",node end end - if dob.is=='heading' + if dob.is==:heading dob.ln,dob.node,dob.ocn,dob.odv,dob.osp,dob.parent=ln,node,ocn,ocn_dv,ocn_sp,parent else - unless dob.of=~/meta|comment|layout/ + if dob.of !=:meta \ + && dob.of !=:comment \ + && dob.of !=:layout dob.ocn,dob.odv,dob.osp,dob.parent=ocn,ocn_dv,ocn_sp,parent end end @@ -952,25 +746,31 @@ module SiSU_DAL_DocumentStructureExtract h elsif dob.obj=~/#{Mx[:pa_non_object_no_heading]}/ dob.obj=dob.obj.gsub(/#{Mx[:pa_non_object_no_heading]}/,'') - if dob.is=='para' + if dob.is==:para h={ obj: dob.obj, ocn_: false, ocn: nil } dob=SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h,dob) - elsif dob.is=='heading' + elsif dob.is==:heading h={ obj: dob.obj, ocn_: false, ocn: nil, toc_: true } dob=SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,dob) end elsif dob.obj=~/#{Mx[:pa_non_object_dummy_heading]}/ dob.obj=dob.obj.gsub(/#{Mx[:pa_non_object_dummy_heading]}/,'') - if dob.is=='para' + if dob.is==:para h={ obj: dob.obj, ocn_: false, ocn: nil } dob=SiSU_DAL_DocumentStructure::ObjectPara.new.paragraph(h,dob) - elsif dob.is=='heading' + elsif dob.is==:heading h={ obj: dob.obj, ocn_: false, ocn: nil, toc_: false } dob=SiSU_DAL_DocumentStructure::ObjectHeading.new.heading(h,dob) end else dob end - dob.obj=dob.obj.gsub(/\n\n/,"\n") if dob.is =~/(?:code|verse|alt|group|block)/ #newlines taken out + if dob.is==:code \ + || dob.is==:verse \ + || dob.is==:alt \ + || dob.is==:group \ + || dob.is==:block + dob.obj=dob.obj.gsub(/\n\n/,"\n") #newlines taken out + end @o_array << dob end @o_array @@ -1004,7 +804,8 @@ module SiSU_DAL_DocumentStructureExtract puts "<#{@s[0]}>" end data.each_with_index do |o,i| - if o.is =~/^heading/ + if o.is ==:heading \ + || o.is ==:heading_insert case o.ln when 1 tuned_file << tag_close(o.ln,hs) diff --git a/lib/sisu/v3dv/dal_endnotes.rb b/lib/sisu/v3dv/dal_endnotes.rb index eb5e3429..191260c4 100644 --- a/lib/sisu/v3dv/dal_endnotes.rb +++ b/lib/sisu/v3dv/dal_endnotes.rb @@ -74,9 +74,9 @@ module SiSU_DAL_Endnotes if @md.opt.mod.inspect =~/--no-dagger|--no-annotate/ dob.obj=dob.obj.gsub(/#{Mx[:en_b_o]}[+]\s.+?#{Mx[:en_b_c]}/,'') end - if defined? dob.obj \ - and defined? dob.is \ - and dob.is !~/^code/ + if (defined? dob.obj) \ + && (defined? dob.is) \ + && dob.is !=:code case dob.obj # auto-numbered endnotes <!e!> <!e_!> --> when /#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\s+.+?#{Mx[:en_b_c]}/ dob.obj=dob.obj.gsub(/\s*(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/,' \1') # required 2003w31 diff --git a/lib/sisu/v3dv/dal_hash_digest.rb b/lib/sisu/v3dv/dal_hash_digest.rb index 40f81197..ad201752 100644 --- a/lib/sisu/v3dv/dal_hash_digest.rb +++ b/lib/sisu/v3dv/dal_hash_digest.rb @@ -76,8 +76,10 @@ module SiSU_DAL_Hash unless t_o.obj.class==Array t_o.obj=t_o.obj.strip end - if t_o.of !~/structure|comment|layout/ \ - and t_o.ocn.class==Fixnum + if (t_o.of !=:structure \ + && t_o.of !=:comment \ + && t_o.of !=:layout) \ + && t_o.ocn.class==Fixnum if sha_ for hash_class in [ Digest::SHA256 ] @tuned_file << stamped(t_o,hash_class) @@ -120,7 +122,7 @@ module SiSU_DAL_Hash stripped=SiSU_TextRepresentation::Alter.new(t_o).strip_clean_of_markup markup=SiSU_TextRepresentation::Alter.new(t_o).semi_revert_markup digests=SiSU_TextRepresentation::ModifiedTextPlusHashDigest.new(@md,t_o).composite.dgst - unless t_o.is=='code' + unless t_o.is==:code case t_o.obj when /#{Mx[:en_a_o]}[\d*+]+\s+.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}[*+]\d+\s+.+?#{Mx[:en_b_c]}/m en_and_t_o,en_and_t_o_digest=[],[] diff --git a/lib/sisu/v3dv/dal_idx.rb b/lib/sisu/v3dv/dal_idx.rb index 5f4a38e0..21567c14 100644 --- a/lib/sisu/v3dv/dal_idx.rb +++ b/lib/sisu/v3dv/dal_idx.rb @@ -75,8 +75,9 @@ module SiSU_DAL_BookIndex tuned_file=[] idx_array=[] data.each do |dob| - if dob.is =~/heading/ \ - and dob.ln==4 + if (dob.is ==:heading \ + || dob.is ==:heading_insert) \ + && dob.ln==4 @seg=dob.name end idx_array << "#{dob.idx}~#{dob.ocn}~#{@seg}" if defined? dob.idx and not (dob.idx.nil? or dob.idx.empty?) diff --git a/lib/sisu/v3dv/dal_images.rb b/lib/sisu/v3dv/dal_images.rb index 0f65b814..6455daf1 100644 --- a/lib/sisu/v3dv/dal_images.rb +++ b/lib/sisu/v3dv/dal_images.rb @@ -80,7 +80,7 @@ module SiSU_DAL_Images end end data.each do |dob| - unless dob.is =~/^table/ + unless dob.is ==:table dob.obj=dob.obj.strip if dob.obj =~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)(?:\s*|\s+.+)?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/ if dob.obj !~/#{Mx[:lnk_o]}\s*\S+\.(?:png|jpg|gif)\s+\d+x\d+/ diff --git a/lib/sisu/v3dv/dal_numbering.rb b/lib/sisu/v3dv/dal_numbering.rb index 332db4bf..f5a09ef6 100644 --- a/lib/sisu/v3dv/dal_numbering.rb +++ b/lib/sisu/v3dv/dal_numbering.rb @@ -77,8 +77,10 @@ module SiSU_DAL_Numbering def number_plaintext_para(data) @tuned_file=[] data.each do |dob| - if dob.of !~/(?:block|comment|layout)/ \ - and dob.ocn_ #and dob.obj !~ /#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/ #FIX + if (dob.of !=:block \ + && dob.of !=:comment \ + && dob.of !=:layout) \ + && dob.ocn_ #and dob.obj !~ /#{Mx[:gr_o]}Th|#{Mx[:tc_o]}#{Mx[:tc_p]}#{Mx[:tc_p]}/ #FIX dob.obj=dob.obj.gsub(/(.+)\n/,'\1 ') #messy, but idea is that tables should retain breaks end unless dob.obj.class==Array @@ -139,8 +141,8 @@ module SiSU_DAL_Numbering data.each do |dob| #@md.seg_names << [additions to segment names] title_no=nil dob=SiSU_DAL_DocumentStructureExtract::Structure.new(@md,dob).structure_markup #must happen earlier, node info etc. require - if dob.is =='heading' \ - and dob.autonum_ \ + if dob.is ==:heading \ + && dob.autonum_ \ and defined? @md.make.num_top \ and @md.make.num_top !~/^$/ if dob.lv=='1' \ @@ -206,7 +208,7 @@ module SiSU_DAL_Numbering dob.tags=[dob.name,dob.tags].flatten if dob.name !~/^\d+$/ #check whether will work across file types with stop signs dob.name.gsub(/^([a-z_\.]+)-$/,'\1') end - elsif dob.is =='heading' \ + elsif dob.is ==:heading \ and dob.autonum_ \ and @md.markup =~/num_extract/ #AS DANGEROUS force enable with document, note already does this type of numbering for cisg, locate and coordinate logic, is currently misplaced in code, chengwei inspired 2004w23/4 #here lies a bug, as is nil when run from -Dv --update, FIX @@ -240,11 +242,14 @@ module SiSU_DAL_Numbering number_small,letter_small=0,0 letter=%w( a b c d e f g h i j k l m n o p q r s t u v w x y z ) data.each do |dob| - if dob.of =~/heading|para|block/ - if dob.is =='heading' \ + if dob.of ==:heading \ + || dob.of ==:heading_insert \ + || dob.of ==:para \ + || dob.of ==:block + if dob.is ==:heading \ and dob.ln.to_s=~/^[1-9]/ #% sub-number system, (baby numbering) reset with any change of major number (more obviously should be placed in number titles, but that is conditionally executed, check and move later) number_small,letter_small=0,0 - elsif dob.is =~/para/ + elsif dob.is ==:para if dob.obj =~/^#[ 1]/ \ and dob.obj !~/^#\s+(?:~#)?$/ letter_small=0 @@ -286,8 +291,8 @@ module SiSU_DAL_Numbering end ocn_html_seg=[] data.each do |dob| - if dob.is=='heading' \ - and dob.ln \ + if dob.is==:heading \ + && dob.ln \ and dob.ln.to_s =~/^[456]/ if dob.ln==4 \ and not dob.name \ @@ -333,12 +338,13 @@ module SiSU_DAL_Numbering puts "e r r o r -\t#{__FILE__}::#{__LINE__}\n#{dob.inspect}" end end - if dob.is =~/heading/ \ - and dob.ln==4 + if (dob.is ==:heading \ + || dob.is ==:heading_insert) \ + && dob.ln==4 @seg=dob.name end - @tuned_file << if dob.is=='heading' \ - and (@md.pagenew or @md.pagebreak) + @tuned_file << if dob.is==:heading \ + && (@md.pagenew || @md.pagebreak) m=dob.ln.to_s dob_tmp=[] if @md.pagenew.inspect =~/#{m}/ @@ -353,11 +359,11 @@ module SiSU_DAL_Numbering end if defined? dob.ocn \ and dob.ocn - @segname=((dob.is=='heading'|| dob.is=='heading_insert') && dob.ln==4 && (defined? dob.name)) \ + @segname=((dob.is==:heading || dob.is==:heading_insert) && dob.ln==4 && (defined? dob.name)) \ ? (dob.name) : @segname tags["#{dob.ocn}"]={ segname: @segname } - ocn_html_seg[dob.ocn]=if dob.is =~/heading/ + ocn_html_seg[dob.ocn]=if (dob.is==:heading || dob.is==:heading_insert) x=if dob.ln =~/[1-3]/ { seg: nil, level: dob.ln } else #elsif dob.ln =~/[4-6]/ @@ -428,7 +434,7 @@ module SiSU_DAL_Numbering unless @md.set_heading_seg if defined? dob.ln and dob.ln.to_s !~/^[123]/m \ and dob.obj !~/\A\s*\Z/m \ - and dob.is !='layout' + and dob.is !=:layout @md.set_heading_seg=true head=if @md.title.main ; dob.ln,dob.name,dob.obj=4,'seg',@md.title.main else dob.ln,dob.name,dob.obj=4,'seg','[segment]' diff --git a/lib/sisu/v3dv/dal_syntax.rb b/lib/sisu/v3dv/dal_syntax.rb index a8ece51e..73bb6a64 100644 --- a/lib/sisu/v3dv/dal_syntax.rb +++ b/lib/sisu/v3dv/dal_syntax.rb @@ -135,7 +135,10 @@ module SiSU_DAL_Syntax dob=SiSU_Sem::Tags.new(dob,@md).rm.all end def breaks(dob) - if dob.is !~/^(?:meta|comment|code|table)/ + if dob.is !=:meta \ + && dob.is !=:comment \ + && dob.is !=:code \ + && dob.is !=:table dob.obj=dob.obj.gsub(/ \\\\(?: |$)/,"#{Mx[:br_line]}"). gsub(/(?:<:?br>|<br \/>)/,"#{Mx[:br_line]}") # depreciated end @@ -147,7 +150,11 @@ module SiSU_DAL_Syntax and @md.make.italics[:str]) \ or (defined? @vz.markup_make_italic[:str] \ and @vz.markup_make_italic[:str]) - dob.obj=if dob.is !~/^(?:meta|heading|code|comment)/ + dob.obj=if dob.is !=:meta \ + && dob.is !=:heading \ + && dob.is !=:heading_insert \ + && dob.is !=:code \ + && dob.is !=:comment word=dob.obj.scan(@line_scan_ital) word=word.flatten.compact line_array=[] @@ -202,7 +209,12 @@ module SiSU_DAL_Syntax and @md.make.bold[:str]) \ or (defined? @vz.markup_make_bold[:str] \ and @vz.markup_make_bold[:str]) - dob.obj=if dob.is !~/^(?:meta|heading|code|comment|table)/ + dob.obj=if dob.is !=:meta \ + && dob.is !=:heading \ + && dob.is !=:heading_insert \ + && dob.is !=:code \ + && dob.is !=:comment \ + && dob.is !=:table line_array=[] word=dob.obj.scan(@line_scan_bold) word=word.flatten.compact @@ -227,10 +239,13 @@ module SiSU_DAL_Syntax else dob.obj end else - dob.obj=if dob.is !~/^(?:heading|comment|meta)/ \ + dob.obj=if (dob.is !=:heading \ + && dob.is !=:heading_insert \ + && dob.is !=:comment \ + && dob.is !=:meta) \ and dob.obj =~ /^!_\s+/ embolden(dob.obj) - elsif dob.is=='heading' \ + elsif dob.is==:heading \ and dob.ln.to_s =~/[7-9]/ embolden(dob.obj) else dob.obj @@ -297,7 +312,10 @@ module SiSU_DAL_Syntax # # #numbered (list) level 1 # _# #numbered (list) level 2 dob=dob.dup - if dob.is !~/^(?:meta|comment|code|table)/ + if dob.is !=:meta \ + && dob.is !=:comment \ + && dob.is !=:code \ + && dob.is !=:table line_array=[] word=dob.obj.scan(/\S+|\n/) #unless line =~/^(?:#{Mx[:meta_o]}|%+\s)/ #visit if word @@ -315,7 +333,7 @@ module SiSU_DAL_Syntax gsub(/~\{(.+?)\}~/m,Mx[:en_a_o] + '\1' + Mx[:en_a_c]). gsub(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]). #default if markup does not specify gsub(/~\[(.+?)\]~/m,Mx[:en_b_o] + '\1' + Mx[:en_b_c]) - if dob.is =='heading' \ + if dob.is ==:heading \ and dob.ln ==1 dob.obj=dob.obj.gsub(/\s*@title\b/," #{@md.title.full}") dob.obj=if defined? @md.creator.author \ @@ -329,7 +347,7 @@ module SiSU_DAL_Syntax and defined? @md.title.full \ and defined? @md.creator \ and @md.creator - if dob.is =='heading' + if dob.is ==:heading dob.obj=dob.obj.gsub(/^\s*@title\s*$/,@md.title.full) if dob.lv =~/1/ dob.obj=if dob.lv =~/[23]/ \ and defined? @md.creator.author \ @@ -426,9 +444,9 @@ module SiSU_DAL_Syntax "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2"). #any remaining linked text or image, check need gsub(/\{\s*(.+?)\s*\}(image)/, "#{Mx[:lnk_o]}\\1#{Mx[:lnk_c]}\\2") #linked image - elsif dob.is=='table' + elsif dob.is==:table dob=fontface(dob) - elsif dob.is =='code' + elsif dob.is ==:code dob.obj=dob.obj.gsub(/#{Mx[:meta_o]}(\S+?)#{Mx[:meta_c]}\s*/,'@\1: '). gsub(/(^|#{Mx[:gl_c]}|\s)<(br(?: \/)?)>([\s,.]|$)/,'\1<\2>\3') #convert <br> <br /> back, clumsy if dob.number_ diff --git a/lib/sisu/v3dv/db_import.rb b/lib/sisu/v3dv/db_import.rb index a2b66937..3bb6e210 100644 --- a/lib/sisu/v3dv/db_import.rb +++ b/lib/sisu/v3dv/db_import.rb @@ -113,6 +113,7 @@ module SiSU_DbImport @id_n =0 if @col[:lid].nil? or @col[:lid].to_s.empty? @col[:lv1]=@col[:lv2]=@col[:lv3]=@col[:lv4]=@col[:lv5]=@col[:lv6]=0 @db=SiSU_Env::InfoDb.new + @pdf_fn=SiSU_Env::FileOp.new(@md).base_filename @@dl ||=SiSU_Env::InfoEnv.new.digest.length end def marshal_load @@ -260,10 +261,14 @@ module SiSU_DbImport data.obj.gsub!(/#{Mx[:gl_o]}(●)#{Mx[:gl_c]}\s*/,'\1 ') data.obj.gsub!(/#{Mx[:tag_o]}\S+?#{Mx[:tag_c]}/,'') #check @col[:seg]=@@seg - if data.of =~/para|heading|block|group/ # regular text what of code-blocks grouped text etc. + if data.of ==:para \ + || :heading \ + || :heading_insert \ + || :block \ + || :group # regular text what of code-blocks grouped text etc. notedata=data.obj.dup - if data.is=='heading' \ - and data.ln.inspect=~/[123]/ + if data.is==:heading \ + && (data.ln.inspect=~/[123]/) @col[:lev],txt,@col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=data.ln,data.obj,data.ocn,data.lv,data.odv,data.osp,data.of,data.is,data.node,data.parent,'','' @col[:lid]+=1 txt=endnotes(txt).extract_any @@ -286,8 +291,8 @@ module SiSU_DbImport when /3/; @col[:lv3]+=1 end @col[:lev]=@col[:plaintext]=@col[:body]='' - elsif data.is=='heading' \ - and data.ln==4 + elsif data.is==:heading \ + && data.ln==4 @@seg,txt,@col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=data.name,data.obj,data.ocn,data.lv,data.odv,data.osp,data.of,data.is,data.node,data.parent,'','' @col[:seg]=@@seg @col[:lv4]+=1 @@ -312,9 +317,12 @@ module SiSU_DbImport t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file) @tuple_array << t.tuple @col[:lev]=@col[:plaintext]=@col[:body]='' - elsif data.is=='heading' and data.ln==5 + elsif data.is==:heading \ + && data.ln==5 txt,@col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=data.obj,data.ocn,data.lv,data.odv,data.osp,data.of,data.is,data.node,data.parent,'','' - @@seg_full=data.name if data.is=='heading' and data.ln==5 and data.name #check data.name + @@seg_full=data.name if data.is==:heading \ + && data.ln==5 \ + && data.name #check data.name @@seg ||='' #nil # watch @col[:seg]=@@seg @col[:lv5]+=1 @@ -339,9 +347,10 @@ module SiSU_DbImport t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file) @tuple_array << t.tuple @col[:lev]=@col[:plaintext]=@col[:body]='' - elsif data.is=='heading' and data.ln==6 + elsif data.is==:heading \ + && data.ln==6 txt,@col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=data.obj,data.ocn,data.lv,data.odv,data.osp,data.of,data.is,data.node,data.parent,'','' - @@seg_full=data.name if data.is=='heading' and data.ln==6 and data.name #check data.name + @@seg_full=data.name if data.is==:heading && data.ln==6 && data.name #check data.name @@seg ||='' #nil # watch @col[:seg]=@@seg @col[:lv6]+=1 @@ -366,6 +375,10 @@ module SiSU_DbImport t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file) @tuple_array << t.tuple @col[:lev]=@col[:plaintext]=@col[:body]='' + elsif data.of==:structure \ + || data.of==:layout \ + || data.of==:comment + #added watch else #% regular text @col[:lid]+=1 txt='' @@ -389,9 +402,9 @@ module SiSU_DbImport @en_a,@en_z=@en[0].first,@en[0].last if @en[0] @en_a_asterisk,@en_z_asterisk=@en_ast[0].first,@en_ast[0].last if @en_ast[0] @en_a_plus,@en_z_plus=@en_pls[0].first,@en_pls[0].last if @en_pls[0] - @col[:body]=if data.is=='table' + @col[:body]=if data.is==:table SiSU_FormatShared::CSS_Format.new(@md,data).html_table - elsif data.is=='code' + elsif data.is==:code SiSU_FormatShared::CSS_Format.new(@md,data).code elsif defined? data.indent \ and defined? data.hang \ @@ -606,53 +619,64 @@ module SiSU_DbImport or @fnb.nil? p 'file output path error' #remove end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:plain]}")==true - f[:txt],u[:txt]='plaintext,', "'#{base}/#{@fnb}/#{@md.fn[:plain]}'," + if FileTest.file?("#{@md.file.output_path.txt.dir}/#{@md.file.base_filename.txt}")==true + f[:txt],u[:txt]='plaintext,', "'#{@md.file.output_path.txt.url}/#{@md.file.base_filename.txt}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:toc]}")==true - f[:html_toc],u[:html_toc]='html_toc,', "'#{base}/#{@fnb}/#{@md.fn[:toc]}'," + if FileTest.file?("#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_seg}")==true + f[:html_toc],u[:html_toc]='html_toc,', "'#{@md.file.output_path.html_seg.url}/#{@md.file.base_filename.html_seg}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:doc]}")==true - f[:html_doc],u[:html_doc]='html_doc,', "'#{base}/#{@fnb}/#{@md.fn[:doc]}'," + if FileTest.file?("#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_scroll}")==true + f[:html_doc],u[:html_doc]='html_doc,', "'#{@md.file.output_path.html_scroll.url}/#{@md.file.base_filename.html_scroll}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:xhtml]}")==true - f[:xhtml],u[:xhtml]='xhtml,', "'#{base}/#{@fnb}/#{@md.fn[:xhtml]}'," + if FileTest.file?("#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}")==true + f[:xhtml],u[:xhtml]='xhtml,', "'#{@md.file.output_path.xhtml.url}/#{@md.file.base_filename.xhtml}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:sax]}")==true - f[:xml_sax],u[:xml_sax]='xml_sax,', "'#{base}/#{@fnb}/#{@md.fn[:sax]}'," + if FileTest.file?("#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}")==true + f[:xml_sax],u[:xml_sax]='xml_sax,', "'#{@md.file.output_path.xml_sax.url}/#{@md.file.base_filename.xml_sax}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:dom]}")==true - f[:xml_dom],u[:xml_dom]='xml_dom,', "'#{base}/#{@fnb}/#{@md.fn[:dom]}'," + if FileTest.file?("#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}")==true + f[:xml_dom],u[:xml_dom]='xml_dom,', "'#{@md.file.output_path.xml_dom.url}/#{@md.file.base_filename.xml_dom}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:odf]}")==true - f[:odf],u[:odf]='odf,', "'#{base}/#{@fnb}/#{@md.fn[:odf]}'," + if FileTest.file?("#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}")==true + f[:epub],u[:epub]='epub,', "'#{@md.file.output_path.epub.url}/#{@md.file.base_filename.epub}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:pdf_p]}")==true - f[:pdf_p],u[:pdf_p]='pdf_p,', "'#{base}/#{@fnb}/#{@md.fn[:pdf_p]}'," + if FileTest.file?("#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}")==true + f[:odf],u[:odf]='odf,', "'#{@md.file.output_path.odt.url}/#{@md.file.base_filename.odt}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:pdf_l]}")==true - f[:pdf_l],u[:pdf_l]='pdf_l,', "'#{base}/#{@fnb}/#{@md.fn[:pdf_l]}'," + if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_p_a4}")==true #\ + #or FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_p_letter}")==true + f[:pdf_p],u[:pdf_p]='pdf_p,', "'#{@md.file.output_path.pdf.url}/#{@pdf_fn.pdf_p_a4}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:concordance]}")==true - f[:concordance],u[:concordance]='concordance,', "'#{base}/#{@fnb}/#{@md.fn[:concordance]}'," + if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_l_a4}")==true #\ + #or FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_l_letter}")==true + f[:pdf_l],u[:pdf_l]='pdf_l,', "'#{@md.file.output_path.pdf.url}/#{@pdf_fn.pdf_l_a4}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.tex")==true - f[:latex_p],u[:latex_p]='latex_p,', "'#{base}/#{@fnb}/#{@opt.fns}.tex'," + if FileTest.file?("#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}")==true + f[:concordance],u[:concordance]='concordance,', "'#{@md.file.output_path.html_concordance.url}/#{@md.file.base_filename.html_concordance}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.landscape.tex")==true - f[:latex_l],u[:latex_l]='latex_l,', "'#{base}/#{@fnb}/#{@opt}.fns}.landscape.tex'," + #if FileTest.file?("#{@md.file.output_path.x.dir}/#{@md.file.base_filename.x}")==true + # f[:latex_p],u[:latex_p]='latex_p,', "'#{@md.file.output_path.x.url}/#{@md.file.base_filename.x}'," + #end + ##if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.tex")==true + ## f[:latex_p],u[:latex_p]='latex_p,', "'#{base}/#{@fnb}/#{@opt.fns}.tex'," + ##end + #if FileTest.file?("#{@md.file.output_path.x.dir}/#{@md.file.base_filename.x}")==true + # f[:latex_l],u[:latex_l]='latex_l,', "'#{@md.file.output_path.x.url}/#{@md.file.base_filename.x}'," + #end + ##if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.landscape.tex")==true + ## f[:latex_l],u[:latex_l]='latex_l,', "'#{base}/#{@fnb}/#{@opt}.fns}.landscape.tex'," + ##end + if FileTest.file?("#{@md.file.output_path.digest.dir}/#{@md.file.base_filename.digest}")==true + f[:digest],u[:digest]='digest,', "'#{@md.file.output_path.digest.url}/#{@md.file.base_filename.digest}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:digest]}")==true - f[:digest],u[:digest]='digest,', "'#{base}/#{@fnb}/#{@md.fn[:digest]}'," + if FileTest.file?("#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}")==true #revisit, was to be text, this is html + f[:manifest],u[:manifest]='manifest,', "'#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@md.fn[:manifest]}")==true #revisit, was to be text, this is html - f[:manifest],u[:manifest]='manifest,', "'#{base}/#{@fnb}/#{@md.fn[:manifest]}'," + if FileTest.file?("#{@md.file.output_path.src.dir}/#{@md.file.base_filename.src}")==true + f[:markup],u[:markup]='markup,', "'#{@md.file.output_path.src.url}/#{@md.file.base_filename.src}'," end - if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.meta")==true - f[:markup],u[:markup]='markup,', "'#{base}/#{@fnb}/#{@opt.fns}.meta'," - end - if FileTest.file?("#{out}/#{@fnb}/#{@opt.fns}.tgz")==true - f[:sisupod],u[:sisupod]='sisupod,', "'#{base}/#{@fnb}/#{@opt.fns}.tgz'," + if FileTest.file?("#{@md.file.output_path.sisupod.dir}/#{@md.file.base_filename.sisupod}")==true + f[:sisupod],u[:sisupod]='sisupod,', "'#{@md.file.output_path.sisupod.url}/#{@md.file.base_filename.sisupod}'," end t=SiSU_DbTuple::LoadUrls.new(@conn,f,u,@@id_t,@opt,@file) tuple=t.tuple diff --git a/lib/sisu/v3dv/db_select.rb b/lib/sisu/v3dv/db_select.rb index 478a25fa..bab898f0 100644 --- a/lib/sisu/v3dv/db_select.rb +++ b/lib/sisu/v3dv/db_select.rb @@ -196,6 +196,7 @@ module SiSU_DbSelect db_exist? @sdb_no.drop.tables when /^--(?:db=)?(?:(?:sq)?lite|pg(?:sql)?|my(?:sql)?)$/ + when /^--(?:v\d+|dev)$/ else help=SiSU_Help::Help.new help.summary diff --git a/lib/sisu/v3dv/digests.rb b/lib/sisu/v3dv/digests.rb index 91299d4c..bc4a37e5 100644 --- a/lib/sisu/v3dv/digests.rb +++ b/lib/sisu/v3dv/digests.rb @@ -300,9 +300,9 @@ module SiSU_DigestView data.each do |t_o| dgst=SiSU_TextRepresentation::ModifiedTextPlusHashDigest.new(@md,t_o).composite.dgst if dgst - if t_o.is=='heading' + if t_o.is==:heading digests("#{@sp*0}#{dgst[:ocn]}#{@sp*(8-dgst[:ocn].to_s.length)}#{dgst[:dgst_stripped_txt]} #{dgst[:dgst_markedup_txt]} #{dgst[:is]} #{t_o.lv}") - elsif t_o.is=='heading_insert' + elsif t_o.is==:heading_insert digests("#{@sp*0}[#{dgst[:ocn]}]#{@sp*(6-dgst[:ocn].to_s.length)}#{dgst[:dgst_stripped_txt]} #{dgst[:dgst_markedup_txt]} #{dgst[:is]} #{t_o.lv}") else digests("#{@sp*0}#{dgst[:ocn]}#{@sp*(8-dgst[:ocn].to_s.length)}#{dgst[:dgst_stripped_txt]} #{dgst[:dgst_markedup_txt]} #{dgst[:is]}") @@ -325,7 +325,7 @@ module SiSU_DigestView dal_structure_tree("------------\n") dal_structure_tree("document structure[*]\n") data.each do |t_o| - if t_o.is=='heading' + if t_o.is==:heading x=case t_o.ln when 1; l[1] +=1 #fix Mx[:lv_o] ' '*0 +':A' @@ -342,7 +342,7 @@ module SiSU_DigestView else nil end end - ocn=t_o.ocn if defined? t_o.ocn and t_o.is !='heading_insert' + ocn=t_o.ocn if defined? t_o.ocn and t_o.is !=:heading_insert dal_structure_tree("#{x}\n") if x and not x.empty? end dal_structure_tree(" [*] heading levels\n") diff --git a/lib/sisu/v3dv/epub.rb b/lib/sisu/v3dv/epub.rb index c87112cf..7d90883b 100644 --- a/lib/sisu/v3dv/epub.rb +++ b/lib/sisu/v3dv/epub.rb @@ -160,7 +160,7 @@ module SiSU_EPUB format_head_scroll=SiSU_EPUB_Format::HeadScroll.new(@md) @data.each do |dob| pg=dob.dup - unless pg.is =~/^code/ + unless pg.is ==:code if pg.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ / endnote_array=[] if pg.obj=~/#{Mx[:en_a_o]}[\d*+].+?#{Mx[:en_a_c]}/m @@ -218,8 +218,8 @@ module SiSU_EPUB @ncx_cls=[] @level_a_first_occurrence=true @data.each do |dob| - if dob.is=='heading' \ - or dob.is=='heading_insert' + if dob.is==:heading \ + || dob.is==:heading_insert dob_toc=dob.dup toc=case dob_toc.ln when 1 diff --git a/lib/sisu/v3dv/epub_concordance.rb b/lib/sisu/v3dv/epub_concordance.rb index 1106ec13..e2e5bb5c 100644 --- a/lib/sisu/v3dv/epub_concordance.rb +++ b/lib/sisu/v3dv/epub_concordance.rb @@ -74,9 +74,6 @@ module SiSU_EPUB_Concordance def read begin @env,@md=@particulars.env,@particulars.md - loc=@env.url.output_tell - tool=((@md.opt.cmd =~/[MVv]/) ? "#{@env.program.web_browser} #{loc}/#{@md.fnb}/#{@md.fn[:concordance]}" : '') - SiSU_Screen::Ansi.new(@md.opt.cmd,"Concordance",tool).grey_title_hi unless @md.opt.cmd =~/q/ wordmax=@env.concord_max unless @md.wc_words.nil? if @md.wc_words < wordmax @@ -106,7 +103,7 @@ module SiSU_EPUB_Concordance @fnb=@md.fnb @lex_button=%{<a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" height="44" width="144" valign="center" src="../_sisu/image/sisu.png" alt="SiSU home -->"></a>} @doc_details =<<WOK -<table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right"> </td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.fn[:toc]}" #{@vz.js_toc}><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.creator.author}</p></td></tr></table> +<table summary="links to text related to this rudimentary index" width="96%" border="0" bgcolor="white" cellpadding="0" align="center"><tr><td width="2%" align="right"> </td><td width="94%" valign="top" align="justify"><h1 class="small"><a href="#{@md.file.base_filename.epub}" #{@vz.js_toc}><b>#{@md.title.full}</b></a></h1><p class="bold">#{@md.creator.author}</p></td></tr></table> WOK end def create @@ -175,6 +172,10 @@ WOK end def songsheet begin + #fix to use + p __LINE__.to_s + ':' + __FILE__ + p "#{@path}/content/#{@md.fn[:epub_concord]}" + p "#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}" @file_concordance=File.open("#{@path}/content/#{@md.fn[:epub_concord]}",'w') map_para rescue; SiSU_Errors::InfoError.new($!,$@,@md.opt.cmd,@md.fns).error @@ -205,7 +206,10 @@ WOK @word_map={} @dal_array.each do |line| if defined? line.ocn - if line.is =~/heading/ and line.ln==4; @seg=line.name + if (line.is ==:heading \ + || line.is ==:heading_insert) \ + && line.ln==4 + @seg=line.name end if line.ocn.to_s =~/\d+/; toy=line.ocn.to_s end diff --git a/lib/sisu/v3dv/epub_format.rb b/lib/sisu/v3dv/epub_format.rb index c1987fa0..f88b6745 100644 --- a/lib/sisu/v3dv/epub_format.rb +++ b/lib/sisu/v3dv/epub_format.rb @@ -1718,50 +1718,12 @@ WOK </html>} end end - class Widget < HeadInformation - def initialize(md) - super(md) - @md=md - @cf_defaults=SiSU_Env::InfoProcessingFlag.new - end - def home - %{<td align="center" bgcolor=#{@vz.color_band2}> - <a href="../index.html" target="_top"> - #{@vz.png_homepage}</a> -</td> -} - end - def search - env=SiSU_Env::InfoEnv.new(@md.fns,@md) - env.widget.search_form('sisusearch',nil,nil,true) - end - def manifest - %{<td align="center" bgcolor=#{@vz.color_band2}> - <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}> - #{@vz.nav_txt_manifest} - </a> -</td>} - end - end - class XML - end class HeadToc < HeadInformation def initialize(md) super(md) @md=md @tocband_segtoc=make_seg end - def concordance_navigation_band(type='') - if type=~/pdf/ - @tocband_concordance=make_concordance - end - %{<p class="align_right"> - <a href="index.html" target="_top"> - #{@vz.epub_png_nav_toc} - </a> -</p> -} - end def seg_head_navigation_band firstseg=%{<a href="#{@md.firstseg}#{Sfx[:epub_xhtml]}" target="_top"> #{@vz.epub_png_nav_nxt} @@ -1778,30 +1740,17 @@ WOK ? '' : %{<p class="align_right">#{firstseg}</p>} end - def manifest_link(text) #watch fix removed font size 2 - %{ <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>#{text}</a>} + def manifest_link(text) + %{ <a href="#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}" target="_top" #{@vz.js_manifest}>#{text}</a>} end - def concordance_link(text) #watch fix removed font size 2 + def concordance_link(text) if @md.concord_make - %{<a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}> + %{<a href="#{@md.file.base_filename.html_concordance}" target="_top" #{@vz.js_concordance}> #{text} </a>} else '' end end - def make_concordance - manifest=scroll=seg='' - wgt=SiSU_EPUB_Format::Widget.new(@md) - %{<table summary="toc scroll and segment with pdf" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{wgt.seg(@vz.nav_txt_toc_link)}#{wgt.scroll(@vz.nav_txt_doc_link)}#{wgt.pdf}#{wgt.odf} -<td align="center" bgcolor=#{@vz.color_band2}> - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - end def head %{#{doc_type} <head> @@ -1815,7 +1764,7 @@ WOK if @md.concord_make %{#{@vz.margin_css} <h4 class="toc"> - <a href="./#{@md.fn[:concordance]}" #{@vz.js_concordance}> + <a href="./#{@md.file.base_filename.html_concordance}" #{@vz.js_concordance}> <i>Concordance</i> </a> </h4> @@ -1879,10 +1828,6 @@ WOK </h4> #{@vz.table_close}} end - def seg_metadata - @metalink=%{./#{@md.fn[:metadata]}} - metadata - end end class HeadSeg < HeadInformation def initialize(md) @@ -1896,227 +1841,15 @@ WOK #{@md.html_title} </title> <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -#{@vz.font_css_table_file} +#{@css.xhtml_epub} </head> -#{@vz.color_body} -#{@vz.js_top}} - end - def title_banner(title,subtitle,creator) - end - def dot_control_pre_next - %{<table summary="segment hidden control pre and next" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> -<tr><td align="left"> - <a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker-1]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_prev}> - #{@vz.png_nav_dot_pre} - </a> -</td> -<td align="center"> - <a href="#{@index}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_toc}> - #{@vz.png_nav_dot_toc} - </a> -</td> -<td align="right"> - <a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker+1]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_next}> - #{@vz.png_nav_dot_nxt} - </a> -#{@vz.table_close}} - end - def dot_control_pre - %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> -<tr><td align="left"> - <a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker-1]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_prev}> - #{@vz.png_nav_dot_pre} - </a> -</td> -<td align="center"> - <a href="#{@index}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_toc}> - #{@vz.png_nav_dot_toc} - </a> -</td> -<td align="right"> - <a href="#{@md.fn[:toc]}" target="_top" #{@vz.js_next}> - #{@vz.png_nav_dot_nxt} - </a> -#{@vz.table_close}} - end - def toc_nav(f_pre=false,f_nxt=false,use=1) - pre=nxt='' - toc=%{<a href="#{@index}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_toc}> - #{@vz.epub_png_nav_toc} -</a> -} - pre=%{<a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker-use]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_prev}> - #{@vz.epub_png_nav_pre} -</a> -} if f_pre==true - nxt=%{<a href="#{@seg_name_xhtml[@seg_name_xhtml_tracker+1]}#{Sfx[:epub_xhtml]}" target="_top" #{@vz.js_next}> - #{@vz.epub_png_nav_nxt} - </a> -} if f_nxt==true - DISABLE[:epub][:internal_navigation] \ - ? '' - : %{<p class="align_right"> -#{pre} -#{toc} -#{nxt} -</p> -} - end - def toc_next2 - pre,nxt=false,true - toc_nav(false,true).dup - end - def toc_pre_next2 - toc_nav(true,true).dup - end - def toc_pre2 - toc_nav(true,false).dup - end - def manifest_link(text) - %{<a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}> - #{text} - </a>} - end - def concordance_link(text) - if @md.concord_make - %{<a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}> - #{text} - </a>} - else '' - end - end - def doc_types #used in seg_nav_band ### - scroll=seg='' - wgt=SiSU_EPUB_Format::Widget.new(@md) - x=if @md.concord_make - %{ -<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{wgt.seg(@vz.nav_txt_toc_link)} - #{wgt.scroll(@vz.nav_txt_doc_link)} - #{wgt.pdf}#{wgt.odf} -<td align="center" bgcolor=#{@vz.color_band2}> - #{wgt.concordance(@vz.nav_txt_concordance)} - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - else - %{ -<table summary="segment navigation available documents types: toc,doc,pdf,concordance" border="0" cellpadding="3" cellspacing="0"> -<tr> - #{wgt.seg(@vz.nav_txt_toc_link)} - #{wgt.scroll(@vz.nav_txt_doc_link)} - #{wgt.pdf}#{wgt.odf} -<td align="center" bgcolor=#{@vz.color_band2}> - #{wgt.manifest} - #{wgt.search} - #{wgt.home} -</tr></table>} - end - end - def navigation_table - %{<table summary="navigation segment table" width=#{@vz.table_width_1} border="0" bgcolor="white" cellpadding="0"> -<tr><th width="#{@@indent['leve_1']}" align="right"> -</td> -<td valign="top"> - <font size=2>} - end - def navigation_table1 - %{<table summary="navigation segment table1" width=#{@vz.table_width_1} border="0" cellpadding=#{@vz.table_cellpad_box} bgcolor=#{@vz.color_table1} align="left"> -<tr><td valign="top"> - <font size="2">} - end - def navigation_table2 - %{<table summary="navigation segment table2" width=#{@vz.table_width_2} border="0" cellpadding=#{@vz.table_cellpad_box} bgcolor=#{@vz.color_table2} align="left"> -<tr><td valign="top"> - <font size="2">} - end - def heading_advert_local_1 - dir=SiSU_Env::InfoEnv.new(@fns) - %{ <p class="center"> -<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center"> -<tr><td align="center" bgcolor="white"> - <a href="http://#{@md.ad_url}#{Sfx[:epub_xhtml]}" target="_top"> - <img border="0" src="#{dir.url.images_epub}/#{@md.ad_png}" alt="#{@md.ad_alt}" /> - </a> -#{@vz.table_close} -</p>} - end - def heading_advert_local_2 - dir=SiSU_Env::InfoEnv.new(@fns) - %{ <p class="center"> -<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center"> -<tr><td align="center" bgcolor="white"> - <a href="#{@md.ad_url}#{Sfx[:epub_xhtml]}" target="_top"> - <img border="0" src="#{dir.url.images_epub}/#{@md.ad_png}" alt="#{@md.ad_alt}" /> - </a> -#{@vz.table_close} -</p>} - end - def heading_advert_external - dir=SiSU_Env::InfoEnv.new(@fns) - %{ <p class="center"> -<table summary="image" border="0" cellpadding="3" cellspacing="0" align="center"> -<tr><td align="center" bgcolor="white"> - <a href="#{@md.ad_url}#{Sfx[:epub_xhtml]}" target="external"> - <img border="0" src="#{dir.url.images_epub}/#{@md.ad_png}" alt="#{@md.ad_alt}" /> - </a> -#{@vz.table_close} -</p>} - end - def navigation_band(segtocband) #change name to navigaion_band_banner - %{#{segtocband} -} - end - def navigation_band_bottom(segtocband,seg_table_top_control) #change name to navigaion_band_bannerless - %{ -<div class="main_column"> - <table summary="segment navigation band" bgcolor=#{@vz.color_band1} width="100%"><tr> - <td width="70%" align="center"> - #{doc_types} - </td> - <td width="30%" align="right"> - #{segtocband} - </td></tr> - </table> - #{seg_table_top_control} -</div> -} +#{@vz.color_body}} end def endnote_mark %{ <hr class="endnote" /> } end - def endnote_section_open -%{ -<div class="endnote"> -} - end - def endnote_section_close -%{ -</div> -} #revisit - end - def head - %{#{doc_type} -<head> - <title> - #{@seg_name_xhtml[@seg_name_xhtml_tracker]} - - #{@md.html_title} - </title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -#{@css.xhtml_epub} -</head> -#{@vz.color_body}} - end - def toc_metadata - @metalink=%{./#{@md.fn[:metadata]}} - toc_metadata - end - def title_banner(title,subtitle,creator) - end end class HeadScroll < HeadToc def initialize(md) @@ -2168,7 +1901,7 @@ WOK @named=nametags_seg(@dob) @txt=((defined? t_o.obj) ? t_o.obj : nil) @ocn=((defined? t_o.ocn) ? t_o.ocn.to_s : nil) - @headname=((t_o.is=='heading' and defined? t_o.name) ? t_o.name : nil) + @headname=((t_o.is==:heading and defined? t_o.name) ? t_o.name : nil) else if @md.opt.cmd =~/M/ p __FILE__ +':'+ __LINE__.to_s diff --git a/lib/sisu/v3dv/epub_segments.rb b/lib/sisu/v3dv/epub_segments.rb index 1119d8c8..55c6c1f9 100644 --- a/lib/sisu/v3dv/epub_segments.rb +++ b/lib/sisu/v3dv/epub_segments.rb @@ -69,26 +69,19 @@ module SiSU_EPUB_Seg filename_seg=[] filename_seg << @seg[:title] << @seg[:nav] if @type=='endnotes' - @seg[:headings]=[] - format_head_seg=SiSU_EPUB_Format::HeadSeg.new(@md) - @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author) + @seg[:headings]=[] #watch txt_obj={ txt: 'Endnotes', ocn_display: ''} format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @seg[:headings] << format_seg.title_heading1 filename_seg << @seg[:heading_endnotes] << @seg[:headings] << %{\n<div class="content">\n} << @seg[:endnote_all] << '</div>' elsif @type=='idx' @seg[:headings]=[] - format_head_seg=SiSU_EPUB_Format::HeadSeg.new(@md) - @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author) - txt_obj={ txt: 'Index', ocn_display: ''} format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @seg[:headings] << format_seg.title_heading1 filename_seg << @seg[:heading_idx] << @seg[:headings] << %{\n<div class="content">\n} << @seg[:idx] << '</div>' elsif @type=='metadata' metadata=SiSU_Metadata::Summary.new(@md).xhtml_display.metadata @seg[:headings]=[] - format_head_seg=SiSU_EPUB_Format::HeadSeg.new(@md) - @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author) txt_obj={ txt: 'Metadata', ocn_display: ''} format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @seg[:headings] << format_seg.title_heading1 @@ -104,8 +97,6 @@ WOK else '' end @seg[:headings]=[] - format_head_seg=SiSU_EPUB_Format::HeadSeg.new(@md) - @seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author) txt_obj={ txt: 'Manifest', ocn_display: ''} format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,txt_obj) @seg[:headings] << format_seg.title_heading1 @@ -131,10 +122,9 @@ WOK @@loop_count=@@seg_total=@@tracker=0 @@is4=@@is3=@@is2=@@is1=0 @@heading1=@@heading2=@@heading3=@@heading4=0 - @@seg[:nav],@@seg[:title],@@seg[:headings],@@seg[:main],@@seg[:idx],@@seg[:tail],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(10){[]} + @@seg[:headings],@@seg[:main],@@seg[:idx],@@seg[:tail],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(7){[]} @@seg[:heading_endnotes]='' @@tablehead,@@number_of_cols=0,0 - @@segtocband=nil @@fns_previous='' attr_reader :seg_name_xhtml,:seg_name_xhtml_tracker def initialize(md='',data='') @@ -167,8 +157,8 @@ WOK @@seg[:heading_idx]='' end data.each do |dob| - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln==4 @@seg_name << dob.name seg_name=dob.name @@ -193,8 +183,8 @@ WOK # # end # #end #end - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln==4 if dob.ocn==0 @@heading4=dob.obj @@ -202,27 +192,27 @@ WOK end @@is4=newfile=1 end - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln==3 @@heading3=dob.obj @@is4,@@is3=0,1 end - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln==2 @@heading2=dob.obj @@is4,@@is3,@@is2=0,0,1 end - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln==1 @@heading1=dob.obj @@is4,@@is3,@@is2,@@is1=0,0,0,1 end if (@@is1 && !@@is2 && !@@is3 && !@@is4) - if not (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if not (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln==1 head1=$_ #; check end @@ -232,17 +222,17 @@ WOK if newfile==1 \ or dob.obj =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/ newfile=0 - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln==4 if tracking != 0 SiSU_EPUB_Seg::Seg.new(@md).tail segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking-1]}#{Sfx[:epub_xhtml]}" output_epub_cont_seg=File.new(segfilename,'w') if @@seg_name_xhtml[tracking-1] - if dob.is=='heading' \ + if dob.is==:heading \ or @@seg_name_xhtml[tracking-1] !~/endnotes|book_index|metadata/ SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,@minitoc).output - elsif dob.is=='heading_insert' + elsif dob.is==:heading_insert if @@seg_name_xhtml[tracking-1]=='endnotes' SiSU_EPUB_Seg::Output.new(@md,output_epub_cont_seg,@@seg,@minitoc,'endnotes').output elsif @@seg_name_xhtml[tracking-1]=='book_index' @@ -272,8 +262,8 @@ WOK end tracking=tracking+1 end - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln==4 \ and dob.name @@get_hash_to=dob.name @@ -296,31 +286,16 @@ WOK data end def heading_art(dob) - format_head_seg=SiSU_EPUB_Format::HeadSeg.new(@md) - if dob.is=='heading' \ - and dob.ln =~/^[1-6]/ - @@seg[:dot_nav]= (@@tracker < @@seg_total-1) \ - ? format_head_seg.dot_control_pre_next - : format_head_seg.dot_control_pre - end - @@seg[:title]=format_head_seg.head + @@seg[:title]=SiSU_EPUB_Format::HeadSeg.new(@md).head end def head(dob) clean=/<!.*?!>|<:.*?>$/ - format_head_seg=SiSU_EPUB_Format::HeadSeg.new(@md) - if @@tracker < @@seg_total-1 - @@segtocband=(@@tracker==0) \ - ? format_head_seg.toc_next2 - : format_head_seg.toc_pre_next2 - else @@segtocband=format_head_seg.toc_pre2 #if format_head_seg.toc_pre2 - end @p_num ||= '' if @@is1==1 if defined? @md.creator.author \ and @md.creator.author @author=%{<b>#{@md.creator.author}</b>\n} end - @@seg[:nav] << format_head_seg.navigation_band(@@segtocband) ocn=if @@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]; $1 #fix else '' end @@ -366,23 +341,25 @@ WOK end def markup(dob) @debug=[] - format_head_seg=SiSU_EPUB_Format::HeadSeg.new(@md) - if dob.is =~/(?:heading|para)/ #extend as necessary FIX + if dob.is ==:heading \ + || dob.is ==:heading_insert \ + || dob.is ==:para + #extend as necessary FIX @p_num=SiSU_EPUB_Format::ParagraphNumber.new(@md,dob.ocn) end sto=SiSU_EPUB_Format::FormatTextObject.new(@md,dob) - dob_xhtml=if dob.is=='heading' \ - or dob.is=='heading_insert' \ - or dob.is=='para' - dob_xhtml=if dob.is=='heading' \ - or dob.is=='heading_insert' + dob_xhtml=if dob.is==:heading \ + || dob.is==:heading_insert \ + || dob.is==:para + dob_xhtml=if dob.is==:heading \ + or dob.is==:heading_insert if dob.ln==4 sto.seg_heading4 # work on see SplitTextObject elsif dob.ln==5 sto.seg_heading5 elsif dob.ln==6; sto.seg_heading6 end - elsif dob.is=='para' + elsif dob.is==:para if dob.indent \ and dob.hang \ and dob.indent =~/[0-9]/ \ @@ -400,33 +377,37 @@ WOK else sto.para end end - elsif dob.is =~/^(?:block|group|alt)$/ + elsif dob.is ==:block \ + || dob.is ==:group \ + || dob.is ==:alt sto.para #fix this should be block type specific #FIX - elsif dob.is=='verse' + elsif dob.is==:verse sto.verse - elsif dob.is=='code' + elsif dob.is==:code sto.code - elsif dob.is=='table' + elsif dob.is==:table sto.table - elsif dob.is=='break' + elsif dob.is==:break sto.break end if @md.flag_separate_endnotes # may need to revisit, check dob.obj=dob.obj.gsub(/"\s+href="#note_ref(\d+)">/,%{" href=\"endnotes#{Sfx[:epub_xhtml]}#note_ref\\1">}) #endnote- twice #removed file type end - if dob.is =~/heading|para/ \ - and (not dob.ocn or dob.ocn.to_s.empty?) + if (dob.is ==:heading \ + || dob.is==:heading_insert \ + || dob.is==:para) \ + && (not dob.ocn or dob.ocn.to_s.empty?) format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,dob) end - if (dob.is=='heading' \ - || dob.is=='heading_insert' \ - || dob.is=='para') \ + if (dob.is==:heading \ + || dob.is==:heading_insert \ + || dob.is==:para) \ and dob.note_ #dob.obj =~/<a href="#note_ref\d+"> <sup id=/ #endnote- note- format_seg=SiSU_EPUB_Format::FormatSeg.new(@md,dob) dob.obj=format_seg.no_paranum end - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln==4 @@seg[:main] << %{\n<div class="content">\n} @@seg[:main] << dob_xhtml @@ -451,8 +432,7 @@ WOK @@seg[:close] << format_head_seg.xhtml_close end def reinitialise - @@seg[:title],@@seg[:dot_nav],@@seg[:nav],@@seg[:headings],@@seg[:main],@@seg[:tail],@@seg[:credits]=Array.new(8){[]} - @@segtocband=nil + @@seg[:headings],@@seg[:main],@@seg[:tail],@@seg[:credits]=Array.new(4){[]} end def cleanup reinitialise @@ -465,8 +445,8 @@ WOK data.each do |dob| dob.obj=dob.obj.gsub(/<a name=\"h\d.*?\">(.+?)<\/a>/mi,'\1') if @md.flag_auto_endnotes - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln.to_s =~/^[1234]/ \ and not @@fn.to_s.empty? @@seg_endnotes[@@fn]=[] @@ -474,8 +454,8 @@ WOK @@seg_endnotes_array=[] if dob.ln==4 @@fns_previous=@md.fns if dob.ln==4 and dob.name =~/^meta/ end - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ and dob.ln==4 #% EXTRACTION OF SUB-TOCs & SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs @@seg_subtoc[@@fn]=@@seg_subtoc_array @@seg_subtoc_array=[] @@ -489,7 +469,7 @@ WOK end end end - if dob.is=='heading' \ + if dob.is==:heading \ and dob.ln.to_s =~/^[56]/ case dob.ln when 5 @@ -504,7 +484,7 @@ WOK if @md.flag_auto_endnotes ast,pls='*','+' if dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(?:\d|#{ast}|#{pls})+ / \ - and dob.is !~/^code/ # endnote- + and dob.is !=:code # endnote- endnote_array=[] if dob.obj=~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m endnote_array << dob.obj.scan(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m) diff --git a/lib/sisu/v3dv/epub_tune.rb b/lib/sisu/v3dv/epub_tune.rb index dfb19caf..34466926 100644 --- a/lib/sisu/v3dv/epub_tune.rb +++ b/lib/sisu/v3dv/epub_tune.rb @@ -225,7 +225,7 @@ module SiSU_EPUB_Tune @data.each do |dob| dob.obj=dob.obj.gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;'). gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;') - dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is=='table' + dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is==:table dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>'). gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>'). gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>'). @@ -309,7 +309,7 @@ module SiSU_EPUB_Tune data=@data @tuned_file=[] data.each do |dob| - unless dob.is=='code' + unless dob.is==:code if dob.obj =~/<::\s+/ #watch dob.obj=dob.obj.gsub(/<::\s+(\S+?)\s+!>/, %{<img src="#{@env.url.images_epub}/c_\\1.png" alt="\\1" width="14" height="14" align="bottom" border="0" />}) @@ -369,7 +369,7 @@ module SiSU_EPUB_Tune a,s='_a','_s' ast,pls='*','+' data.each do |dob| - unless dob.is =~/^code/ + unless dob.is ==:code dob.obj=dob.obj.gsub(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/, %{#{Mx[:nbsp]}<a href="#note\\2">#{Mx[:nbsp]}<sup id="note_ref\\2">\\2</sup>#{Mx[:nbsp]}</a> } + #note- endnote- %{\\1\\2 <a href="#note_ref\\2">#{Mx[:nbsp]}<sup id="note\\2">\\2.</sup></a> \\3 \\4}). #endnote- note- (careful may have switched) diff --git a/lib/sisu/v3dv/html.rb b/lib/sisu/v3dv/html.rb index 2c249348..ec7b0573 100644 --- a/lib/sisu/v3dv/html.rb +++ b/lib/sisu/v3dv/html.rb @@ -146,7 +146,7 @@ module SiSU_HTML @md.opt.cmd=@md.opt.cmd.gsub(/H/,'h') @md.file_type='html' if @md.opt.cmd =~/[hon]/ directories - newfilename=%{#{@env.path.output}/#{@md.fnb}/#{@md.fn[:index]}} if @md.file_type =~/html/ + newfilename=%{#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_segtoc}} if @md.file_type =~/html/ dal_array=@particulars.dal_array # dal file drawn here @tuned_file_array=SiSU_HTML_Tune::Tune.new(dal_array,@md).songsheet @tuned_file_array @@ -195,7 +195,7 @@ module SiSU_HTML format_head_scroll=SiSU_HTML_Format::HeadScroll.new(@md) @data.each do |dob| pg=dob.dup - unless pg.is =~/^code/ + unless pg.is ==:code if pg.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ / endnote_array=[] if pg.obj=~/#{Mx[:en_a_o]}[\d*+].+?#{Mx[:en_a_c]}/m @@ -233,11 +233,11 @@ module SiSU_HTML @@firstseg=nil @@toc={ seg: [], seg_mini: [], scr: [] } @data.each do |dob| - if dob.is=='heading' \ - or dob.is=='heading_insert' + if dob.is==:heading \ + || dob.is==:heading_insert dob_toc=dob.dup - toc=if dob_toc.is =='heading' \ - or dob.is=='heading_insert' + toc=if dob_toc.is ==:heading \ + || dob.is==:heading_insert toc=case dob_toc.ln when 1; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_1 when 2; SiSU_HTML::Source::Toc.new(@md,dob_toc).level_2 diff --git a/lib/sisu/v3dv/html_format.rb b/lib/sisu/v3dv/html_format.rb index fdf7f568..29d1bfcb 100644 --- a/lib/sisu/v3dv/html_format.rb +++ b/lib/sisu/v3dv/html_format.rb @@ -176,7 +176,7 @@ module SiSU_HTML_Format end def seg(text) %{<td align="center" bgcolor="#99CC66"> - <a href="#{@md.fn[:toc]}" target="_top" #{@vz.js_doc}> + <a href="#{@md.file.base_filename.html_segtoc}" target="_top" #{@vz.js_doc}> #{text} </a> </td> @@ -253,7 +253,7 @@ module SiSU_HTML_Format if @md.concord_make \ and @md.wc_words < 300000 #max word count for display of concordance here as would now be a large file %{<td align="center" bgcolor=#{@vz.color_band2}> - <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}> + <a href="#{@md.file.base_filename.html_concordance}" target="_top" #{@vz.js_concordance}> #{text} </a> </td>} @@ -336,13 +336,13 @@ WOK def manifest_link(text) # @file=SiSU_Env::FileOp.new(@md) if @md %{<font size=2> - <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>#{text}</a> + <a href="#{@md.file.base_filename.manifest}" target="_top" #{@vz.js_manifest}>#{text}</a> </font>} end def concordance_link(text) if @md.concord_make %{<font size=2> - <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}> + <a href="#{@md.file.base_filename.html_concordance}" target="_top" #{@vz.js_concordance}> #{text} </a> </font>} @@ -406,7 +406,7 @@ WOK if @md.concord_make %{#{@vz.margin_css} <h4 class="toc"> - <a href="./#{@md.fn[:concordance]}" #{@vz.js_concordance}> + <a href="./#{@md.file.base_filename.html_concordance}" #{@vz.js_concordance}> <i>Concordance</i> </a> </h4> @@ -431,7 +431,7 @@ WOK Quick Ref.: </li> <li class="ref"> - <a href="#{@md.fn[:manifest]}" alt="Document Manifest" target="_top"> + <a href="#{@md.file.base_filename.manifest}" alt="Document Manifest" target="_top"> Manifest </a> </li> @@ -452,7 +452,7 @@ WOK Quick Ref.: </li> <li class="ref"> - <a href="#{@md.fn[:manifest]}" alt="Document Manifest" target="_top"> + <a href="#{@md.file.base_filename.manifest}" alt="Document Manifest" target="_top"> Manifest </a> </li> @@ -553,10 +553,6 @@ WOK </h4> #{@vz.table_close}} end - def seg_metadata - @metalink=%{./#{@md.fn[:metadata]}} - metadata - end def seg_tail %{ <div class="main_column"> @@ -625,24 +621,6 @@ WOK def initialize(md) #(md='') super(md) end - def head - rdf=SiSU_XML_Tags::RDF.new(@md) - %{#{doc_type} -<head> - <title> - #{@seg_name_html[@seg_name_html_tracker]} - - #{@md.html_title} - </title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -#{rdf.metatag_html} -#{@vz.font_css_table_file} -</head> -#{@vz.color_body} -<a name="top" id="top"></a> -<a name="up" id="up"></a> -<a name="start" id="start"></a> -#{@vz.js_top}} - end def title_banner(title,subtitle,creator) end def dot_control_pre_next @@ -676,7 +654,7 @@ WOK def dot_control_pre pre="#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.lang_code_insert}#{Sfx[:html]}" up="#{@toc}#{@md.lang_code_insert}#{Sfx[:html]}" - nxt="#{@md.fn[:toc]}" + nxt="#{@md.file.base_filename.html_segtoc}" %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> <tr><td align="left"> <a href="#{pre}" target="_top" #{@vz.js_prev}> @@ -738,7 +716,7 @@ WOK end def manifest_link(text) %{<font size=2> - <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}> + <a href="#{@md.file.base_filename.manifest}" target="_top" #{@vz.js_manifest}> #{text} </a> </font>} @@ -746,7 +724,7 @@ WOK def concordance_link(text) if @md.concord_make %{<font size=2> - <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}> + <a href="#{@md.file.base_filename.html_concordance}" target="_top" #{@vz.js_concordance}> #{text} </a> </font>} @@ -865,24 +843,6 @@ WOK </div> } #revisit end - def head - rdf=SiSU_XML_Tags::RDF.new(@md) - %{#{doc_type} -<head> - <title> - #{@seg_name_html[@seg_name_html_tracker]} - - #{@md.html_title} - </title> -<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> -#{rdf.metatag_html} -#{@css.html} -</head> -#{@vz.color_body} -<a name="top" id="top"></a> -<a name="up" id="up"></a> -<a name="start" id="start"></a> -#{@vz.js_top}} - end def head_seg rdf=SiSU_XML_Tags::RDF.new(@md) %{#{doc_type} @@ -901,10 +861,6 @@ WOK <a name="start" id="start"></a> #{@vz.js_top}} end - def toc_metadata - @metalink=%{./#{@md.fn[:meatadata]}} - toc_metadata - end def title_banner(title,subtitle,creator) %{ <div class="summary"> @@ -965,7 +921,7 @@ WOK @named=nametags_seg(@dob) @txt=((defined? t_o.obj) ? t_o.obj : nil) @ocn=((defined? t_o.ocn) ? t_o.ocn.to_s : nil) - @headname=((t_o.is=='heading' and defined? t_o.name) ? t_o.name : nil) + @headname=((t_o.is==:heading and defined? t_o.name) ? t_o.name : nil) else if @md.opt.cmd =~/M/ p t_o.class @@ -1000,9 +956,9 @@ WOK tags end def headname #check whether used - hn=if @t_o.is =='heading' \ + hn=if @t_o.is ==:heading \ and not @t_o.name.empty? #determine use - hn=if @t_o.is =='heading'; %{<a name="h#{@t_o.name}" id="h#{@t_o.name}"></a>} + hn=if @t_o.is ==:heading; %{<a name="h#{@t_o.name}" id="h#{@t_o.name}"></a>} else %{<a name="#{@t_o.name}" id="#{@t_o.name}"></a>} end else nil diff --git a/lib/sisu/v3dv/html_minitoc.rb b/lib/sisu/v3dv/html_minitoc.rb index d70fa7e1..729eee50 100644 --- a/lib/sisu/v3dv/html_minitoc.rb +++ b/lib/sisu/v3dv/html_minitoc.rb @@ -74,7 +74,8 @@ toc=nil @toc=[] @data.each do |txt| - if (txt.is =='heading' or txt.is =='heading_insert') + if txt.is ==:heading \ + || txt.is ==:heading_insert txt.obj=txt.obj.gsub(/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]}).+?(?:#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/m,''). #remove endnotes from toc gsub(/<a name="-\d+" href="#_\d+"> <sup>\d+<\/sup> <\/a>/,''). gsub(@pat_strip_heading_name,'\1') @@ -108,8 +109,9 @@ end def level_1 txt=@data - if (txt.is =='heading' or txt.is =='heading_insert') \ - and txt.ocn !=0 + if (txt.is ==:heading \ + || txt.is ==:heading_insert) \ + && txt.ocn !=0 txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1') end title=unless txt.obj =~/Document Information/; txt.obj @@ -128,8 +130,9 @@ end def level_2 txt=@data - if (txt.is =='heading' or txt.is =='heading_insert') \ - and txt.ocn !=0 + if (txt.is ==:heading \ + || txt.is ==:heading_insert) \ + && txt.ocn !=0 txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1') end txt_obj={ txt: txt.obj } @@ -165,8 +168,9 @@ end def level_5 txt=@data - if (txt.is =='heading' or txt.is =='heading_insert') \ - and txt.ocn !=0 + if (txt.is ==:heading \ + || txt.is ==:heading_insert) \ + && txt.ocn !=0 txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1') end toc={} @@ -180,8 +184,9 @@ end def level_6 txt=@data - if (txt.is =='heading' or txt.is =='heading_insert') \ - and txt.ocn !=0 + if (txt.is ==:heading \ + || txt.is ==:heading_insert) \ + && txt.ocn !=0 txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1') end toc={} diff --git a/lib/sisu/v3dv/html_scroll.rb b/lib/sisu/v3dv/html_scroll.rb index 89f88b04..a4d2089e 100644 --- a/lib/sisu/v3dv/html_scroll.rb +++ b/lib/sisu/v3dv/html_scroll.rb @@ -100,13 +100,14 @@ module SiSU_HTML_Scroll gsub(/href="#{Xx[:segment]}/m,'href="'). gsub(/(?:\s*#{Mx[:br_page]}\s*|\s*#{Mx[:br_page_new]}\s*)+/m,'<p><hr width=90% /></p>') if dob.obj !~/(^#{Rx[:meta]}|#{Mx[:br_eof]})/ - unless dob.is =~/^code/; dob.obj=dob.obj.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') + unless dob.is ==:code + dob.obj=dob.obj.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') end if defined? dob.ocn @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,dob.ocn) end sto=SiSU_HTML_Format::FormatTextObject.new(@md,dob) - para_html=if dob.is=='heading' + para_html=if dob.is==:heading x=if dob.ln==1 sto.heading_body1 elsif dob.ln==2 @@ -120,7 +121,7 @@ module SiSU_HTML_Scroll elsif dob.ln==6 sto.heading_body6 end - elsif dob.is=='heading_insert' + elsif dob.is==:heading_insert x=if dob.ln==1 sto.heading_body1 elsif dob.ln==2 @@ -152,7 +153,7 @@ module SiSU_HTML_Scroll elsif dob.ln==6 sto.heading_body6 end - elsif dob.is=='para' + elsif dob.is==:para if dob.indent \ and dob.hang \ and dob.indent =~/[0-9]/ \ @@ -171,19 +172,19 @@ module SiSU_HTML_Scroll end else sto.para end - elsif dob.is=='block' + elsif dob.is==:block sto.block - elsif dob.is=='group' + elsif dob.is==:group sto.group - elsif dob.is=='alt' + elsif dob.is==:alt sto.alt - elsif dob.is=='verse' + elsif dob.is==:verse sto.verse - elsif dob.is=='code' + elsif dob.is==:code sto.code - elsif dob.is=='table' + elsif dob.is==:table sto.table - elsif dob.is=='break' + elsif dob.is==:break sto.break end if dob =~/<a name="n\d+">/ \ diff --git a/lib/sisu/v3dv/html_segments.rb b/lib/sisu/v3dv/html_segments.rb index ba825ae4..eca87b12 100644 --- a/lib/sisu/v3dv/html_segments.rb +++ b/lib/sisu/v3dv/html_segments.rb @@ -167,8 +167,9 @@ module SiSU_HTML_Seg @@seg[:heading_idx]='' end data.each do |dob| - if (dob.is=='heading' or dob.is=='heading_insert') \ - and dob.ln==4 + if (dob.is == :heading \ + || dob.is == :heading_insert) \ + && dob.ln == 4 @@seg_name << dob.name seg_name=dob.name end @@ -192,32 +193,37 @@ module SiSU_HTML_Seg end end end - if (dob.is=='heading' or dob.is=='heading_insert') \ - and dob.ln==4 + if (dob.is==:heading \ + || dob.is==:heading_insert) \ + && dob.ln==4 if dob.ocn==0 @@heading4=dob.obj else @@heading4=dob.obj end @@is4=newfile=1 end - if (dob.is=='heading' or dob.is=='heading_insert') \ - and dob.ln==3 + if (dob.is==:heading \ + || dob.is==:heading_insert) \ + && dob.ln==3 @@heading3=dob.obj @@is4,@@is3=0,1 end - if (dob.is=='heading' or dob.is=='heading_insert') \ - and dob.ln==2 + if (dob.is==:heading \ + || dob.is==:heading_insert) \ + && dob.ln==2 @@heading2=dob.obj @@is4,@@is3,@@is2=0,0,1 end - if (dob.is=='heading' or dob.is=='heading_insert') \ - and dob.ln==1 + if (dob.is==:heading \ + || dob.is==:heading_insert) \ + && dob.ln==1 @@heading1=dob.obj @@is4,@@is3,@@is2,@@is1=0,0,0,1 end if (@@is1 && !@@is2 && !@@is3 && !@@is4) - if not (dob.is=='heading' or dob.is=='heading_insert') \ - and dob.ln==1 + if not (dob.is==:heading \ + || dob.is==:heading_insert) \ + && dob.ln==1 head1=$_ #; check end end @@ -225,8 +231,9 @@ module SiSU_HTML_Seg if newfile==1 \ or dob.obj =~/^#{Mx[:br_endnotes]}|^#{Mx[:br_eof]}/ newfile=0 - if (dob.is=='heading' or dob.is=='heading_insert') \ - and dob.ln==4 + if (dob.is==:heading \ + || dob.is==:heading_insert) \ + && dob.ln==4 if tracking != 0 dirout=SiSU_Env::InfoEnv.new(@md.fns) dir_sisu=dirout.path.output @@ -240,10 +247,10 @@ module SiSU_HTML_Seg minitoc=(@env.html_minitoc?) \ ? @minitoc : '' - if dob.is=='heading' \ - or @@seg_name_html[tracking-1] !~/endnotes|book_index|metadata/ + if dob.is==:heading \ + || (@@seg_name_html[tracking-1] !~/endnotes|book_index|metadata/) SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc).output - elsif dob.is=='heading_insert' + elsif dob.is==:heading_insert if @@seg_name_html[tracking-1]=='endnotes' SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc,'endnotes').output elsif @@seg_name_html[tracking-1]=='book_index' @@ -273,8 +280,13 @@ module SiSU_HTML_Seg end tracking=tracking+1 end - @@get_hash_to=dob.name if (dob.is=='heading' or dob.is=='heading_insert') and dob.ln==4 and dob.name - @@get_hash_fn=dob.name if (dob.is=='heading' or dob.is=='heading_insert') and dob.ln==4 and dob.name + if (dob.is==:heading \ + || dob.is==:heading_insert) \ + && dob.ln==4 \ + && dob.name + @@get_hash_to=dob.name + @@get_hash_fn=dob.name + end if dob.obj.class==String markup(dob) elsif dob.obj.class==Array @@ -293,8 +305,9 @@ module SiSU_HTML_Seg end def heading_art(dob) format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md) - if (dob.is=='heading' or dob.is=='heading_insert') \ - and dob.ln.to_s =~/^[1-6]/ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ + && (dob.ln.to_s =~/^[1-6]/) if @@tracker < @@seg_total-1; @@seg[:dot_nav]=format_head_seg.dot_control_pre_next else @@seg[:dot_nav]=format_head_seg.dot_control_pre end @@ -370,14 +383,18 @@ module SiSU_HTML_Seg def markup(dob) @debug=[] format_head_seg=SiSU_HTML_Format::HeadSeg.new(@md) - if dob.is !~/meta/ - if dob.is =~/(?:heading|para)/ #extend as necessary FIX + if dob.is !=:meta + if dob.is==:heading \ + || dob.is==:heading_insert \ + || dob.is == :para @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,dob.ocn) end sto=SiSU_HTML_Format::FormatTextObject.new(@md,dob) - dob_html=if dob.is =~/heading|para/ - dob_html=if (dob.is=='heading' \ - or dob.is=='heading_insert') + dob_html=if dob.is == :heading \ + || dob.is==:heading_insert \ + || dob.is==:para + dob_html=if dob.is==:heading \ + || dob.is==:heading_insert x=if dob.ln==4 sto.seg_heading4 elsif dob.ln==5 @@ -385,7 +402,7 @@ module SiSU_HTML_Seg elsif dob.ln==6 sto.seg_heading6 end - elsif dob.is=='para' + elsif dob.is==:para if dob.indent \ and dob.hang \ and dob.indent =~/[0-9]/ \ @@ -405,26 +422,30 @@ module SiSU_HTML_Seg else sto.para end end - elsif dob.is=='block' + elsif dob.is==:block sto.block - elsif dob.is=='group' + elsif dob.is==:group sto.group - elsif dob.is=='alt' + elsif dob.is==:alt sto.alt - elsif dob.is=='verse' + elsif dob.is==:verse sto.verse - elsif dob.is=='code' + elsif dob.is==:code sto.code - elsif dob.is=='table' + elsif dob.is==:table sto.table - elsif dob.is=='break' + elsif dob.is==:break sto.break end if @md.flag_separate_endnotes dob.obj=dob.obj.gsub(/"\s+href="#_(\d+)">/,%{" href=\"endnotes#{Sfx[:html]}#_\\1">}) #endnote- twice #removed file type end if dob.obj !~/#{@vz.margin_txt_w1}|#{@vz.margin_txt_w2}/ - if dob.is =~/heading|para/ and (not dob.ocn or dob.ocn.to_s.empty?) + if (dob.is==:heading \ + || dob.is==:heading_insert \ + || dob.is==:para) \ + && (not dob.ocn \ + || (dob.ocn.to_s.empty?)) format_seg=SiSU_HTML_Format::FormatSeg.new(@md,dob) end dob.obj=dob.obj.gsub(/\s*(-\{{2}~\d+|<:e[:_]\d+>).*/,'') #potentially dagerous - removes all paragraphs with <!e_!> #?? workpoint @@ -433,9 +454,9 @@ module SiSU_HTML_Seg dob=format_seg.no_paranum end end - if (dob.is=='heading' \ - || dob.is=='heading_insert') \ - and dob.ln==4 + if (dob.is==:heading \ + || dob.is==:heading_insert) \ + && dob.ln==4 @@seg[:main] << %{\n<div class="content">\n} @@seg[:main] << dob_html @@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc @@ -473,16 +494,18 @@ module SiSU_HTML_Seg data.each do |dob| dob.obj=dob.obj.gsub(/<a name=\"h\d.*?\">(.+?)<\/a>/mi,'\1') if @md.flag_auto_endnotes - if (dob.is=='heading' or dob.is=='heading_insert') \ - and dob.ln.to_s =~/^[1234]/ \ + if (dob.is==:heading \ + || dob.is==:heading_insert) \ + && (dob.ln.to_s =~/^[1234]/) \ and not @@fn.to_s.empty? @@seg_endnotes[@@fn]=[] @@seg_endnotes[@@fn] << @@seg_endnotes_array @@seg_endnotes_array=[] if dob.ln==4 @@fns_previous=@md.fns if dob.ln==4 and dob.name =~/^meta/ end - if (dob.is=='heading' or dob.is=='heading_insert') \ - and dob.ln==4 #% EXTRACTION OF SUB-TOCs & SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs + if (dob.is==:heading \ + || dob.is==:heading_insert) \ + && dob.ln==4 #% EXTRACTION OF SUB-TOCs & SEGMENT NAME, after EXTRACTION OF ENDNOTES & SUB-TOCs @@seg_subtoc[@@fn]=@@seg_subtoc_array @@seg_subtoc_array=[] if dob.name \ @@ -496,8 +519,8 @@ module SiSU_HTML_Seg end end end - if dob.is=='heading' \ - and dob.ln.to_s =~/^[56]/ + if dob.is==:heading \ + && (dob.ln.to_s =~/^[56]/) case dob.ln when 5 txt_obj={ txt: dob.obj.strip, ocn: dob.ocn } @@ -511,8 +534,8 @@ module SiSU_HTML_Seg @@seg_subtoc_array << subtoc end if @md.flag_auto_endnotes - if dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ <a name="_[\d*+]+"/ \ - and dob.is !~/^code/ # endnote- + if (dob.obj =~/(?:#{Mx[:en_a_o]}|#{Mx[:en_b_o]})[\d*+]+ <a name="_[\d*+]+"/) \ + && dob.is !=:code # endnote- endnote_array=[] if dob.obj=~/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m endnote_array << dob.obj.scan(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}/m) diff --git a/lib/sisu/v3dv/html_tune.rb b/lib/sisu/v3dv/html_tune.rb index fab17b78..e4ac08ee 100644 --- a/lib/sisu/v3dv/html_tune.rb +++ b/lib/sisu/v3dv/html_tune.rb @@ -283,7 +283,7 @@ module SiSU_HTML_Tune @words=@words.join(' ') end def url_markup(dob) - unless dob.is=='code' + unless dob.is==:code if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/ @word_mode=dob.obj.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)[()\[\]]*[,.;:!?'"]{0,2}|(?:#{Mx[:gl_o]}\S+?#{Mx[:gl_c]})+|[^#{Mx[:lnk_o]}#{Mx[:lnk_c]}]+/mu) words=urls(@word_mode) @@ -325,7 +325,7 @@ module SiSU_HTML_Tune dob end def endnotes_html(dob) - unless dob.is =~/^code/ + unless dob.is ==:code dob.obj=dob.obj.gsub(/(#{Mx[:en_a_o]}|#{Mx[:en_b_o]})(\d+)\s+(.+?)(#{Mx[:en_a_c]}|#{Mx[:en_b_c]})/, ' <a name="-\2" href="#_\2"> <sup>\2</sup> </a> ' + #note- endnote- '\1\2 <a name="_\2" href="#-\2"> <sup>\2.</sup></a> \3 \4'). #endnote- note- (careful may have switched) @@ -341,7 +341,7 @@ module SiSU_HTML_Tune def markup(dob) dob.obj=dob.obj.gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;'). gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;') - dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is=='table' + dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is==:table dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>'). gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>'). gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>'). diff --git a/lib/sisu/v3dv/hub.rb b/lib/sisu/v3dv/hub.rb index c2477267..4924297a 100644 --- a/lib/sisu/v3dv/hub.rb +++ b/lib/sisu/v3dv/hub.rb @@ -364,8 +364,8 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ @cX=SiSU_Screen::Ansi.new(@opt.cmd).cX flag=SiSU_Env::InfoProcessingFlag.new if @opt.cmd =~/[vVM]/ #% version information - if @opt.cmd =~/V/ \ - and @opt.files.empty? #% environment + if (@opt.cmd =~/V/) \ + && (@opt.files.empty?) #% environment SiSU_Help::Help.new('env',@opt).environment else SiSU_Help::Help.new('env',@opt).sisu_version end diff --git a/lib/sisu/v3dv/manpage.rb b/lib/sisu/v3dv/manpage.rb index 94416eb2..0571a0e6 100644 --- a/lib/sisu/v3dv/manpage.rb +++ b/lib/sisu/v3dv/manpage.rb @@ -176,7 +176,7 @@ GSUB .TP Other versions of this document: .TP -manifest: <#{vz.url_root_http}/#{@md.fnb}/#{@md.fn[:manifest]}> + manifest: <#{@md.file.output_path.digest.url}/#{@md.file.base_filename.digest}> .TP at: <#{vz.url_site}> .TP @@ -192,16 +192,16 @@ at: <#{vz.url_site}> WOK end def manpage_structure(dob='',hname='') #% Used to extract the structure of a document - if dob.is=='heading' + if dob.is==:heading lv=dob.ln n=dob.ln - 1 n3=dob.ln + 2 else lv=nil end - wrapped=if dob.is=='para' \ - or dob.is=='heading' + wrapped=if dob.is==:para \ + || dob.is==:heading paragraph=dob.obj - if dob.is=='para' + if dob.is==:para if dob.indent =~/[1-9]/ \ and dob.indent == dob.hang util=if dob.bullet_ @@ -259,8 +259,8 @@ WOK fix=[] manpage_metadata data.each do |dob| - if dob.is=='comment' \ - or dob.is=='heading_insert' + if dob.is==:comment \ + || dob.is==:heading_insert dob.obj='' end dob.obj=dob.obj.gsub(/.+?<-#>/,''). # remove dummy headings (used by html) #check @@ -275,7 +275,7 @@ WOK gsub(/\A\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}([,.:!?](?: |$))?#{Mx[:br_line]}/m,"#{Mx[:br_line]}.BI \\1\\2#{Mx[:br_line]}"). gsub(/\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}([,.:!?](?: |$))?/,"#{Mx[:br_line]}.B \\1\\2#{Mx[:br_line]}"). gsub(/\s*#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}([,.:!?](?: |$))?/,"#{Mx[:br_line]}.I \\1\\2#{Mx[:br_line]}") - unless dob.is=='code' + unless dob.is==:code dob.obj=dob.obj.gsub(/(?:^|\s)#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}([,.:!?](?: |$))?/,"\\1 #{@brace_url.txt_open}\\2#{@brace_url.txt_close}\\3"). gsub(/(^|#{Mx[:gl_c]}|\s)#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}([,.:!?](?: |$))?/,"\\1#{@brace_url.txt_open}\\2#{@brace_url.txt_close}\\3") @manpage[:endnotes]=extract_endnotes(dob.obj) @@ -305,7 +305,7 @@ WOK gsub(/-/,'\-') #manpages use this dob.obj=dob.obj.gsub(/~/,'~') if dob.obj #manpages use this if dob.is =~/block|group|verse|alt|code/ - if dob.is =='code' + if dob.is ==:code dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _< gsub(/(^|[^}])_([<>])/m,'\1\2'). # _<_< gsub(/\A(.+)?\Z/m,".nf\n\n\\1\n\n.fi") @@ -340,7 +340,7 @@ WOK @p_num=SiSU_ManpageFormat::ParagraphNumber.new(paranum) end x=SiSU_ManpageFormat::FormatTextObject.new(@md,dob) - if dob.is=='heading' + if dob.is==:heading manpage_structure(dob) dob.obj=case dob.ln when 1; x.heading_body1 @@ -350,7 +350,7 @@ WOK when 5; x.heading_body5 when 6; x.heading_body6 end - elsif dob.is=='para' + elsif dob.is==:para manpage_structure(dob) else if dob.obj =~/#{table_message}/ @@ -367,7 +367,7 @@ WOK gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~'). gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'{'). gsub(/#{Mx[:pa_o]}\S+#{Mx[:pa_c]}/,' ') - unless dob.is =='code' + unless dob.is ==:code dob.obj=dob.obj.gsub(/<!.+!>/,' '). gsub(/<:\S+>/,' ') end diff --git a/lib/sisu/v3dv/odf.rb b/lib/sisu/v3dv/odf.rb index d58da74e..68aa6e40 100644 --- a/lib/sisu/v3dv/odf.rb +++ b/lib/sisu/v3dv/odf.rb @@ -154,8 +154,8 @@ module SiSU_ODF else '' end url=@md.fnb - fn=@md.fn[:manifest] - manifest="#{@env.url.root}/#{@md.fnb}/#{@md.fn[:manifest]}" + fn=@md.file.base_filename.manifest + manifest="#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}" @@odf[:tail] << %{<text:p text:style-name="P_normal">Available document outputs: <br /> <<text:a xlink:type="simple" xlink:href="#{manifest}">#{manifest}</text:a>></text:p>} @@odf[:tail] << %{\n<text:p text:style-name="P_normal">SiSU: <<text:a xlink:type="simple" xlink:href="http://www.jus.uio.no/lm">www.jus.uio.no/sisu</text:a>> and <<text:a xlink:type="simple" xlink:href="http://www.sisudoc.org">www.sisudoc.org</text:a>></text:p>} @@odf[:tail] << "\n</office:text></office:body></office:document-content>" @@ -305,11 +305,11 @@ module SiSU_ODF %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}). gsub(/#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/, %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="\\1">\\1</text:a>#{@brace_url.xml_close}}) #http ftp matches with decoration - dob.obj= if dob.is=='para' \ + dob.obj= if dob.is==:para \ and dob.indent.to_s =~/[0-9]/ \ and dob.indent == dob.hang %{<text:p text:style-name="P_indent_#{dob.indent}">#{dob.obj}#{p_num}</text:p>} - elsif dob.is=='para' \ + elsif dob.is==:para \ and dob.hang.to_s =~/[0-9]/ \ and dob.indent != dob.hang %{<text:p text:style-name="P_h#{dob.hang}_i#{dob.indent}">#{dob.obj}#{p_num}</text:p>} @@ -432,7 +432,7 @@ module SiSU_ODF dob end def code(dob,p_num) #P5 - if dob.is=='code' + if dob.is==:code dob.obj=dob.obj.gsub(/\s\s/,'  ') parray=[] dob.obj.split(/#{Mx[:br_line]}|#{Mx[:br_nl]}/).each do |parablock| @@ -449,14 +449,14 @@ module SiSU_ODF dob end def table(dob,p_num) # - if dob.is =='table' + if dob.is ==:table table=SiSU_ODF_Format::Table.new(@md,dob,p_num) dob=table.table end dob end def obj_break(dob) - if dob.is =='break' + if dob.is ==:break br=SiSU_ODF_Format::FormatObjBreak.new(@md,dob) if dob.obj==Mx[:br_page] \ or dob.obj==Mx[:br_page_new] @@ -469,7 +469,7 @@ module SiSU_ODF end def odf_structure(md,dob) @md,@dob=md,dob - dob=if dob.is !='code' + dob=if dob.is !=:code dob=image(dob) if dob.obj =~/#{Mx[:lnk_o]}[ ]*\S+?\.(?:png|jpg|gif)\s.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/ dob=text_link(dob) if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:url_o]}\S+?#{Mx[:url_c]}/ dob=text_link_relative(dob) if dob.obj =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/ @@ -486,19 +486,19 @@ module SiSU_ODF end end dob=footnote(dob) - if dob.is=='heading' + if dob.is==:heading @@odf[:body] << heading(dob,p_num).obj << @br*2 - elsif dob.is =='verse' + elsif dob.is ==:verse @@odf[:body] << poem(dob,p_num).obj << @br*2 - elsif dob.is=='group' + elsif dob.is==:group @@odf[:body] << group(dob,p_num).obj << @br*2 - elsif dob.is=='block' + elsif dob.is==:block @@odf[:body] << block(dob,p_num).obj << @br*2 - elsif dob.is=='code' + elsif dob.is==:code @@odf[:body] << code(dob,p_num).obj << @br*2 - elsif dob.is=='table' #elsif dob.obj =~ /<!Th?¡/u + elsif dob.is==:table #elsif dob.obj =~ /<!Th?¡/u @@odf[:body] << table(dob,p_num).obj << @br*2 - elsif dob.is=='break' + elsif dob.is==:break @@odf[:body] << obj_break(dob).obj << @br*2 else @@odf[:body] << normal(dob,p_num).obj << @br*2 # main text, contents, body KEEP @@ -546,11 +546,11 @@ module SiSU_ODF dob.obj=para_array.join(' ') dob.obj=dob.obj.strip end - if dob.is=='code' #{Mx[:gr_o]}code#{Mx[:gr_c]}/ #fix #code-block: angle brackets special characters #fix + if dob.is==:code #{Mx[:gr_o]}code#{Mx[:gr_c]}/ #fix #code-block: angle brackets special characters #fix dob.obj=dob.obj.gsub(/(^|[^}])_(?:<|<)/m,'\1<').gsub(/(^|[^}])_(?:>|>)/m,'\1>'). gsub(/(^|[^}])_(?:<|<)/m,'\1<').gsub(/(^|[^}])_(?:>|>)/m,'\1>') end - if dob.of=='block' + if dob.of==:block dob.obj=dob.obj.gsub(/#{Mx[:gl_bullet]}/,'● ') end dob.obj=dob.obj.gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>'). @@ -560,7 +560,7 @@ module SiSU_ODF gsub(/#{Mx[:mk_o]}#([a-zA-Z]+)#{Mx[:mk_c]}/,'&\1;'). gsub(/#{Mx[:mk_o]}(#[0-9]+)#{Mx[:mk_c]}/,'&\1;'). gsub(/#{Mx[:mk_o]}[~-]##{Mx[:mk_c]}/,'') - if dob.is=='para' \ + if dob.is==:para \ and dob.bullet_ dob.obj='<draw:frame draw:style-name="gr1" text:anchor-type="as-char" svg:width="0.22cm" svg:height="0.22cm" draw:z-index="2"><draw:image xlink:href="Pictures/bullet_09.png" xlink:type="simple" xlink:show="embed" xlink:actuate="onLoad"/></draw:frame> ' + dob.obj @@ -595,11 +595,17 @@ module SiSU_ODF dob.obj=tidywords(wordlist).join(' ').strip @rcdc=true if @rcdc==false \ and (dob.obj =~/~metadata/ or dob =~/#{Mx[:lv_o]}1:meta#{Mx[:lv_x]}\s*Document Information/) #fix Mx[:lv_o] - if dob.is !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ + if dob.is !~/(^#{Rx[:meta]}|#{Mx[:br_eof]}|#{Mx[:br_endnotes]})/ #check if defined? dob.ocn and dob.ocn =~/\d+/ @p_num=SiSU_ODF_Format::ParagraphNumber.new(dob.ocn) end - if dob.is=~/heading|para|group|verse|code|table|break/ # extend, include other types + if dob.is ==:heading \ + || dob.is ==:para \ + || dob.is ==:group \ + || dob.is ==:verse \ + || dob.is ==:code \ + || dob.is ==:table \ + || dob.is ==:break odf_structure(@md,dob) end if dob.obj ## Clean Prepared Text @@ -720,7 +726,7 @@ WOK od.puts para unless para =~/\A\s*\Z/ end od.close - opendoc=@md.fn[:odf] + opendoc=@md.file.base_filename.odt #watch where output by language FileUtils::mkdir_p(@md.file.output_path.odt.dir) unless FileTest.directory?(@md.file.output_path.odt.dir) if FileTest.directory?(@env.processing_path.odt) pwd=Dir.pwd diff --git a/lib/sisu/v3dv/plaintext.rb b/lib/sisu/v3dv/plaintext.rb index ba1cc48a..557c5f1b 100644 --- a/lib/sisu/v3dv/plaintext.rb +++ b/lib/sisu/v3dv/plaintext.rb @@ -200,12 +200,12 @@ WOK @plaintext[:tail] <<<<WOK #{@br} plaintext (plain text): - #{base_url}/#{@md.fn[:plain]}#{@br} + #{@md.file.output_path.txt.url}/#{@md.file.base_filename.txt}#{@br} Other versions of this document: #{@br} manifest: - #{base_url}/#{@md.fn[:manifest]}#{@br} + #{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}#{@br} at: - #{@env.url.root}#{@br} + #{@md.file.output_path.base.url}#{@br} #{sc} * #{generator} @@ -216,15 +216,15 @@ WOK end def plaintext_structure(dob='',p_num='') #% Used to extract the structure of a document lv=n=n3=nil - if dob.is=='heading' + if dob.is==:heading lv=dob.ln n=lv - 1 n3=lv + 2 end util=nil - wrapped=if dob.is =='para' \ - or dob.is=='heading' - if dob.is=='para' + wrapped=if dob.is ==:para \ + or dob.is==:heading + if dob.is==:para if dob.hang \ and dob.hang =~/[0-9]/ \ and dob.indent != dob.hang @@ -299,7 +299,7 @@ WOK "#{Px[:strike_o]}\\1#{Px[:strike_c]}"). gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/, "#{Px[:monospace_o]}\\1#{Px[:monospace_c]}") - unless dob.is=='code' + unless dob.is==:code dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1'). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]'). @@ -323,12 +323,12 @@ WOK gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©'). gsub(/#{Mx[:gl_o]}#092#{Mx[:gl_c]}/,'\\') end - dob.obj=if dob.of=='block' # watch + dob.obj=if dob.of==:block # watch dob.obj.gsub(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/,"* "). gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n") else dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n\n") end - if dob.is=='code' + if dob.is==:code dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _< gsub(/(^|[^}])_([<>])/m,'\1\2') # _<_< end @@ -352,16 +352,16 @@ WOK p_num=SiSU_PlaintextFormat::ParagraphNumber.new(dob.ocn).display end end - if dob.is=='heading' \ - or dob.is=='para' + if dob.is==:heading \ + or dob.is==:para plaintext_structure(dob,p_num) - elsif dob.is=='group' \ - or dob.is=='block' \ - or dob.is=='verse' \ - or dob.is=='code' \ - or dob.is=='table' + elsif dob.is==:group \ + or dob.is==:block \ + or dob.is==:verse \ + or dob.is==:code \ + or dob.is==:table @plaintext[:body] << dob.obj + p_num << @br - elsif dob.is=='break' + elsif dob.is==:break sp=' ' ln='-' @plaintext[:body] <<=if dob.obj==Mx[:br_page] \ diff --git a/lib/sisu/v3dv/po4a.rb b/lib/sisu/v3dv/po4a.rb index 945b07b8..adb977c2 100644 --- a/lib/sisu/v3dv/po4a.rb +++ b/lib/sisu/v3dv/po4a.rb @@ -509,7 +509,7 @@ GSUB util=nil fn=(dob_src.name=~/[a-z\d]/i) ? dob_src.name : '' mark="#{dob_src.lv}~#{fn} " - d="#{dob_src.is} (level #{dob_src.lv})" + d="#{dob_src.is.to_s} (level #{dob_src.lv})" instruct=s_mark='' if @md.opt.cmd=~/M/ instruct=%{\n# markup for headings is marker at the start of the line/object, indicating the heading level, and if provided an associated name tag, this heading is "#{mark}"} @@ -538,7 +538,7 @@ GSUB s_mark=desc=orig=trans='' if dob_src.bullet_ mark="_#{dob_src.indent}* " - d="#{dob_src.is}: indent #{dob_src.indent}, bullet" + d="#{dob_src.is.to_s}: indent #{dob_src.indent}, bullet" instruct=s_mark='' if @md.opt.cmd=~/M/ instruct=%{\n# markup for indented bullet text is at the start of the line/object, an underscore followed by the indent level and an asterisk "#{mark}"} @@ -547,7 +547,7 @@ GSUB desc="#{d}#{s_mark}#{instruct}" else mark="_#{dob_src.indent} " - d="#{dob_src.is}: indent #{dob_src.indent}" + d="#{dob_src.is.to_s}: indent #{dob_src.indent}" instruct=s_mark='' if @md.opt.cmd=~/M/ instruct=%{\n# markup for indented text is at the start of the line/object, an underscore followed by the indent level "#{mark}"} @@ -562,7 +562,7 @@ GSUB and dob_src.indent != dob_src.hang s_mark=desc=orig=trans='' mark="_#{dob_src.hang}_#{dob_src.indent} " - d="#{dob_src.is}: hang #{dob_src.hang} indent #{dob_src.indent}" + d="#{dob_src.is.to_s}: hang #{dob_src.hang} indent #{dob_src.indent}" instruct=s_mark='' if @md.opt.cmd=~/M/ instruct=%{\n# markup for indented text with a first line indented to a different level from the rest of the paragraph, is at the start of the line/object, an underscore and the first indent level a second underscore and the indent level for the rest of the paragraph, "#{mark1}"} @@ -576,7 +576,7 @@ GSUB s_mark=desc=orig=trans='' if dob_src.bullet_ mark='_* ' - d="#{dob_src.is}: bullet" + d="#{dob_src.is.to_s}: bullet" instruct=s_mark='' if @md.opt.cmd=~/M/ instruct=%{\n# markup for indented text is at the start of the line/object, an underscore followed by an asterisk "#{mark}"} @@ -587,7 +587,7 @@ GSUB trans=(dob_trn=='') ? '' : "#{s_mark}#{dob_trn.obj}" else mark='' - d=dob_src.is + d=dob_src.is.to_s instruct=%{\n# regular paragraph, no special markup} if @md.opt.cmd=~/M/ instruct="\n# " @@ -613,7 +613,7 @@ GSUB end def pot_structure_block(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document mark="block{\\n\\n...\\n\\n}block" - d=dob_src.is + d=dob_src.is.to_s instruct=s_mark='' if @md.opt.cmd=~/M/ instruct="\n# block text is a text block with an opening and closing marker, the content of which may be wrapped" @@ -628,7 +628,7 @@ GSUB end def pot_structure_group(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document mark="group{\\n\\n...\\n\\n}group" - d=dob_src.is + d=dob_src.is.to_s instruct=s_mark='' if @md.opt.cmd=~/M/ instruct="\n# group text is a text block with an opening and closing marker, the content of which may be wrapped" @@ -643,7 +643,7 @@ GSUB end def pot_structure_verse(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document mark="poem{\n\nverse\n\nverse\n\n...\n\n}poem" - d=dob_src.is + d=dob_src.is.to_s instruct=s_mark='' if @md.opt.cmd=~/M/ instruct="\n# verse are part of the text block described as a poem, the first verse is preceeded by an opening marker, and the last verse by a closing marker, the content of which should remain unwrapped" @@ -658,7 +658,7 @@ GSUB end def pot_structure_code(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document mark="code{\\n\\n...\\n\\n}code" - d=dob_src.is + d=dob_src.is.to_s instruct=s_mark='' if @md.opt.cmd=~/M/ instruct="\n# codeblocks are a text block with an opening and closing marker, the content of which should remain unwrapped" @@ -673,7 +673,7 @@ GSUB end def pot_structure_table(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document mark="table{\\n\\n...\\n\\n}table" - d=dob_src.is + d=dob_src.is.to_s instruct=s_mark='' if @md.opt.cmd=~/M/ instruct="\n# tables are a text block with an opening and closing marker, the content of which should remain unwrapped" @@ -729,22 +729,22 @@ GSUB and data_trn[t] break end - if data_src[s].of == 'comment' \ - and data_trn[t].of == 'comment' \ + if data_src[s].of == :comment \ + and data_trn[t].of == :comment \ and (data_src[s].is == data_trn[t].is) s+=1;t+=1 next end - if (data_src[s].is == 'comment' or data_trn[t].is == 'comment') \ + if (data_src[s].is == :comment or data_trn[t].is == :comment) \ and (data_src[s].is != data_trn[t].is) - if data_src[s].is == 'comment' + if data_src[s].is == :comment puts "src (comment):\n\t" + data_src[s].obj if @md.opt.cmd =~/M/ s+=1 - #next if data_src[s].is == 'comment' - elsif data_trn[t].is == 'comment' + #next if data_src[s].is == :comment + elsif data_trn[t].is == :comment puts "trans (comment):\n\t" + data_trn[t].obj if @md.opt.cmd =~/M/ t+=1 - #next if data_trn[t].is == 'comment' + #next if data_trn[t].is == :comment end end if (defined? data_src[s].ocn and data_src[s].ocn.class == Fixnum) \ @@ -814,13 +814,13 @@ GSUB @p_num=SiSU_Po4aUtils::ParagraphNumber.new(paranum) end case dob_src.is - when 'heading'; pot_structure_heading(dob_src,notes_s,dob_trn,notes_t) - when 'para'; pot_structure_para(dob_src,notes_s,dob_trn,notes_t) - when 'group'; pot_structure_group(dob_src,notes_s,dob_trn,notes_t) - when 'block'; pot_structure_block(dob_src,notes_s,dob_trn,notes_t) - when 'verse'; pot_structure_verse(dob_src,notes_s,dob_trn,notes_t) - when 'code'; pot_structure_code(dob_src,notes_s,dob_trn,notes_t) - when 'table'; pot_structure_table(dob_src,notes_s,dob_trn,notes_t) + when :heading; pot_structure_heading(dob_src,notes_s,dob_trn,notes_t) + when :para; pot_structure_para(dob_src,notes_s,dob_trn,notes_t) + when :group; pot_structure_group(dob_src,notes_s,dob_trn,notes_t) + when :block; pot_structure_block(dob_src,notes_s,dob_trn,notes_t) + when :verse; pot_structure_verse(dob_src,notes_s,dob_trn,notes_t) + when :code; pot_structure_code(dob_src,notes_s,dob_trn,notes_t) + when :table; pot_structure_table(dob_src,notes_s,dob_trn,notes_t) end if defined? dob_src.idx \ and not dob_src.idx.nil? \ @@ -858,7 +858,7 @@ GSUB gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/, "#{Px[:po_monospace_o]}\\1#{Px[:po_monospace_c]}") notes='' - unless dob.is=='code' + unless dob.is==:code dob.obj=dob.obj.gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/,'\1'). gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/,'\1'). gsub(/#{Mx[:lnk_o]}(.+?)#{Mx[:lnk_c]}#{Mx[:url_o]}(\S+?)#{Mx[:url_c]}/,'\1 [link: <\2>]'). @@ -887,12 +887,12 @@ GSUB gsub(/#{Mx[:gl_o]}#126#{Mx[:gl_c]}/,'~'). gsub(/#{Mx[:gl_o]}#169#{Mx[:gl_c]}/,'©') end - dob.obj=if dob.of=='block' # watch + dob.obj=if dob.of==:block # watch dob.obj.gsub(/#{Mx[:gl_o]}●#{Mx[:gl_c]}/,"* "). gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n") else dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,"\n\n") end - if dob.is=='code' + if dob.is==:code dob.obj=dob.obj.gsub(/(^|[^}])_([<>])/m,'\1\2'). # _> _< gsub(/(^|[^}])_([<>])/m,'\1\2') # _<_< end diff --git a/lib/sisu/v3dv/shared_html_lite.rb b/lib/sisu/v3dv/shared_html_lite.rb index 94413c69..27a228eb 100644 --- a/lib/sisu/v3dv/shared_html_lite.rb +++ b/lib/sisu/v3dv/shared_html_lite.rb @@ -68,7 +68,7 @@ module SiSU_FormatShared @md,@t_o=md,t_o @txt=@t_o.obj @id=@ocn=@t_o.ocn if defined? @t_o.ocn - @lv=@t_o.lv.to_s if @t_o.is=='heading' + @lv=@t_o.lv.to_s if @t_o.is==:heading if @md.fns != @@fns @@fns,@@hname=@md.fns,'' end @@ -139,7 +139,7 @@ module SiSU_FormatShared @words=@words.join(' ') end def markup_generic(s) - s=s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>') + s=s.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>'). gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>'). gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>'). gsub(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"'). @@ -152,7 +152,7 @@ module SiSU_FormatShared end def markup_object(t_o) s=t_o.obj - s=if t_o.is !='code' + s=if t_o.is !=:code s=markup_generic(s) if s =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)/ wm=s.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}|image)|\S+/) diff --git a/lib/sisu/v3dv/shared_markup_alt.rb b/lib/sisu/v3dv/shared_markup_alt.rb index 9719dd3e..dabb765e 100644 --- a/lib/sisu/v3dv/shared_markup_alt.rb +++ b/lib/sisu/v3dv/shared_markup_alt.rb @@ -123,13 +123,14 @@ module SiSU_TextRepresentation gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~'). gsub(/#{Mx[:en_a_o]}([\d*+]+\s+.+?)#{Mx[:en_a_c]}/,'~{\1}~'). # endnote marker marked up gsub(/#{Mx[:en_b_o]}([\d*+]+\s+.+?)#{Mx[:en_b_c]}/,'~[\1]~') # endnote marker marked up - if @t_o.is=='heading' or @t_o.is=='para' + if @t_o.is==:heading \ + || @t_o.is==:para @s=@s.gsub(/ [ ]+/,' ') @s=@s.gsub(/(?:#{Mx[:nbsp]})+/,' ') - if @t_o.is=='heading' + if @t_o.is==:heading @s=@t_o.lv + '~ ' + @s end - if @t_o.is=='para' + if @t_o.is==:para if @t_o.bullet_ @s='_* ' + @s end @@ -139,11 +140,11 @@ module SiSU_TextRepresentation end end end - if @t_o.is=='block' \ - or @t_o.is=='group' \ - or @t_o.is=='code' + if @t_o.is==:block \ + || @t_o.is==:group \ + || @t_o.is==:code @s=@s.gsub(/#{Mx[:nbsp]}/,' ') - @s="#{@t_o.is}{\n\n#{@s}\n\n}#{@t_o.is}" + @s="#{@t_o.is.to_s}{\n\n#{@s}\n\n}#{@t_o.is.to_s}" @s=@s.gsub(/(?:#{Mx[:br_nl]}|\n)+/m,"\n\n") end #dealing with poem and verse calls for change in dal, where start and end verse of poem are marked as such @@ -162,7 +163,7 @@ module SiSU_TextRepresentation gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'<sup>\1</sup>'). gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'<sub>\1</sub>'). gsub(/#{Mx[:gl_o]}#(?:126|152)#{Mx[:gl_c]}/i,'~') - if @t_o.is !='code' + if @t_o.is !=:code if @s =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/ wm=@s.scan(/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)|\S+/) words=urls(wm) @@ -176,7 +177,7 @@ module SiSU_TextRepresentation else @s=@s.gsub(/</m,'<').gsub(/>/m,'>') end - if @t_o.is=='paragraph' + if @t_o.is==:paragraph if @t_o.bullet_ @s=@s end @@ -184,7 +185,7 @@ module SiSU_TextRepresentation @s=@s end end - if @t_o.is=='heading' + if @t_o.is==:heading @s=@s end else @@ -291,7 +292,9 @@ module SiSU_TextRepresentation en_dgst end def dgst - if @t_o.of !='comment' and @t_o.of !='structure' and @t_o.of !='layout' + if @t_o.of !=:comment \ + && @t_o.of !=:structure \ + && @t_o.of !=:layout en_dgst,img_dgst={},{} txt_stripped_dgst=digest(stripped_clean(@t_o)) txt_markup_reverted_dgst=digest(markup_reverted(@t_o)) @@ -300,7 +303,8 @@ module SiSU_TextRepresentation notes=@t_o.obj.scan(rgx_notes) endnotes_dgst=endnotes(notes) rgx_image=/#{Mx[:lnk_o]}(\S+\.(?:png|jpg|gif))\s.+?#{Mx[:lnk_c]}(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image)/ - imgs=if (@t_o.is=='para' or @t_o.is=='image') \ + imgs=if (@t_o.is==:para \ + || @t_o.is==:image) \ and @t_o.obj =~rgx_image imgs=@t_o.obj.scan(rgx_image).flatten line_image=images(imgs) diff --git a/lib/sisu/v3dv/shared_metadata.rb b/lib/sisu/v3dv/shared_metadata.rb index 56856116..14cc885a 100644 --- a/lib/sisu/v3dv/shared_metadata.rb +++ b/lib/sisu/v3dv/shared_metadata.rb @@ -1001,7 +1001,7 @@ WOK language=l[:n] tr=SiSU_Translate::Source.new(@md,language) tag="Document Manifest @" - inf="#{@br}#{base_html}/#{@md.fn[:manifest]}" + inf="#{@br}#{@md.file.output_path.manifest.url}/#{@md.file.base_filename.manifest}" meta << meta_para(tag,inf) if defined? @md.title.full \ and @md.title.full=~/\S+/ diff --git a/lib/sisu/v3dv/shared_xml.rb b/lib/sisu/v3dv/shared_xml.rb index dbaed6d8..6b85d756 100644 --- a/lib/sisu/v3dv/shared_xml.rb +++ b/lib/sisu/v3dv/shared_xml.rb @@ -343,7 +343,7 @@ module SiSU_XML_Munge def markup(dob='') wordlist=dob.obj.scan(/&[#0-9a-z]+;|\S+|\n/) #\n needed for tables, check though added 2005w17 dob.obj=tidywords(wordlist).join(' ').strip - unless dob.is=='table' + unless dob.is==:table dob.obj=dob.obj.gsub(/#{Mx[:br_line]}/u,'<br />'). gsub(/#{Mx[:br_paragraph]}/u,'<br />'). gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') @@ -364,13 +364,13 @@ module SiSU_XML_Munge gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'<tt>\1</tt>'). gsub(/<:pb>\s*/,''). #Fix gsub(/<+[-~]#>+/,'') - if dob.is !~/^code/ + if dob.is !=:code #embeds a red-bullet image --> dob.obj=dob.obj.gsub(/#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}/,'<b>\1</b>'). gsub(/#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/,'<i>\1</i>'). gsub(/#{Mx[:fa_underscore_o]}(.+?)#{Mx[:fa_underscore_c]}/,'<u>\1</u>'). gsub(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'<del>\1</del>') - dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is=='table' + dob.obj=dob.obj.gsub(/#{Mx[:br_line]}|#{Mx[:br_nl]}/,'<br />') unless dob.is==:table dob.obj=dob.obj.gsub(/#{Mx[:br_page]}\s*/,''). gsub(/#{Mx[:br_page_new]}\s*/,''). gsub(/#{Mx[:pa_non_object_no_heading]}|#{Mx[:pa_non_object_dummy_heading]}/,''). @@ -399,7 +399,7 @@ module SiSU_XML_Munge else dob.obj=dob.obj.gsub(/</m,'<').gsub(/>/m,'>') end - if dob.of=='block' + if dob.of==:block dob.obj=dob.obj.gsub(/#{Mx[:gl_bullet]}/,'● ') end dob.obj=dob.obj.gsub(/#{Mx[:url_o]}([a-zA-Z0-9._-]+\@\S+?\.[a-zA-Z0-9._-]+)#{Mx[:url_c]}/, diff --git a/lib/sisu/v3dv/texinfo.rb b/lib/sisu/v3dv/texinfo.rb index 121cf1ae..145712e1 100644 --- a/lib/sisu/v3dv/texinfo.rb +++ b/lib/sisu/v3dv/texinfo.rb @@ -137,19 +137,22 @@ module SiSU_TexInfo end def songsheet begin - @data=pre - @data=endnote - @data=markup - @data=tail - output + data=@data + data=pre(data) + data=endnote(data) + data=markup(data) + objects=tail(data) + #output(objects) + output(@tex_file) + #output(data.compact) makeinfo #KEEP reinstate when fixed #% place_info rescue; STDERR.puts SiSU_Screen::Ansi.new(@md.opt.cmd,$!,$@).rescue ensure end end - def pre - data=@data + def pre(data) + data_new=[] data.each do |dob| # DEBUG 2003w16 this is a kludge, because i could not get parameters # from param, Sort out ... revert to more elegant solution @@ -161,13 +164,15 @@ module SiSU_TexInfo gsub(/(^|#{Mx[:gl_c]}|\s)\{(.+?)\}((?:https?|file):\/\/\S+)/,'\1(\2 [linked to:] \3)') do_mono=SiSU_TexInfoFormat::Texinfo.new(@md,dob) dob.obj=do_mono.spec_char(dob.obj) + data_new << dob end - data + data_new end - def endnote - data,data_new=@data,[] + def endnote(data) + data_new=[] data.each do |dob| - if dob.of=~/para|block/ + if dob.of==:para \ + || dob.of==:block dob.obj=dob.obj.gsub(/\s*#{Mx[:en_a_o]}(?:\d+)\s+(.+?)#{Mx[:en_a_c]}/m,' @footnote{ \1} '). gsub(/\s*#{Mx[:en_a_o]}(\*+)\s+(.+?)#{Mx[:en_a_c]}/m,' @footnote{ \1} ') end @@ -176,24 +181,24 @@ module SiSU_TexInfo data_new end def poem - data=@data + data,data_new=@data,[] @tex_file=[] @@counting=0 data.each do |dob| - if dob.is =='code' + if dob.is ==:code @@flag['code']=true @@counting=1 end - if dob.is =='verse' + if dob.is ==:verse @@flag['poem']=1 end if @@flag['code'] if @@flag['code'] \ - and dob.obj =~ /#{Mx[:gr_o]}code[-_](?:end|close)#{Mx[:gr_c]}/ #watch change not tested 200501 #fix + && (dob.obj =~ /#{Mx[:gr_o]}code[-_](?:end|close)#{Mx[:gr_c]}/) #watch change not tested 200501 #fix @@flag['code']=false end if @@flag['code'] \ - and dob.obj =~ /\S/ + && (dob.obj =~ /\S/) sub_array=dob.obj.dup @@line_mode=sub_array.scan(/.+/) Tune.code_lines(@@line_mode) @@ -201,11 +206,11 @@ module SiSU_TexInfo end elsif @@flag['poem']==1 if @@flag['poem']==1 \ - and dob.obj =~ /#{Mx[:gr_o]}verse[-_](?:end|close)#{Mx[:gr_c]}/ #watch change not tested 200501 #fix + && (dob.obj =~ /#{Mx[:gr_o]}verse[-_](?:end|close)#{Mx[:gr_c]}/) #watch change not tested 200501 #fix @@flag['poem']=0 end if @@flag['poem']==1 \ - and dob.obj =~ /\S/ + && (dob.obj =~ /\S/) sub_array=dob.obj.dup @@line_mode=sub_array.scan(/.+/) Tune.code_lines(@@line_mode) @@ -213,13 +218,15 @@ module SiSU_TexInfo end end @tex_file << dob.obj + data_new << dob end + data_new end def code_lines data,data_new=@data,[] data.each do |line| - if line =~ /\S/ \ - and line !~ /#{Mx[:gr_o]}(code|verse).+/ #fix + if (line =~ /\S/) \ + && (line !~ /#{Mx[:gr_o]}(code|verse).+/) #fix line=if @@flag['code'] line.gsub(/^\s*(.+)/m,"\\noindent \\marginpar\[left-text\]{\\begin{tiny}#{@@counting}\\end{tiny}}\\1\\") @@counting+=1 if @@flag['code'] @@ -230,7 +237,7 @@ module SiSU_TexInfo end end def tables - data=@data + data,data_new=@data,[] @tex_file=[] @@tableheader=0 data.each do |dob| @@ -239,10 +246,12 @@ module SiSU_TexInfo dob.obj=do_mono.longtable # using longtable latex package end @tex_file << dob.obj + data_new << dob end + data_new end - def markup - data=@data + def markup(data) + data_new=[] @tex_file=[] @row_break='\\\\\\' @break_page="#{@row_break}\n#{@row_break} \n" @@ -254,12 +263,12 @@ module SiSU_TexInfo n_menu,n_submenu=0,0 @submenu,@subsubmenu={},{} data.each do |dob| - if dob.is =='heading' \ - and dob.ln.to_s =~ /^[1-3]$/ + if dob.is ==:heading \ + && (dob.ln.to_s =~ /^[1-3]$/) toc=SiSU_TexInfoFormat::Texinfo.new(@md,dob) texinfo_menu << toc.menu - elsif dob.is =='heading' \ - and dob.ln.to_s =~ /^[4-6]$/ + elsif dob.is ==:heading \ + && (dob.ln.to_s =~ /^[4-6]$/) toc=SiSU_TexInfoFormat::Texinfo.new(@md,dob) texinfo_menu << toc.menu case dob.ln @@ -278,7 +287,9 @@ module SiSU_TexInfo else dob.obj=dob.obj.gsub(/\s*(?:<:?br>|<br \/>)\s*/,"\n\n") end + data_new << dob end + data=data_new texinfo_menu=texinfo_menu.compact texinfo_menu << "* Dublin Core::" @tex_file << texinfo_menu @@ -287,15 +298,16 @@ module SiSU_TexInfo "@c %% 5\n\n" n_menu,n_submenu=0,0 @@do_submenu,@@do_subsubmenu=1,1 + data_new=[] data.each do |dob| mono=SiSU_TexInfoFormat::Texinfo.new(@md,dob) - if dob.is=='heading' + if dob.is==:heading case dob.ln - when 1; mono.level1 - when 2; mono.level2 - when 3; mono.level3 + when 1; dob=mono.level1 + when 2; dob=mono.level2 + when 3; dob=mono.level3 when 4; - mono.level4 + dob=mono.level4 n_menu+=1 @@do_submenu,@@do_subsubmenu=1,1 when 5; @@ -305,7 +317,7 @@ module SiSU_TexInfo menu=SiSU_TexInfoFormat::TeXinfoTxt.new(@md,dob,@submenu[n_menu]) dob.obj="#{menu.submenu}#{mono.level5.obj}" @@do_submenu=0 - else mono.level5 + else dob=mono.level5 end when 6; if @@do_submenu==1 @@ -313,37 +325,42 @@ module SiSU_TexInfo dob.obj="#{menu.subsubmenu}#{mono.level6.obj}" @@do_subsubmenu=0 else - mono.level6 + dob=mono.level6 end end else if dob.obj !~/\S/ dob.obj=nil else - if dob.is=='para' \ - and dob.obj !~/##{dob.ocn}/ + if dob.is==:para \ + && (dob.obj !~/##{dob.ocn}/) dob.obj="#{dob.obj} ##{dob.ocn}" end end end #%case with endnotes dob.obj=dob.obj.gsub(/\s*[0-8]\\+(\S+)?\s+/,' ') if dob.obj - @tex_file << dob.obj if dob.obj and dob.is !~/structure|comment/ #sort exceptions + if dob.obj \ + && (dob.is !=:structure \ + && dob.is !=:comment) + @tex_file << dob.obj + end + data_new << dob end - data=@tex_file + data_new end def number_titles - data=@data + data,data_new=@data,[] @tex_file=[] input=%{#{@md.markup}}[/(num_top\s*=\s*(\d?))?/m,2] # else default usually 4 # this was a bit of a trick required to pass nil to input if nothing matched... #puts input num_top=input.to_i t_no1=0; t_no2=0; t_no3=0; t_no4=0; no1=num_top; no2=(num_top + 1); no3=(num_top + 2); no4=(num_top + 3); data.each do |dob| - if @md.markup =~ /num_top/i \ - and dob.obj !~ /#{Rx[:meta]}/ - if dob.obj =~ /^[1-6]\\+(?:~\S+)?\s*<!h-.+?-!>/ \ - and dob.obj !~ /<:\d-endnotes>/ + if (@md.markup =~ /num_top/i) \ + && (dob.obj !~ /#{Rx[:meta]}/) + if (dob.obj =~ /^[1-6]\\+(?:~\S+)?\s*<!h-.+?-!>/) \ + && (dob.obj !~ /<:\d-endnotes>/) header=dob.obj[/<!h-(.+?)-!>/m, 1].gsub(/-/m,'.') dob.obj=dob.obj.gsub(/^(?:[1-6]\\+(?:~\S+)|<:([12356]|4-.+?-)>)\s*<!h-.+?-!>/, "\\1 #{header} ") @@ -355,16 +372,18 @@ module SiSU_TexInfo end @tex_file << dob.obj end - data=@tex_file + data_new << dob end - def tail - data=@data + def tail(data) tex=SiSU_TexInfoFormat::Texinfo.new(@md) - data << tex.dublincore - data << tex.tail + objects=[] + data.each do |dob| + objects << dob.obj if dob.obj + end + objects << tex.dublincore << tex.tail + objects end - def output - data=@data.compact + def output(data) filename_texinfo=%{#{@env.processing_path.texi}/#{@md.fnb}.texinfo} file_texinfo=File.new(filename_texinfo,'w+') puts filename_texinfo if @md.opt.cmd =~/M/ diff --git a/lib/sisu/v3dv/texinfo_format.rb b/lib/sisu/v3dv/texinfo_format.rb index 30d40e20..0555809d 100644 --- a/lib/sisu/v3dv/texinfo_format.rb +++ b/lib/sisu/v3dv/texinfo_format.rb @@ -98,7 +98,6 @@ module SiSU_TexInfoFormat v=SiSU_Env::InfoVersion.instance.get_version head =<<WOK \\input texinfo @c -*-texinfo-*- -@comment $Id$ @comment %**start of header @setfilename #{@md.fnb}.info @settitle #{title} @value{VERSION} @@ -294,7 +293,7 @@ WOK "@bye" end def clean(dob) - if dob.is=='heading' \ + if dob.is==:heading \ and dob.obj !~/##{dob.ocn}/ dob.obj="#{dob.obj} ##{dob.ocn}" end @@ -557,7 +556,7 @@ WOK @md,@dob,@txt=md,dob,txt end def clean(dob,txt) - if dob.is=='heading' \ + if dob.is==:heading \ and txt !~/##{dob.ocn}/ txt="#{dob.obj} ##{dob.ocn}" end diff --git a/lib/sisu/v3dv/texpdf.rb b/lib/sisu/v3dv/texpdf.rb index f8010511..c69f7b9c 100644 --- a/lib/sisu/v3dv/texpdf.rb +++ b/lib/sisu/v3dv/texpdf.rb @@ -345,26 +345,26 @@ module SiSU_TeX # from param, Sort out ... revert to more elegant solution # even more of a kludge as had to insert newlines where code is used not satisfactory, think about dob.tmp=dob.obj #.dup - if dob.is=='para' \ - or dob.is=='heading' + if dob.is==:para \ + || dob.is==:heading dob.tmp=dob.tmp.gsub(/#{Mx[:mk_o]}:name#\S+?#{Mx[:mk_c]}/,'') dob.tmp=SiSU_TeX_Pdf::SpecialCharacters.new(@md,dob.tmp).special_characters if dob.tmp =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}#{Mx[:rel_o]}\S+?#{Mx[:rel_c]}/ dob.tmp=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob.tmp).url_str_internal(dob.tmp) end - elsif dob.is =='code' + elsif dob.is ==:code dob.tmp=if @codeblock_box=='listings' dob.tmp else SiSU_TeX_Pdf::SpecialCharacters.new(@md,dob.tmp).special_characters_code end - elsif dob.is =='break' + elsif dob.is ==:break if dob.obj==Mx[:br_page]; dob.tmp='\newpage' elsif dob.obj==Mx[:br_page_new]; dob.tmp='\clearpage' elsif dob.obj==Mx[:br_obj]; dob.tmp='\parasep' end - elsif dob.is=='comment' \ - or dob.is=='meta' + elsif dob.is==:comment \ + || dob.is==:meta dob.tmp='' #dob.tmp=nil end end @@ -403,7 +403,7 @@ module SiSU_TeX data.each do |dob| @tex_file << if dob.class==String \ or dob.class==Hash; dob - elsif dob.is=='table' + elsif dob.is==:table tables_hash(@md,dob) #Hash result else dob end @@ -463,16 +463,18 @@ module SiSU_TeX def markup_common(dob) tex_f=nil txt_obj={ dal: dob } - if dob.of=='block' - @lineone=case dob.is - when /block|group|alt|verse/ + if dob.of==:block + @lineone=if dob.is==:block \ + || dob.is==:group \ + || dob.is==:alt \ + || dob.is==:verse dob.tmp=dob.tmp.gsub(/#{Mx[:nbsp]}/m,'{~}'). gsub(/#{Mx[:gl_bullet]}/m,'$\txtbullet$\hspace{\enspace}'). #Bullet environment not used for grouped text, ∴ no hanging indent here gsub(/#{Mx[:br_nl]}+/m,"\n\n") #match not ideal, but currently not inserting extra newlines anyway ocn=SiSU_TeX_Pdf::FormatTextObject.new(@md).ocn_display(dob) - dob.tmp=if dob.is=='group' \ - or dob.is=='block' \ - or dob.is=='alt' + dob.tmp=if dob.is==:group \ + || dob.is==:block \ + || dob.is==:alt ocn \ + @tex_ml.paraskip_small \ + "\n" \ @@ -482,7 +484,7 @@ module SiSU_TeX + '\\end{footnotesize}' \ + "\n" \ + @tex_ml.paraskip_normal - elsif dob.is=~/verse/ + elsif dob.is==:verse ocn \ + @tex_ml.paraskip_tiny \ + "\n" \ @@ -495,7 +497,7 @@ module SiSU_TeX + "\n\\linebreak\n" end dob - when /code/ + elsif dob.is ==:code dob=if @codeblock_box == 'listings' box_listings(dob,ocn) elsif @codeblock_box == 'boites' @@ -511,7 +513,7 @@ module SiSU_TeX else tst=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob) case dob.is - when 'heading' + when :heading case dob.ln when 1..3 tst.heading_major @@ -523,7 +525,7 @@ module SiSU_TeX tst.level6 else dob end - when 'heading_insert' + when :heading_insert br="\n\\\\\n" if dob.name=='book_index' h=tst.heading_major @@ -555,7 +557,7 @@ module SiSU_TeX dob.tmp=h.tmp + ' ' + '\begin{scriptsize}' + metadata.join(br) + '\end{scriptsize}' else dob.tmp='' # dob.tmp={ l: '', p: '' } end - when 'para' + when :para if dob.bullet_ dob.tmp=tst.bullet elsif dob.indent \ @@ -572,7 +574,7 @@ module SiSU_TeX dob=enclose(dob) unless dob.tmp =~/^$/ end else - dob.tmp=dob.tmp.strip unless dob.is=='code' + dob.tmp=dob.tmp.strip unless dob.is==:code dob=enclose(dob) unless dob.tmp =~/^$/ end if dob.class==String @@ -582,20 +584,20 @@ module SiSU_TeX dob end if dob.tmp =~/(?:#{Mx[:url_o]}\S+?#{Mx[:url_c]}|image\b)/m \ - && dob.is !='code' + && dob.is !=:code dob=SiSU_TeX_Pdf::BareUrls.new(@md,dob).bare_urls tst=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob) dob=tst.urls_txt_and_images dob elsif dob.tmp =~/https?:\/\/\S+\b/m \ - && dob.is =='code' \ + && dob.is ==:code \ && @codeblock_box !='listings' dob=SiSU_TeX_Pdf::BareUrls.new(@md,dob).bare_urls_in_code dob end if dob.class !=Hash \ && dob.tmp =~/#{Mx[:lnk_o]}.+?#{Mx[:lnk_c]}image\b/ \ - && dob.is !='code' + && dob.is !=:code tst=SiSU_TeX_Pdf::FormatTextObject.new(@md,dob) end dob @@ -763,10 +765,10 @@ WOK x=nil data.each do |dob| #% case follows with levels 1-6 indents & graphics if dob.class==Hash - elsif dob.of=='para' \ - or dob.of=='block' #GATEWAY FIX FIX stuff + elsif dob.of==:para \ + || dob.of==:block #GATEWAY FIX FIX stuff dob=markup_common(dob) - elsif dob.is=='table' + elsif dob.is==:table if ( dob.tmp['a4'] \ or dob.tmp['a5'] \ or dob.tmp['b5'] \ @@ -809,7 +811,7 @@ WOK @tex_file << "\n\\end{document}" end def number_paras_numbering(dob) # need tables and other types of object - if dob.of =~/para/ #\ + if dob.of ==:para paranum=dob.ocn ? dob.ocn : '' paranum = '' if paranum.to_i==0 paranumber_display=if @md.markup.inspect =~/no_ocn/ \ @@ -860,7 +862,9 @@ WOK else p "#{__FILE__}:#{__LINE__}" if @md.opt.cmd.inspect =~/M/ end else - dob=if dob.of !~/comment|meta|layout/ + dob=if dob.of !=:comment \ + || dob.of !=:meta \ + || dob.of !=:layout number_paras_numbering(dob) else dob end @@ -928,13 +932,13 @@ WOK elsif morph.class.inspect =~ /SiSU_DAL_DocumentStructure/ \ and morph.tmp \ and morph.tmp.class==String - if morph.is !='code' \ - && morph.of !='block' + if morph.is !=:code \ + && morph.of !=:block morph.tmp=morph.tmp.gsub(/^\s+/,'') else morph.tmp end - if morph.tmp !~/\A\s*\Z/ \ - or morph.is=='code' + if (morph.tmp !~/\A\s*\Z/) \ + || morph.is==:code file[:portrait].puts morph.tmp,"\n" file[:landscape].puts morph.tmp,"\n" end diff --git a/lib/sisu/v3dv/texpdf_format.rb b/lib/sisu/v3dv/texpdf_format.rb index 2eddf72c..fdcdc3d1 100644 --- a/lib/sisu/v3dv/texpdf_format.rb +++ b/lib/sisu/v3dv/texpdf_format.rb @@ -123,7 +123,7 @@ module SiSU_TeX_Pdf def longtable_landscape end_table='\end{longtable}' row_break='\\\\\\' - txt=if @dob.is=='table' + txt=if @dob.is==:table tw=case @dob.tmp[:paper_size] when /a4/i; @tx.a4.landscape.w #European default, SiSU default when /letter/i; @tx.letter.landscape.w #U.S. default @@ -168,7 +168,7 @@ module SiSU_TeX_Pdf def longtable_portrait end_table='\end{longtable}' row_break='\\\\\\' - txt=if @dob.is=='table' + txt=if @dob.is==:table tw=case @dob.tmp[:paper_size] when /a4/i; @tx.a4.portrait.w #European default, SiSU default when /letter/i; @tx.letter.portrait.w #U.S. default @@ -1176,12 +1176,12 @@ WOK end end class SpecialCharacters - def initialize(md,str,is='') + def initialize(md,str,is=:default) @md,@txt,@is=md,str,is @brace_url=SiSU_Viz::Skin.new.url_decoration @tex2pdf=@@tex3pdf ||=SiSU_Env::SystemCall.new.tex2pdf_engine end - def xetex_code_listings(str,is='') # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list + def xetex_code_listings(str,is=:default) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list word=str.scan(/\S+|\n/) #unless line =~/^(?:@\S|%+\s)/ para_array=[] str=if word @@ -1194,7 +1194,7 @@ WOK para_array << w end str=para_array.join(' ') - str=str.strip unless is=='code' + str=str.strip unless is==:code str else '' end @@ -1226,7 +1226,7 @@ WOK gsub(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' '). gsub(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript end - def xetex_special_characters_1(str,is='') # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list + def xetex_special_characters_1(str,is=:default) # ~ ^ $ & % _ { } #LaTeX special characters - KEEP list #str=Iconv.conv('ISO-8859-1', 'UTF-8', @txt) # `require': iconv will be deprecated in the future, use String#encode instead. word=str.scan(/\S+|\n/) #unless line =~/^(?:@\S|%+\s)/ para_array=[] @@ -1249,7 +1249,7 @@ WOK para_array << w end str=para_array.join(' ') - str=str.strip unless is=='code' + str=str.strip unless is==:code str else '' end @@ -1258,7 +1258,7 @@ WOK gsub(/#{Mx[:br_eof]}/,''). gsub(/#{Mx[:br_endnotes]}/,'') #problem sequence -> - str=str.gsub(/&(?:nbsp);|#{Mx[:nbsp]}/,'\hardspace') unless is=='code' # < SiSU special character also LaTeX + str=str.gsub(/&(?:nbsp);|#{Mx[:nbsp]}/,'\hardspace') unless is==:code # < SiSU special character also LaTeX str=str.gsub(/&(?:lt|#060);/,'\lt'). # < SiSU special character also LaTeX gsub(/#{Mx[:gl_o]}#(?:gt|062)#{Mx[:gl_c]}/,'\gt'). # > SiSU special character also LaTeX gsub(/#{Mx[:gl_o]}#123#{Mx[:gl_c]}/,'\curlyopen'). # { SiSU special character also LaTeX @@ -1282,7 +1282,7 @@ WOK gsub(/<sup><font face=symbol>&atild;<\/font><\/sup>/,' '). gsub(/\\copy(right|mark)?/,'<=copymark>') # ok problem with superscript end - def xetex_special_characters_2(str,is='') + def xetex_special_characters_2(str,is=:default) str=str.gsub(/#{Mx[:gl_o]}#156#{Mx[:gl_c]}/,'\oe '). gsub(/\$/,'\$'). gsub(/\#/,'\#'). @@ -1293,7 +1293,7 @@ WOK end str=str.gsub(/\{/,'\{'). gsub(/\}/,'\}') - str=if is=='code' + str=if is==:code str.gsub(/&/,'{\\\&}'). gsub(/\\~(\\\{)/,'{$\tilde$}\1'). gsub(/(\\\})\\~/,'\1{$\tilde$}'). @@ -1316,7 +1316,7 @@ WOK '\begin{scriptsize}\url{\1}\end{scriptsize}'). #special case \{ e.g. \}http://url gsub(/#{Mx[:url_o]}_(\S+?)#{Mx[:url_c]}/, '\begin{scriptsize}\\url{\1}\end{scriptsize}') #specially escaped url no decoration - unless is=='code' + unless is==:code str=str.gsub(/(^|#{Mx[:gl_c]}|\s)((?:https?|file|ftp):\/\/\S+?\.[^'"\s]+?)([;.,]?(?=\s|$))/, "\\1#{@brace_url.tex_open}\\begin{scriptsize}\\url{\\2}\\end{scriptsize}#{@brace_url.tex_close}\\3") #url matching with decoration <url> positive lookahead, sequence issue with { linked }http://url cannot use \b at start end @@ -1334,7 +1334,7 @@ WOK gsub(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,"\$^{\\textrm{\\1}}\$"). gsub(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,"\$_{\\textrm{\\1}}\$"). gsub(/#{Mx[:fa_monospace_o]}(.+?)#{Mx[:fa_monospace_c]}/,'\begin{monosp}\1\end{monosp}') - unless is=='code' + unless is==:code str=str.gsub(/"(.+?)"/,'“\1”'). # quote marks / quotations open & close " need condition exclude for code gsub(/\s+"/,' “'). # open " gsub(/^(#{Mx[:lv_o]}[1-6-]:\S*?#{Mx[:lv_c]}|<.+?>)?\s*"/,'\1“'). #fix Mx[:lv_o] # open " @@ -1549,16 +1549,6 @@ Generated by \\href{http://www.jus.uio.no/sisu}{SiSU www.jus.uio.no/sisu } \\\\ \\end{small}}& WOK end - def manifest_info - url=@md.fnb.gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1') - fn=@md.fn[:manifest].gsub(/(?:\\)*([$&~%_#}{^])/,'\\\\\1') -<<WOK -{\\begin{footnotesize} -\\\\ For alternative output formats of this document check: -\\\\ #{@brace_url.tex_open}\\begin{scriptsize}\\href{#{@vz.url_root_http}/#{url}/#{fn}}{#{@vz.url_root_http}/#{url}/#{fn}}\\end{scriptsize}#{@brace_url.tex_close} -\\end{footnotesize}}& -WOK - end def endnotes #not used should be inserted before MetaData section which preceeds doc_tail, but is "part of document" <<WOK \\subsection*{Endnotes} diff --git a/lib/sisu/v3dv/update.rb b/lib/sisu/v3dv/update.rb index 12597c99..f4ad275c 100644 --- a/lib/sisu/v3dv/update.rb +++ b/lib/sisu/v3dv/update.rb @@ -83,42 +83,48 @@ module SiSU_UpdateControlFlag @env=SiSU_Env::InfoEnv.new(@md.fns) out=@env.path.output @base_path="#{out}/#{@md.fnb}" + @pdf_fn=SiSU_Env::FileOp.new(@md).base_filename end def set_flags #-mNhwpoabxXyv flag='-v' - if FileTest.file?("#{@base_path}/#{@md.fn[:doc]}")==true + if FileTest.file?("#{@md.file.output_path.txt.dir}/#{@md.file.base_filename.txt}")==true flag=flag + 'a' end - if FileTest.file?("#{@base_path}/#{@md.fn[:toc]}")==true \ - or FileTest.file?("#{@base_path}/#{@md.fn[:doc]}")==true + if FileTest.file?("#{@md.file.output_path.html_seg.dir}/#{@md.file.base_filename.html_seg}")==true + or FileTest.file?("#{@md.file.output_path.html_scroll.dir}/#{@md.file.base_filename.html_scroll}")==true flag=flag + 'h' end - if FileTest.file?("#{@base_path}/#{@md.fn[:xhtml]}")==true + if FileTest.file?("#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}")==true flag=flag + 'b' end - if FileTest.file?("#{@base_path}/#{@md.fn[:sax]}")==true + if FileTest.file?("#{@md.file.output_path.xml_sax.dir}/#{@md.file.base_filename.xml_sax}")==true flag=flag + 'x' end - if FileTest.file?("#{@base_path}/#{@md.fn[:dom]}")==true + if FileTest.file?("#{@md.file.output_path.xml_dom.dir}/#{@md.file.base_filename.xml_dom}")==true flag=flag + 'X' end - if FileTest.file?("#{@base_path}/#{@md.fn[:odf]}")==true + if FileTest.file?("#{@md.file.output_path.epub.dir}/#{@md.file.base_filename.epub}")==true + flag=flag + 'e' + end + if FileTest.file?("#{@md.file.output_path.odt.dir}/#{@md.file.base_filename.odt}")==true flag=flag + 'o' end - if FileTest.file?("#{@base_path}/#{@md.fn[:pdf_p]}")==true \ - or FileTest.file?("#{@base_path}/#{@md.fn[:pdf_l]}")==true + if FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_p_a4}")==true \ + or FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_l_a4}")==true \ + or FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_p_letter}")==true \ + or FileTest.file?("#{@md.file.output_path.pdf.dir}/#{@pdf_fn.pdf_l_letter}")==true flag=flag + 'p' end - if FileTest.file?("#{@base_path}/#{@md.fn[:concordance]}")==true + if FileTest.file?("#{@md.file.output_path.html_concordance.dir}/#{@md.file.base_filename.html_concordance}")==true flag=flag + 'w' end - if FileTest.file?("#{@base_path}/#{@md.fn[:digest]}")==true + if FileTest.file?("#{@md.file.output_path.digest.dir}/#{@md.file.base_filename.digest}")==true flag=flag + 'N' end - if FileTest.file?("#{@base_path}/#{@md.fns}")==true + if FileTest.file?("#{@md.file.output_path.src.dir}/#{@md.file.base_filename.src}")==true flag=flag + 's' end - if FileTest.file?("#{@base_path}/sisupod.tgz")==true + if FileTest.file?("#{@md.file.output_path.sisupod.dir}/#{@md.file.base_filename.sisupod}")==true flag=flag + 'S' end puts flag diff --git a/lib/sisu/v3dv/xhtml.rb b/lib/sisu/v3dv/xhtml.rb index bf1c964a..5d17128c 100644 --- a/lib/sisu/v3dv/xhtml.rb +++ b/lib/sisu/v3dv/xhtml.rb @@ -83,9 +83,10 @@ module SiSU_XHTML unless @opt.cmd =~/q/ path=@env.path.output_tell loc=@env.url.output_tell - - tool=if @opt.cmd =~/[MV]/; "#{@env.program.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}#{path}/#{@md.fnb}/#{@md.fn[:xhtml]}\n\t#{@env.program.xml_viewer} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}#{path}/#{@md.fnb}/#{@md.fn[:xhtml]}" - elsif @opt.cmd =~/v/; "#{@env.program.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}" + tool=if @opt.cmd =~/[MV]/ + "#{@env.program.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}" + elsif @opt.cmd =~/v/ + "#{@env.program.web_browser} file://#{@md.file.output_path.xhtml.dir}/#{@md.file.base_filename.xhtml}" else "[#{@opt.f_pth[:lng_is]}] #{@opt.fns}" end @opt.cmd=~/[MVvz]/ \ @@ -191,9 +192,10 @@ WOK tags end def xml_structure(dob,type='norm') - if dob.is =~/para|heading/ + if dob.is ==:para \ + || dob.is ==:heading named=name_tags(dob) - if dob.is=='heading' + if dob.is==:heading lv=dob.ln n=dob.ln - 1 n3=dob.ln + 2 @@ -294,7 +296,7 @@ WOK end if not @rcdc x=SiSU_XML_Format::FormatSeg.new(@md,dob) - if dob.is=='heading' + if dob.is==:heading xml_structure(dob) dob.obj=case dob.ln when 1; x.heading_body1 @@ -305,25 +307,25 @@ WOK when 6; x.heading_body6 end else - if dob.is =='verse' + if dob.is ==:verse poem_structure(dob) - elsif dob.is =='group' + elsif dob.is ==:group group_structure(dob) - elsif dob.is =='block' + elsif dob.is ==:block block_structure(dob) - elsif dob.is =='code' + elsif dob.is ==:code code_structure(dob) - elsif dob.is =='table' + elsif dob.is ==:table table_structure(dob) - elsif dob.is =='para' \ + elsif dob.is ==:para \ and dob.indent.to_s =~/[1-9]/ \ and dob.bullet_==true xml_structure(dob,"indent_bullet#{dob.indent}") - elsif dob.is =='para' \ + elsif dob.is ==:para \ and dob.indent.to_s =~/[1-9]/ \ and dob.indent == dob.hang xml_structure(dob,"indent#{dob.indent}") - elsif dob.is=='para' \ + elsif dob.is==:para \ and dob.hang.to_s =~/[0-9]/ \ and dob.indent != dob.hang xml_structure(dob,"hang#{dob.hang.to_s}_indent#{dob.indent.to_s}") diff --git a/lib/sisu/v3dv/xml.rb b/lib/sisu/v3dv/xml.rb index 776c0376..1187e02e 100644 --- a/lib/sisu/v3dv/xml.rb +++ b/lib/sisu/v3dv/xml.rb @@ -204,7 +204,7 @@ WOK @@xml[:sc]=sc end def xml_structure(dob,type='norm') - if dob.is=='heading' + if dob.is==:heading lv=dob.ln n=dob.ln - 1 n3=dob.ln + 2 @@ -306,7 +306,7 @@ WOK @trans.char_enc.utf8(dob) if @sys.locale =~/utf-?8/i #% utf8 dob=@trans.markup(dob) if @rcdc==false \ - and (dob.is =~/^meta/ \ + and (dob.is ==:meta \ and dob.obj =~/Document Information/) @rcdc=true end @@ -319,7 +319,7 @@ WOK if defined? dob.ocn \ and dob.ocn.to_s =~/\d+/ x=SiSU_XML_Format::FormatSeg.new(@md,dob) - if dob.is=='heading' + if dob.is==:heading xml_structure(dob) dob.obj=case dob.ln when 1; x.heading_body1 @@ -330,25 +330,25 @@ WOK when 6; x.heading_body6 end else - if dob.is=='verse' + if dob.is==:verse poem_structure(dob) - elsif dob.is=='group' + elsif dob.is==:group group_structure(dob) - elsif dob.is=='block' + elsif dob.is==:block block_structure(dob) - elsif dob.is=='code' + elsif dob.is==:code code_structure(dob) - elsif dob.is=='table' # FIX, check css, will need to modify + elsif dob.is==:table # FIX, check css, will need to modify table_structure(dob) - elsif dob.is =~ /^para/ \ + elsif dob.is ==:para \ and dob.indent.to_s =~/[1-9]/ \ and dob.bullet_==true xml_structure(dob,"indent_bullet#{dob.indent}") - elsif dob.is =~ /^para/ \ + elsif dob.is ==:para \ and dob.indent.to_s =~/[1-9]/ \ and dob.indent == dob.hang xml_structure(dob,"indent#{dob.indent}") - elsif dob.is =~ /^para/ \ + elsif dob.is ==:para \ and dob.hang.to_s =~/[0-9]/ \ and dob.indent != dob.hang xml_structure(dob,"hang#{dob.hang.to_s}_indent#{dob.indent.to_s}") diff --git a/lib/sisu/v3dv/xml_dom.rb b/lib/sisu/v3dv/xml_dom.rb index ae45100d..e63f7ad7 100644 --- a/lib/sisu/v3dv/xml_dom.rb +++ b/lib/sisu/v3dv/xml_dom.rb @@ -165,7 +165,7 @@ WOK end def xml_element(dob,xml_el='',xml_content='',type='norm') n=n1=n2=n3=0 - if dob.is=='heading' + if dob.is==:heading lv=dob.ln n=dob.ln - 1 n1=dob.ln @@ -200,7 +200,7 @@ WOK end def xml_structure(dob,type='norm') n=n1=n2=n3=0 - if dob.is=='heading' + if dob.is==:heading lv=dob.ln n=dob.ln - 1 n1=dob.ln @@ -344,7 +344,7 @@ WOK @trans.char_enc.utf8(dob) if @sys.locale =~/utf-?8/i #% utf8 dob=@trans.markup(dob) if @rcdc==false \ - and (dob.is =~/^meta/ \ + and (dob.is ==:meta \ and dob.obj =~/Document Information/) @rcdc=true end @@ -353,9 +353,9 @@ WOK if not @rcdc if defined? dob.ocn \ and dob.ocn.to_s =~/\d+/ - format_scroll=SiSU_XML_Format::FormatScroll.new(@md,dob) if dob.is=='para' and dob.indent ##FIX + format_scroll=SiSU_XML_Format::FormatScroll.new(@md,dob) if dob.is==:para and dob.indent ##FIX x=SiSU_XML_Format::FormatSeg.new(@md,dob) - if dob.is=='heading' + if dob.is==:heading if dob.ln==1 type="heading_section_#{dob.ln.to_s}" xml_markup(dob) @@ -388,32 +388,32 @@ WOK end else ocn=dob.ocn - if dob.is=='verse' + if dob.is==:verse type='verse' poem_structure(dob) #redo - elsif dob.is=='group' + elsif dob.is==:group type='group' group_structure(dob) #redo - elsif dob.is=='block' + elsif dob.is==:block type='block' block_structure(dob) #redo - elsif dob.is=='code' + elsif dob.is==:code type='code' code_structure(dob) #redo - elsif dob.is=='table' # tables come as single block #work area 2005w13 + elsif dob.is==:table # tables come as single block #work area 2005w13 type='table' table_structure(dob) - elsif dob.is=='para' \ + elsif dob.is==:para \ and dob.indent.to_s =~/[1-9]/ \ and dob.bullet_ type="indent_bullet#{dob.indent.to_s}" xml_markup(dob) - elsif dob.is=='para' \ + elsif dob.is==:para \ and dob.indent.to_s =~/[1-9]/ \ and dob.indent == dob.hang type="indent#{dob.indent.to_s}" xml_markup(dob) - elsif dob.is=='para' \ + elsif dob.is==:para \ and dob.hang.to_s =~/[0-9]/ \ and dob.indent != dob.hang type="hang#{dob.hang.to_s}_indent#{dob.indent.to_s}" diff --git a/lib/sisu/v3dv/xml_format.rb b/lib/sisu/v3dv/xml_format.rb index db3e8f25..50a9f5ac 100644 --- a/lib/sisu/v3dv/xml_format.rb +++ b/lib/sisu/v3dv/xml_format.rb @@ -406,89 +406,6 @@ WOK </html>} end end - class Widget < HeadInformation - def initialize(md) - super(md) - @md=md - @cf_defaults=SiSU_Env::InfoProcessingFlag.new - end - def home - %{<td align="center" bgcolor=#{@vz.color_band2}> - <a href="../index.html" target="_top"> - #{@vz.png_homepage}</a> -</td> -} - end - def scroll(text) - if @md.fns =~ /\.(?:-|ssm\.)?sst$/ - scroll=%{<td align="center" bgcolor=#{@vz.color_band2}> - <a href="#{@md.fn[:doc]}" target="_top" #{@vz.js_doc}> - #{text} - </a> -</td> -} - end - end - def seg(text) - %{<td align="center" bgcolor="#99CC66"> - <a href="#{@md.fn[:toc]}" target="_top" #{@vz.js_doc}> - #{text} - </a> -</td> -} - end - def search - env=SiSU_Env::InfoEnv.new(@md.fns,@md) - env.widget.search_form('sisusearch',nil,nil,true) - end - def manifest - %{<td align="center" bgcolor=#{@vz.color_band2}> - <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}> - #{@vz.nav_txt_manifest} - </a> -</td>} - end - def pdf - pdf=if @md.programs[:pdf] \ - and @cf_defaults.cf_0 =~/p/ - %{ -<td align="center" bgcolor=#{@vz.color_band2}> - <a href="#{@md.fn[:pdf_p]}" target="_top" #{@vz.js_portrait}> - #{@vz.nav_txt_pdf_portrait} - </a> -</td> -<td align="center" bgcolor=#{@vz.color_band2}> - <a href="#{@md.fn[:pdf_l]}" target="_top" #{@vz.js_landscape}> - #{@vz.nav_txt_pdf_landscape} - </a> -</td> -} - else '' - end - end - def odf - odf=if @cf_defaults.cf_0 =~/o/ - %{ -<td align="center" bgcolor=#{@vz.color_band2}> - <a href="#{@md.fn[:odf]}" target="_top" #{@vz.js_odf}> - #{@vz.nav_txt_odf} - </a> -</td>} - else '' - end - end - def concordance(text) - if @md.concord_make \ - and @md.wc_words < 300000 #max word count for display of concordance here as would now be a large file - %{<td align="center" bgcolor=#{@vz.color_band2}> - <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}> - #{text} - </a> - </td>} - else '' - end - end - end class XML end class HeadToc < HeadInformation @@ -571,21 +488,6 @@ WOK #{@vz.table_close} <p />} end - def manifest_link(text) - %{<font size=2> - <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}>#{text}</a> - </font>} - end - def concordance_link(text) - if @md.concord_make - %{<font size=2> - <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}> - #{text} - </a> - </font>} - else '' - end - end def make_seg_scroll_pdf wgt=Widget.new(@md) scroll=%{<td align="center" bgcolor=#{@vz.color_band2}> @@ -650,60 +552,6 @@ WOK <a name="start" id="start"></a> #{@vz.js_top}} end - def concordance - if @md.concord_make - %{#{@vz.margin_css} - <h4 class="toc"> - <a href="./#{@md.fn[:concordance]}" #{@vz.js_concordance}> - <i>Concordance</i> - </a> - </h4> -#{@vz.table_close}} - else - %{#{@vz.margin_css} -#{@vz.table_close}} - end - end - def links_guide_vertical_open #??? - url=(((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/) ? @vz.url_hp : @vz.url_home) - %{ -<div id="vertical_links"> - <ul id="vertical"> - <li class="refbold"> - <a href="#{url}" #{@vz.js_home}> - #{@vz.txt_hp} - </a> - </li> - <li class="ref"> - Quick Ref.: - </li> - <li class="ref"> - <a href="#{@md.fn[:manifest]}" target="_top"> - Manifest - </a> - </li> -<!- quick ref -!>} - end - def links_guide_horizontal_open #??? - url=(((defined? @vz.url_hp) && @vz.url_hp =~/^https?:\/\/\S+$/) ? @vz.url_hp : @vz.url_home) - %{ -<div id="horizontal_links"> - <ul id="horizontal"> - <li class="refbold"> - <a href="#{url}" #{@vz.js_home}> - #{@vz.txt_hp} - </a> - </li> - <li class="ref"> - Quick Ref.: - </li> - <li class="ref"> - <a href="#{@md.fn[:manifest]}" target="_top"> - Manifest - </a> - </li> -<!- quick ref -!>} - end def links_guide_open(type='horizontal') if type=='vertical'; links_guide_vertical_open else links_guide_horizontal_open @@ -795,10 +643,6 @@ WOK </h4> #{@vz.table_close}} end - def seg_metadata - @metalink=%{./#{@md.fn[:metadata]}} - metadata - end def seg_tail %{ <div class="main_column"> @@ -906,24 +750,6 @@ WOK </a> #{@vz.table_close}} end - def dot_control_pre - %{<table summary="segment hidden control pre" width="100%" border="0" cellpadding="0" bgcolor=#{@vz.color_grey_pale} align="center"> -<tr><td align="left"> - <a href="#{@seg_name_html[@seg_name_html_tracker-2]}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" #{@vz.js_prev}> - #{@vz.png_nav_dot_pre} - </a> -</td> -<td align="center"> - <a href="#{@index}#{@md.lang_code_insert}#{Sfx[:xhtml]}" target="_top" #{@vz.js_toc}> - #{@vz.png_nav_dot_toc} - </a> -</td> -<td align="right"> - <a href="#{@md.fn[:toc]}" target="_top" #{@vz.js_next}> - #{@vz.png_nav_dot_nxt} - </a> -#{@vz.table_close}} - end def toc_nav(f_pre=false,f_nxt=false,use=1) pre=nxt='' toc=%{<td align="center" bgcolor=#{@vz.color_band1}> @@ -959,23 +785,6 @@ WOK def toc_pre2 toc_nav(true,false,2).dup end - def manifest_link(text) - %{<font size=2> - <a href="#{@md.fn[:manifest]}" target="_top" #{@vz.js_manifest}> - #{text} - </a> - </font>} - end - def concordance_link(text) - if @md.concord_make - %{<font size=2> - <a href="#{@md.fn[:concordance]}" target="_top" #{@vz.js_concordance}> - #{text} - </a> - </font>} - else '' - end - end def doc_types #used in seg_nav_band ### scroll=seg='' wgt=Widget.new(@md) @@ -1137,10 +946,6 @@ WOK <a name="start" id="start"></a> #{@vz.js_top}} end - def toc_metadata - @metalink=%{./#{@md.fn[:meatadata]}} - toc_metadata - end def title_banner(title,subtitle,creator) %{ <div class="summary"> @@ -1221,7 +1026,7 @@ WOK @ocn=if defined? t_o.ocn; t_o.ocn.to_s else nil end - @headname=if t_o.is=='heading' and defined? t_o.name; t_o.name + @headname=if t_o.is==:heading and defined? t_o.name; t_o.name else nil end else diff --git a/lib/sisu/v3dv/xml_scaffold.rb b/lib/sisu/v3dv/xml_scaffold.rb index 1ae31d0f..f43daacf 100644 --- a/lib/sisu/v3dv/xml_scaffold.rb +++ b/lib/sisu/v3dv/xml_scaffold.rb @@ -110,13 +110,13 @@ module SiSU_XML_Scaffold def structure_outline(data) puts "\ninfo outline --->\n\n" data.each do |o| - puts "#{o.ocn} #{o.ln} #{o.obj}" if o.is =~/^heading/ + puts "#{o.ocn} #{o.ln} #{o.obj}" if (o.is ==:heading || o.is ==:heading_insert) end end def structure_simple(data) puts "\nheading outline --->\n\n" data.each_with_index do |o,i| - if o.is =~ /^heading/; puts "<#{@s[o.ln]}>#{o.ocn} #{o.ln} #{o.obj}</#{@s[o.ln]}>" + if (o.is ==:heading || o.is ==:heading_insert); puts "<#{@s[o.ln]}>#{o.ocn} #{o.ln} #{o.obj}</#{@s[o.ln]}>" end end end @@ -125,7 +125,7 @@ module SiSU_XML_Scaffold h=[0,false,false,false] puts "<#{@s[0]}>" data.each_with_index do |o,i| - if o.is =~/^heading/ + if (o.is ==:heading || o.is ==:heading_insert) case o.ln when 1 structure_build_tag_close(o.ln,h) |