diff options
Diffstat (limited to 'lib')
32 files changed, 3090 insertions, 172 deletions
diff --git a/lib/sisu/v3/cgi_sql_common.rb b/lib/sisu/v3/cgi_sql_common.rb index 8dce0743..5a2b9fde 100644 --- a/lib/sisu/v3/cgi_sql_common.rb +++ b/lib/sisu/v3/cgi_sql_common.rb @@ -138,7 +138,7 @@ module SiSU_CGI_sql search_field='' if checked_echo !~/\S/ @base,@search_field,@selected_db,@result_type,@checked_sql_limit,@checked_tip,@checked_stats,@checked_searched,@checked_url,@checked_case,@checked_echo,@checked_sql,@checked_all,@checked_none,@checked_selected,@checked_default,@search_note,@the_can=base,search_field,selected_db,result_type,checked_sql_limit,checked_tip,checked_stats,checked_searched,checked_url,checked_case,checked_echo,checked_sql,checked_all,checked_none,checked_selected,checked_default,search_note,the_can @tip=if checked_tip =~/\S/ - '<font size="2" color="#666666">text:__; fulltxt:__; keywords:__; title:__; author:__; topic_register:__; subject:__; description:__; publisher:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;</font><br />' + '<font size="2" color="#666666">text:__; fulltxt:__; keywords:__; title:__; author:__; topic_register:__; subject:__; description:__; publisher:__; editor:__; contributor:__; date:__; type:__; format:__; identifier:__; source:__; language:__; relation:__; coverage:__; rights:__; comment:__; abstract:__; filename:__;</font><br />' else '' end end @@ -231,10 +231,10 @@ module SiSU_CGI_sql def search_request <<-'WOK_SQL' class Search_request #% search_for - attr_accessor :text1,:fulltext,:keywords,:title,:author,:topic_register,:subject,:description,:publisher,:contributor,:date,:type,:format,:identifier,:source,:language,:relation,:coverage,:rights,:comment,:abstract,:owner,:date_created,:date_issued,:date_modified,:date_available,:date_valid,:filename + attr_accessor :text1,:fulltext,:keywords,:title,:author,:topic_register,:subject,:description,:publisher,:editor,:contributor,:date,:type,:format,:identifier,:source,:language,:relation,:coverage,:rights,:comment,:abstract,:owner,:date_created,:date_issued,:date_modified,:date_available,:date_valid,:filename def initialize(search_field='',q='') @search_field,@q=search_field,q - @text1=@fulltext=@keywords=@title=@author=@topic_register=@subject=@description=@publisher=@contributor=@date=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@comment=@abstract=@owner=@date_created=@date_issued=@date_modified=@date_available=@date_valid=@filename='' + @text1=@fulltext=@keywords=@title=@author=@topic_register=@subject=@description=@publisher=@editor=@contributor=@date=@type=@format=@identifier=@source=@language=@relation=@coverage=@rights=@comment=@abstract=@owner=@date_created=@date_issued=@date_modified=@date_available=@date_valid=@filename='' if @search_field=~/\S/ @text1=text_to_match('text:') @fulltext=text_to_match('fulltxt:') @@ -244,6 +244,7 @@ module SiSU_CGI_sql @subject=text_to_match('subj(?:ect)?:') # DublinCore 3 - subject @description=text_to_match('description:') # DublinCore 4 - description @publisher=text_to_match('pub(?:lisher)?:') # DublinCore 5 - publisher + @editor=text_to_match('editor:') @contributor=text_to_match('contributor:') # DublinCore 6 - contributor @date=text_to_match('date:') # DublinCore 7 - date dd-mm-yy @type=text_to_match('type:') # DublinCore 8 - type @@ -275,6 +276,7 @@ module SiSU_CGI_sql @subject=q['sj'] if q['sj']=~/\S/ @description=q['dsc'] if q['dsc']=~/\S/ @publisher=q['pb'] if q['pb']=~/\S/ + @editor=q['cntr'] if q['cntr']=~/\S/ @contributor=q['cntr'] if q['cntr']=~/\S/ @date=q['dt'] if q['dt']=~/\S/ @type=q['ty'] if q['ty']=~/\S/ @@ -381,6 +383,11 @@ module SiSU_CGI_sql search[:text] << st[:search] search[:endnotes] << st[:search] end + st=Dbi_search_string.new('metadata_and_text.creator_editor',search_for.editor,q['cntr'],cse).string + if st[:flag] + search[:text] << st[:search] + search[:endnotes] << st[:search] + end st=Dbi_search_string.new('metadata_and_text.creator_contributor',search_for.contributor,q['cntr'],cse).string if st[:flag] search[:text] << st[:search] @@ -709,6 +716,7 @@ module SiSU_CGI_sql sj='&sj=' + CGI.escape(@search_for.subject) if @search_for.subject=~/\S/ dsc='&dsc=' + CGI.escape(@search_for.description) if @search_for.description=~/\S/ pb='&pb=' + CGI.escape(@search_for.publisher) if @search_for.publisher=~/\S/ + edt='&edt=' + CGI.escape(@search_for.editor) if @search_for.editor=~/\S/ cntr='&cntr=' + CGI.escape(@search_for.contributor) if @search_for.contributor=~/\S/ dt='&dt=' + CGI.escape(@search_for.date) if @search_for.date=~/\S/ ty='&ty=' + CGI.escape(@search_for.type) if @search_for.type=~/\S/ @@ -727,8 +735,8 @@ module SiSU_CGI_sql dtv='&dtv=' + CGI.escape(@search_for.date_valid) if @search_for.date_valid=~/\S/ fns='&fns=' + CGI.escape(@search_for.filename) if @search_for.filename=~/\S/ @@canned_search_url=(checked_all =~/checked/) \ - ? "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}&a=1" \ - : "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}" + ? "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{edt}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}&a=1" \ + : "#{@base}?#{s1}#{ft}#{key}#{ti}#{au}#{tr}#{sj}#{dsc}#{pb}#{edt}#{cntr}#{dt}#{ty}#{id}#{src}#{lang}#{rel}#{cov}#{cr}#{co}#{ab}#{dtc}#{dti}#{dtm}#{dta}#{dtv}#{fns}&db=#{cgi['db']}&view=#{cgi['view']}" mod=ft=~/\S+/ ? (ft.gsub(/ft/,'s1')) : s1 @canned_base_url="#{@base}?#{mod}&db=#{cgi['db']}" if checked_case=~/\S/ @@ -762,12 +770,13 @@ module SiSU_CGI_sql green=%{<font size="2" color="#004000">} canned_search_url_txt=CGI.escapeHTML(@@canned_search_url) the_can=%{<font size="2" color="#666666">#{canned_note} <a href="#{@@canned_search_url}">#{canned_search_url_txt}</a></font><br />} - p_text=p_fulltext=p_keywords=p_title=p_author=p_topic_register=p_subject=p_description=p_publisher=p_contributor=p_date=p_type=p_format=p_identifier=p_source=p_language=p_relation=p_coverage=p_rights=p_comment=p_abstract=p_filename='' + p_text=p_fulltext=p_keywords=p_title=p_author=p_topic_register=p_subject=p_description=p_publisher=p_editor=p_contributor=p_date=p_type=p_format=p_identifier=p_source=p_language=p_relation=p_coverage=p_rights=p_comment=p_abstract=p_filename='' p_filename=%{filename: #{green}#{@search_for.filename}</font><br />} if @search_for.filename =~/\S+/ p_text=%{text: #{green}#{@search_for.text1}</font><br />} if @search_for.text1 =~/\S+/ p_fulltext=%{fulltxt: #{green}#{@search_for.fulltext}</font><br />} if @search_for.fulltext =~/\S+/ p_title=%{title: #{green}#{@search_for.title}</font><br />} if @search_for.title =~/\S+/ p_author=%{author: #{green}#{@search_for.author}</font><br />} if @search_for.author =~/\S+/ + p_editor=%{editor: #{green}#{@search_for.editor}</font><br />} if @search_for.editor=~/\S+/ p_contributor=%{contributor: #{green}#{@search_for.contributor}</font><br />} if @search_for.contributor =~/\S+/ p_date=%{date: #{green}#{@search_for.date}</font><br />} if @search_for.date =~/\S+/ p_rights=%{rights: #{green}#{@search_for.rights}</font><br />} if @search_for.rights =~/\S+/ @@ -789,7 +798,7 @@ module SiSU_CGI_sql <font size="2" color="#666666"> <b>database:</b> #{green}#{@db}</font>; <b>selected view:</b> #{green}#{cgi['view']}</font> <b>search string:</b> "#{green}#{analyze_format}</font>"<br /> - #{p_text} #{p_fulltext} #{p_keywords} #{p_title} #{p_author} #{p_topic_register} #{p_subject} #{p_description} #{p_publisher} #{p_contributor} #{p_date} #{p_type} #{p_format} #{p_identifier} #{p_source} #{p_language} #{p_relation} #{p_coverage} #{p_rights} #{p_comment} #{p_abstract} #{p_filename} + #{p_text} #{p_fulltext} #{p_keywords} #{p_title} #{p_author} #{p_topic_register} #{p_subject} #{p_description} #{p_publisher} #{p_editor} #{p_contributor} #{p_date} #{p_type} #{p_format} #{p_identifier} #{p_source} #{p_language} #{p_relation} #{p_coverage} #{p_rights} #{p_comment} #{p_abstract} #{p_filename} </font> WOK #eg = %{canned search e.g.:<br /> <a href="#{url}">#{url}</a><br />find: #{analyze}<br />database: #{database}} diff --git a/lib/sisu/v3/constants.rb b/lib/sisu/v3/constants.rb index ae2a3b18..918a581f 100644 --- a/lib/sisu/v3/constants.rb +++ b/lib/sisu/v3/constants.rb @@ -151,8 +151,8 @@ Px[:lv3]= '=' Px[:lv4]= '-' Px[:lv5]= '.' Px[:lv6]= '.' -Db[:name_prefix]="SiSU#{SiSU_version_dir}d_" -Db[:name_prefix_db]="sisu_#{SiSU_version_dir}d_" +Db[:name_prefix]="SiSU#{SiSU_version_dir}e_" +Db[:name_prefix_db]="sisu_#{SiSU_version_dir}e_" Db[:col_title]=800 Db[:col_title_part]=400 Db[:col_title_edition]=10 diff --git a/lib/sisu/v3/css.rb b/lib/sisu/v3/css.rb index 463492af..e86c3076 100644 --- a/lib/sisu/v3/css.rb +++ b/lib/sisu/v3/css.rb @@ -342,7 +342,8 @@ WOK margin-right: 2em; margin-top: 10px; margin-bottom: 0px; - text-indent: 0mm; + padding-left: 0em; + text-indent: 0em; } p, h0, h1, h2, h3, h4, h5, h6 { display: block; @@ -357,16 +358,431 @@ WOK margin-top: 3px; margin-bottom: 3px; } + + /* indent */ + p.norm { } - p.i1 {margin-left: 1em;} - p.i2 {margin-left: 2em;} - p.i3 {margin-left: 3em;} - p.i4 {margin-left: 4em;} - p.i5 {margin-left: 5em;} - p.i6 {margin-left: 6em;} - p.i7 {margin-left: 7em;} - p.i8 {margin-left: 8em;} - p.i9 {margin-left: 9em;} + p.i1 {padding-left: 1em;} + p.i2 {padding-left: 2em;} + p.i3 {padding-left: 3em;} + p.i4 {padding-left: 4em;} + p.i5 {padding-left: 5em;} + p.i6 {padding-left: 6em;} + p.i7 {padding-left: 7em;} + p.i8 {padding-left: 8em;} + p.i9 {padding-left: 9em;} + + /* hanging indent */ + + p.h0i0 { + padding-left: 0em; + text-indent: 0em; + } + p.h0i1 { + padding-left: 1em; + text-indent: -1em; + } + p.h0i2 { + padding-left: 2em; + text-indent: -2em; + } + p.h0i3 { + padding-left: 3em; + text-indent: -3em; + } + p.h0i4 { + padding-left: 4em; + text-indent: -4em; + } + p.h0i5 { + padding-left: 5em; + text-indent: -5em; + } + p.h0i6 { + padding-left: 6em; + text-indent: -6em; + } + p.h0i7 { + padding-left: 7em; + text-indent: -7em; + } + p.h0i8 { + padding-left: 8em; + text-indent: -8em; + } + p.h0i9 { + padding-left: 9em; + text-indent: -9em; + } + + p.h1i0 { + padding-left: 0em; + text-indent: 1em; + } + p.h1i1 { + padding-left: 1em; + text-indent: 0em; + } + p.h1i2 { + padding-left: 2em; + text-indent: -1em; + } + p.h1i3 { + padding-left: 3em; + text-indent: -2em; + } + p.h1i4 { + padding-left: 4em; + text-indent: -3em; + } + p.h1i5 { + padding-left: 5em; + text-indent: -4em; + } + p.h1i6 { + padding-left: 6em; + text-indent: -5em; + } + p.h1i7 { + padding-left: 7em; + text-indent: -6em; + } + p.h1i8 { + padding-left: 8em; + text-indent: -7em; + } + p.h1i9 { + padding-left: 9em; + text-indent: -8em; + } + + p.h2i0 { + padding-left: 0em; + text-indent: 2em; + } + p.h2i1 { + padding-left: 1em; + text-indent: 1em; + } + p.h2i2 { + padding-left: 2em; + text-indent: 0em; + } + p.h2i3 { + padding-left: 3em; + text-indent: -1em; + } + p.h2i4 { + padding-left: 4em; + text-indent: -2em; + } + p.h2i5 { + padding-left: 5em; + text-indent: -3em; + } + p.h2i6 { + padding-left: 6em; + text-indent: -4em; + } + p.h2i7 { + padding-left: 7em; + text-indent: -5em; + } + p.h2i8 { + padding-left: 8em; + text-indent: -6em; + } + p.h2i9 { + padding-left: 9em; + text-indent: -7em; + } + + p.h3i0 { + padding-left: 0em; + text-indent: 3em; + } + p.h3i1 { + padding-left: 1em; + text-indent: 2em; + } + p.h3i2 { + padding-left: 2em; + text-indent: 1em; + } + p.h3i3 { + padding-left: 3em; + text-indent: 0em; + } + p.h3i4 { + padding-left: 4em; + text-indent: -1em; + } + p.h3i5 { + padding-left: 5em; + text-indent: -2em; + } + p.h3i6 { + padding-left: 6em; + text-indent: -3em; + } + p.h3i7 { + padding-left: 7em; + text-indent: -4em; + } + p.h3i8 { + padding-left: 8em; + text-indent: -5em; + } + p.h3i9 { + padding-left: 9em; + text-indent: -6em; + } + + p.h4i0 { + padding-left: 0em; + text-indent: 4em; + } + p.h4i1 { + padding-left: 1em; + text-indent: 3em; + } + p.h4i2 { + padding-left: 2em; + text-indent: 2em; + } + p.h4i3 { + padding-left: 3em; + text-indent: 1em; + } + p.h4i4 { + padding-left: 4em; + text-indent: 0em; + } + p.h4i5 { + padding-left: 5em; + text-indent: -1em; + } + p.h4i6 { + padding-left: 6em; + text-indent: -2em; + } + p.h4i7 { + padding-left: 7em; + text-indent: -3em; + } + p.h4i8 { + padding-left: 8em; + text-indent: -4em; + } + p.h4i9 { + padding-left: 9em; + text-indent: -5em; + } + + p.h5i0 { + padding-left: 0em; + text-indent: 5em; + } + p.h5i1 { + padding-left: 1em; + text-indent: 4em; + } + p.h5i2 { + padding-left: 2em; + text-indent: 3em; + } + p.h5i3 { + padding-left: 3em; + text-indent: 2em; + } + p.h5i4 { + padding-left: 4em; + text-indent: 1em; + } + p.h5i5 { + padding-left: 5em; + text-indent: 0em; + } + p.h5i6 { + padding-left: 6em; + text-indent: -1em; + } + p.h5i7 { + padding-left: 7em; + text-indent: -2em; + } + p.h5i8 { + padding-left: 8em; + text-indent: -3em; + } + p.h5i9 { + padding-left: 9em; + text-indent: -4em; + } + + p.h6i0 { + padding-left: 0em; + text-indent: 6em; + } + p.h6i1 { + padding-left: 1em; + text-indent: 5em; + } + p.h6i2 { + padding-left: 2em; + text-indent: 4em; + } + p.h6i3 { + padding-left: 3em; + text-indent: 3em; + } + p.h6i4 { + padding-left: 4em; + text-indent: 2em; + } + p.h6i5 { + padding-left: 5em; + text-indent: 1em; + } + p.h6i6 { + padding-left: 6em; + text-indent: 0em; + } + p.h6i7 { + padding-left: 7em; + text-indent: -1em; + } + p.h6i8 { + padding-left: 8em; + text-indent: -2em; + } + p.h6i9 { + padding-left: 9em; + text-indent: -3em; + } + + p.h7i0 { + padding-left: 0em; + text-indent: 7em; + } + p.h7i1 { + padding-left: 1em; + text-indent: 6em; + } + p.h7i2 { + padding-left: 2em; + text-indent: 5em; + } + p.h7i3 { + padding-left: 3em; + text-indent: 4em; + } + p.h7i4 { + padding-left: 4em; + text-indent: 3em; + } + p.h7i5 { + padding-left: 5em; + text-indent: 2em; + } + p.h7i6 { + padding-left: 6em; + text-indent: 1em; + } + p.h7i7 { + padding-left: 7em; + text-indent: 0em; + } + p.h7i8 { + padding-left: 8em; + text-indent: -1em; + } + p.h7i9 { + padding-left: 9em; + text-indent: -2em; + } + + p.h8i0 { + padding-left: 0em; + text-indent: 8em; + } + p.h8i1 { + padding-left: 1em; + text-indent: 7em; + } + p.h8i2 { + padding-left: 2em; + text-indent: 6em; + } + p.h8i3 { + padding-left: 3em; + text-indent: 5em; + } + p.h8i4 { + padding-left: 4em; + text-indent: 4em; + } + p.h8i5 { + padding-left: 5em; + text-indent: 3em; + } + p.h8i6 { + padding-left: 6em; + text-indent: 2em; + } + p.h8i7 { + padding-left: 7em; + text-indent: 1em; + } + p.h8i8 { + padding-left: 8em; + text-indent: 0em; + } + p.h8i9 { + padding-left: 9em; + text-indent: -1em; + } + + p.h9i0 { + padding-left: 0em; + text-indent: 9em; + } + p.h9i1 { + padding-left: 1em; + text-indent: 8em; + } + p.h9i2 { + padding-left: 2em; + text-indent: 7em; + } + p.h9i3 { + padding-left: 3em; + text-indent: 6em; + } + p.h9i4 { + padding-left: 4em; + text-indent: 5em; + } + p.h9i5 { + padding-left: 5em; + text-indent: 4em; + } + p.h9i6 { + padding-left: 6em; + text-indent: 3em; + } + p.h9i7 { + padding-left: 7em; + text-indent: 2em; + } + p.h9i8 { + padding-left: 8em; + text-indent: 1em; + } + p.h9i9 { + padding-left: 9em; + text-indent: 0em; + } p.it0 { margin-left: 0em; @@ -1339,35 +1755,446 @@ WOK text-align: left; } text[class|="indent0"] { - margin-left: 10%; + padding-left: 10%; } text[class|="indent1"] { - margin-left: 15%; + padding-left: 15%; } text[class|="indent2"] { - margin-left: 20%; + padding-left: 20%; } text[class|="indent3"] { - margin-left: 25%; + padding-left: 25%; } text[class|="indent4"] { - margin-left: 30%; + padding-left: 30%; } text[class|="indent5"] { - margin-left: 35%; + padding-left: 35%; } text[class|="indent6"] { - margin-left: 40%; + padding-left: 40%; } text[class|="indent7"] { - margin-left: 45%; + padding-left: 45%; } text[class|="indent8"] { - margin-left: 50%; + padding-left: 50%; } text[class|="indent9"] { - margin-left: 55%; + padding-left: 55%; + } + + text[class|="hang0_indent0"] { + padding-left: 10%; + text-indent: 0%; + } + text[class|="hang0_indent1"] { + padding-left: 15%; + text-indent: -5%; + } + text[class|="hang0_indent2"] { + padding-left: 20%; + text-indent: -10%; + } + text[class|="hang0_indent3"] { + padding-left: 25%; + text-indent: -15%; + } + text[class|="hang0_indent4"] { + padding-left: 30%; + text-indent: -20%; + } + text[class|="hang0_indent5"] { + padding-left: 35%; + text-indent: -25%; + } + text[class|="hang0_indent6"] { + padding-left: 40%; + text-indent: -30%; + } + text[class|="hang0_indent7"] { + padding-left: 45%; + text-indent: -35%; + } + text[class|="hang0_indent8"] { + padding-left: 50%; + text-indent: -40%; + } + text[class|="hang0_indent9"] { + padding-left: 55%; + text-indent: -45%; + } + + text[class|="hang1_indent0"] { + padding-left: 10%; + text-indent: 5%; + } + text[class|="hang1_indent1"] { + padding-left: 15%; + text-indent: 0%; + } + text[class|="hang1_indent2"] { + padding-left: 20%; + text-indent: -5%; + } + text[class|="hang1_indent3"] { + padding-left: 25%; + text-indent: -10%; + } + text[class|="hang1_indent4"] { + padding-left: 30%; + text-indent: -15%; + } + text[class|="hang1_indent5"] { + padding-left: 35%; + text-indent: -20%; + } + text[class|="hang1_indent6"] { + padding-left: 40%; + text-indent: -25%; + } + text[class|="hang1_indent7"] { + padding-left: 45%; + text-indent: -30%; + } + text[class|="hang1_indent8"] { + padding-left: 50%; + text-indent: -35%; + } + text[class|="hang1_indent9"] { + padding-left: 55%; + text-indent: -40%; + } + + text[class|="hang2_indent0"] { + padding-left: 10%; + text-indent: 10%; + } + text[class|="hang2_indent1"] { + padding-left: 15%; + text-indent: 5%; + } + text[class|="hang2_indent2"] { + padding-left: 20%; + text-indent: 0%; + } + text[class|="hang2_indent3"] { + padding-left: 25%; + text-indent: -5%; + } + text[class|="hang2_indent4"] { + padding-left: 30%; + text-indent: -10%; + } + text[class|="hang2_indent5"] { + padding-left: 35%; + text-indent: -15%; + } + text[class|="hang2_indent6"] { + padding-left: 40%; + text-indent: -20%; + } + text[class|="hang2_indent7"] { + padding-left: 45%; + text-indent: -25%; + } + text[class|="hang2_indent8"] { + padding-left: 50%; + text-indent: -30%; + } + text[class|="hang2_indent9"] { + padding-left: 55%; + text-indent: -35%; + } + + text[class|="hang3_indent0"] { + padding-left: 10%; + text-indent: 15%; + } + text[class|="hang3_indent1"] { + padding-left: 15%; + text-indent: 10%; + } + text[class|="hang3_indent2"] { + padding-left: 20%; + text-indent: 5%; + } + text[class|="hang3_indent3"] { + padding-left: 25%; + text-indent: 0%; + } + text[class|="hang3_indent4"] { + padding-left: 30%; + text-indent: -5%; + } + text[class|="hang3_indent5"] { + padding-left: 35%; + text-indent: -10%; + } + text[class|="hang3_indent6"] { + padding-left: 40%; + text-indent: -15%; + } + text[class|="hang3_indent7"] { + padding-left: 45%; + text-indent: -20%; + } + text[class|="hang3_indent8"] { + padding-left: 50%; + text-indent: -25%; + } + text[class|="hang3_indent9"] { + padding-left: 55%; + text-indent: -30%; + } + + text[class|="hang4_indent0"] { + padding-left: 10%; + text-indent: 20%; + } + text[class|="hang4_indent1"] { + padding-left: 15%; + text-indent: 15%; + } + text[class|="hang4_indent2"] { + padding-left: 20%; + text-indent: 10%; + } + text[class|="hang4_indent3"] { + padding-left: 25%; + text-indent: 5%; + } + text[class|="hang4_indent4"] { + padding-left: 30%; + text-indent: 0%; + } + text[class|="hang4_indent5"] { + padding-left: 35%; + text-indent: -5%; + } + text[class|="hang4_indent6"] { + padding-left: 40%; + text-indent: -10%; } + text[class|="hang4_indent7"] { + padding-left: 45%; + text-indent: -15%; + } + text[class|="hang4_indent8"] { + padding-left: 50%; + text-indent: -20%; + } + text[class|="hang4_indent9"] { + padding-left: 55%; + text-indent: -25%; + } + + text[class|="hang5_indent0"] { + padding-left: 10%; + text-indent: 25%; + } + text[class|="hang5_indent1"] { + padding-left: 15%; + text-indent: 20%; + } + text[class|="hang5_indent2"] { + padding-left: 20%; + text-indent: 15%; + } + text[class|="hang5_indent3"] { + padding-left: 25%; + text-indent: 10%; + } + text[class|="hang5_indent4"] { + padding-left: 30%; + text-indent: 5%; + } + text[class|="hang5_indent5"] { + padding-left: 35%; + text-indent: 0%; + } + text[class|="hang5_indent6"] { + padding-left: 40%; + text-indent: -5%; + } + text[class|="hang5_indent7"] { + padding-left: 45%; + text-indent: -10%; + } + text[class|="hang5_indent8"] { + padding-left: 50%; + text-indent: -15%; + } + text[class|="hang5_indent9"] { + padding-left: 55%; + text-indent: -20%; + } + + text[class|="hang6_indent0"] { + padding-left: 10%; + text-indent: 30%; + } + text[class|="hang6_indent1"] { + padding-left: 15%; + text-indent: 25%; + } + text[class|="hang6_indent2"] { + padding-left: 20%; + text-indent: 20%; + } + text[class|="hang6_indent3"] { + padding-left: 25%; + text-indent: 15%; + } + text[class|="hang6_indent4"] { + padding-left: 30%; + text-indent: 10%; + } + text[class|="hang6_indent5"] { + padding-left: 35%; + text-indent: 5%; + } + text[class|="hang6_indent6"] { + padding-left: 40%; + text-indent: 0%; + } + text[class|="hang6_indent7"] { + padding-left: 45%; + text-indent: -5%; + } + text[class|="hang6_indent8"] { + padding-left: 50%; + text-indent: -10%; + } + text[class|="hang6_indent9"] { + padding-left: 55%; + text-indent: -15%; + } + + text[class|="hang7_indent0"] { + padding-left: 10%; + text-indent: 35%; + } + text[class|="hang7_indent1"] { + padding-left: 15%; + text-indent: 30%; + } + text[class|="hang7_indent2"] { + padding-left: 20%; + text-indent: 25%; + } + text[class|="hang7_indent3"] { + padding-left: 25%; + text-indent: 20%; + } + text[class|="hang7_indent4"] { + padding-left: 30%; + text-indent: 15%; + } + text[class|="hang7_indent5"] { + padding-left: 35%; + text-indent: 10%; + } + text[class|="hang7_indent6"] { + padding-left: 40%; + text-indent: 5%; + } + text[class|="hang7_indent7"] { + padding-left: 45%; + text-indent: 0%; + } + text[class|="hang7_indent8"] { + padding-left: 50%; + text-indent: -5%; + } + text[class|="hang7_indent9"] { + padding-left: 55%; + text-indent: -10%; + } + + text[class|="hang8_indent0"] { + padding-left: 10%; + text-indent: 40%; + } + text[class|="hang8_indent1"] { + padding-left: 15%; + text-indent: 35%; + } + text[class|="hang8_indent2"] { + padding-left: 20%; + text-indent: 30%; + } + text[class|="hang8_indent3"] { + padding-left: 25%; + text-indent: 25%; + } + text[class|="hang8_indent4"] { + padding-left: 30%; + text-indent: 20%; + } + text[class|="hang8_indent5"] { + padding-left: 35%; + text-indent: 15%; + } + text[class|="hang8_indent6"] { + padding-left: 40%; + text-indent: 10%; + } + text[class|="hang8_indent7"] { + padding-left: 45%; + text-indent: 5%; + } + text[class|="hang8_indent8"] { + padding-left: 50%; + text-indent: 0%; + } + text[class|="hang8_indent9"] { + padding-left: 55%; + text-indent: -5%; + } + + text[class|="hang9_indent0"] { + padding-left: 10%; + text-indent: 45%; + } + text[class|="hang9_indent1"] { + padding-left: 15%; + text-indent: 40%; + } + text[class|="hang9_indent2"] { + padding-left: 20%; + text-indent: 35%; + } + text[class|="hang9_indent3"] { + padding-left: 25%; + text-indent: 30%; + } + text[class|="hang9_indent4"] { + padding-left: 30%; + text-indent: 25%; + } + text[class|="hang9_indent5"] { + padding-left: 35%; + text-indent: 20%; + } + text[class|="hang9_indent6"] { + padding-left: 40%; + text-indent: 15%; + } + text[class|="hang9_indent7"] { + padding-left: 45%; + text-indent: 10%; + } + text[class|="hang9_indent8"] { + padding-left: 50%; + text-indent: 5%; + } + text[class|="hang9_indent9"] { + padding-left: 55%; + text-indent: 0%; + } + text[class|="indent_bullet"] { text-indent: 0%; } @@ -1645,59 +2472,479 @@ WOK font-weight: bold; text-align: left; } + text[class|="indent0"] { + padding-left: 10%; + } text[class|="indent1"] { - margin-left: 10%; + padding-left: 15%; } text[class|="indent2"] { - margin-left: 15%; + padding-left: 20%; } text[class|="indent3"] { - margin-left: 20%; + padding-left: 25%; } text[class|="indent4"] { - margin-left: 25%; + padding-left: 30%; } text[class|="indent5"] { - margin-left: 30%; + padding-left: 35%; } text[class|="indent6"] { - margin-left: 35%; + padding-left: 40%; } text[class|="indent7"] { - margin-left: 40%; + padding-left: 45%; } text[class|="indent8"] { - margin-left: 45%; + padding-left: 50%; } text[class|="indent9"] { - margin-left: 50%; + padding-left: 55%; + } + + text[class|="hang0_indent0"] { + padding-left: 10%; + text-indent: 0%; + } + text[class|="hang0_indent1"] { + padding-left: 15%; + text-indent: -5%; + } + text[class|="hang0_indent2"] { + padding-left: 20%; + text-indent: -10%; + } + text[class|="hang0_indent3"] { + padding-left: 25%; + text-indent: -15%; + } + text[class|="hang0_indent4"] { + padding-left: 30%; + text-indent: -20%; + } + text[class|="hang0_indent5"] { + padding-left: 35%; + text-indent: -25%; + } + text[class|="hang0_indent6"] { + padding-left: 40%; + text-indent: -30%; + } + text[class|="hang0_indent7"] { + padding-left: 45%; + text-indent: -35%; + } + text[class|="hang0_indent8"] { + padding-left: 50%; + text-indent: -40%; + } + text[class|="hang0_indent9"] { + padding-left: 55%; + text-indent: -45%; + } + + text[class|="hang1_indent0"] { + padding-left: 10%; + text-indent: 5%; + } + text[class|="hang1_indent1"] { + padding-left: 15%; + text-indent: 0%; + } + text[class|="hang1_indent2"] { + padding-left: 20%; + text-indent: -5%; + } + text[class|="hang1_indent3"] { + padding-left: 25%; + text-indent: -10%; + } + text[class|="hang1_indent4"] { + padding-left: 30%; + text-indent: -15%; + } + text[class|="hang1_indent5"] { + padding-left: 35%; + text-indent: -20%; + } + text[class|="hang1_indent6"] { + padding-left: 40%; + text-indent: -25%; + } + text[class|="hang1_indent7"] { + padding-left: 45%; + text-indent: -30%; + } + text[class|="hang1_indent8"] { + padding-left: 50%; + text-indent: -35%; + } + text[class|="hang1_indent9"] { + padding-left: 55%; + text-indent: -40%; + } + + text[class|="hang2_indent0"] { + padding-left: 10%; + text-indent: 10%; + } + text[class|="hang2_indent1"] { + padding-left: 15%; + text-indent: 5%; + } + text[class|="hang2_indent2"] { + padding-left: 20%; + text-indent: 0%; + } + text[class|="hang2_indent3"] { + padding-left: 25%; + text-indent: -5%; + } + text[class|="hang2_indent4"] { + padding-left: 30%; + text-indent: -10%; + } + text[class|="hang2_indent5"] { + padding-left: 35%; + text-indent: -15%; + } + text[class|="hang2_indent6"] { + padding-left: 40%; + text-indent: -20%; + } + text[class|="hang2_indent7"] { + padding-left: 45%; + text-indent: -25%; + } + text[class|="hang2_indent8"] { + padding-left: 50%; + text-indent: -30%; + } + text[class|="hang2_indent9"] { + padding-left: 55%; + text-indent: -35%; + } + + text[class|="hang3_indent0"] { + padding-left: 10%; + text-indent: 15%; + } + text[class|="hang3_indent1"] { + padding-left: 15%; + text-indent: 10%; + } + text[class|="hang3_indent2"] { + padding-left: 20%; + text-indent: 5%; + } + text[class|="hang3_indent3"] { + padding-left: 25%; + text-indent: 0%; + } + text[class|="hang3_indent4"] { + padding-left: 30%; + text-indent: -5%; + } + text[class|="hang3_indent5"] { + padding-left: 35%; + text-indent: -10%; + } + text[class|="hang3_indent6"] { + padding-left: 40%; + text-indent: -15%; + } + text[class|="hang3_indent7"] { + padding-left: 45%; + text-indent: -20%; + } + text[class|="hang3_indent8"] { + padding-left: 50%; + text-indent: -25%; + } + text[class|="hang3_indent9"] { + padding-left: 55%; + text-indent: -30%; + } + + text[class|="hang4_indent0"] { + padding-left: 10%; + text-indent: 20%; + } + text[class|="hang4_indent1"] { + padding-left: 15%; + text-indent: 15%; + } + text[class|="hang4_indent2"] { + padding-left: 20%; + text-indent: 10%; + } + text[class|="hang4_indent3"] { + padding-left: 25%; + text-indent: 5%; + } + text[class|="hang4_indent4"] { + padding-left: 30%; + text-indent: 0%; + } + text[class|="hang4_indent5"] { + padding-left: 35%; + text-indent: -5%; + } + text[class|="hang4_indent6"] { + padding-left: 40%; + text-indent: -10%; + } + text[class|="hang4_indent7"] { + padding-left: 45%; + text-indent: -15%; + } + text[class|="hang4_indent8"] { + padding-left: 50%; + text-indent: -20%; + } + text[class|="hang4_indent9"] { + padding-left: 55%; + text-indent: -25%; + } + + text[class|="hang5_indent0"] { + padding-left: 10%; + text-indent: 25%; + } + text[class|="hang5_indent1"] { + padding-left: 15%; + text-indent: 20%; + } + text[class|="hang5_indent2"] { + padding-left: 20%; + text-indent: 15%; + } + text[class|="hang5_indent3"] { + padding-left: 25%; + text-indent: 10%; + } + text[class|="hang5_indent4"] { + padding-left: 30%; + text-indent: 5%; + } + text[class|="hang5_indent5"] { + padding-left: 35%; + text-indent: 0%; + } + text[class|="hang5_indent6"] { + padding-left: 40%; + text-indent: -5%; + } + text[class|="hang5_indent7"] { + padding-left: 45%; + text-indent: -10%; + } + text[class|="hang5_indent8"] { + padding-left: 50%; + text-indent: -15%; + } + text[class|="hang5_indent9"] { + padding-left: 55%; + text-indent: -20%; + } + + text[class|="hang6_indent0"] { + padding-left: 10%; + text-indent: 30%; + } + text[class|="hang6_indent1"] { + padding-left: 15%; + text-indent: 25%; + } + text[class|="hang6_indent2"] { + padding-left: 20%; + text-indent: 20%; + } + text[class|="hang6_indent3"] { + padding-left: 25%; + text-indent: 15%; + } + text[class|="hang6_indent4"] { + padding-left: 30%; + text-indent: 10%; + } + text[class|="hang6_indent5"] { + padding-left: 35%; + text-indent: 5%; + } + text[class|="hang6_indent6"] { + padding-left: 40%; + text-indent: 0%; + } + text[class|="hang6_indent7"] { + padding-left: 45%; + text-indent: -5%; + } + text[class|="hang6_indent8"] { + padding-left: 50%; + text-indent: -10%; + } + text[class|="hang6_indent9"] { + padding-left: 55%; + text-indent: -15%; + } + + text[class|="hang7_indent0"] { + padding-left: 10%; + text-indent: 35%; + } + text[class|="hang7_indent1"] { + padding-left: 15%; + text-indent: 30%; + } + text[class|="hang7_indent2"] { + padding-left: 20%; + text-indent: 25%; + } + text[class|="hang7_indent3"] { + padding-left: 25%; + text-indent: 20%; + } + text[class|="hang7_indent4"] { + padding-left: 30%; + text-indent: 15%; + } + text[class|="hang7_indent5"] { + padding-left: 35%; + text-indent: 10%; + } + text[class|="hang7_indent6"] { + padding-left: 40%; + text-indent: 5%; + } + text[class|="hang7_indent7"] { + padding-left: 45%; + text-indent: 0%; + } + text[class|="hang7_indent8"] { + padding-left: 50%; + text-indent: -5%; + } + text[class|="hang7_indent9"] { + padding-left: 55%; + text-indent: -10%; + } + + text[class|="hang8_indent0"] { + padding-left: 10%; + text-indent: 40%; + } + text[class|="hang8_indent1"] { + padding-left: 15%; + text-indent: 35%; + } + text[class|="hang8_indent2"] { + padding-left: 20%; + text-indent: 30%; + } + text[class|="hang8_indent3"] { + padding-left: 25%; + text-indent: 25%; + } + text[class|="hang8_indent4"] { + padding-left: 30%; + text-indent: 20%; + } + text[class|="hang8_indent5"] { + padding-left: 35%; + text-indent: 15%; + } + text[class|="hang8_indent6"] { + padding-left: 40%; + text-indent: 10%; + } + text[class|="hang8_indent7"] { + padding-left: 45%; + text-indent: 5%; + } + text[class|="hang8_indent8"] { + padding-left: 50%; + text-indent: 0%; + } + text[class|="hang8_indent9"] { + padding-left: 55%; + text-indent: -5%; + } + + text[class|="hang9_indent0"] { + padding-left: 10%; + text-indent: 45%; + } + text[class|="hang9_indent1"] { + padding-left: 15%; + text-indent: 40%; + } + text[class|="hang9_indent2"] { + padding-left: 20%; + text-indent: 35%; + } + text[class|="hang9_indent3"] { + padding-left: 25%; + text-indent: 30%; + } + text[class|="hang9_indent4"] { + padding-left: 30%; + text-indent: 25%; + } + text[class|="hang9_indent5"] { + padding-left: 35%; + text-indent: 20%; + } + text[class|="hang9_indent6"] { + padding-left: 40%; + text-indent: 15%; + } + text[class|="hang9_indent7"] { + padding-left: 45%; + text-indent: 10%; + } + text[class|="hang9_indent8"] { + padding-left: 50%; + text-indent: 5%; + } + text[class|="hang9_indent9"] { + padding-left: 55%; + text-indent: 0%; + } + + text[class|="indent_bullet"] { + text-indent: 0%; + } + text[class|="indent_bullet0"] { + text-indent: 0%; } text[class|="indent_bullet1"] { - margin-left: 10%; + padding-left: 10%; } text[class|="indent_bullet2"] { - margin-left: 15%; + padding-left: 15%; } text[class|="indent_bullet3"] { - margin-left: 20%; + padding-left: 20%; } text[class|="indent_bullet4"] { - margin-left: 25%; + padding-left: 25%; } text[class|="indent_bullet5"] { - margin-left: 30%; + padding-left: 30%; } text[class|="indent_bullet6"] { - margin-left: 35%; + padding-left: 35%; } text[class|="indent_bullet7"] { - margin-left: 40%; + padding-left: 40%; } text[class|="indent_bullet8"] { - margin-left: 45%; + padding-left: 45%; } text[class|="indent_bullet9"] { - margin-left: 50%; + padding-left: 50%; } text[class|="verse"], text[class|="block"], text[class|="group"], text[class|="code"] { text-align: left; diff --git a/lib/sisu/v3/dal_doc_objects.rb b/lib/sisu/v3/dal_doc_objects.rb index ad5f8bb7..8a330f13 100644 --- a/lib/sisu/v3/dal_doc_objects.rb +++ b/lib/sisu/v3/dal_doc_objects.rb @@ -167,10 +167,10 @@ module SiSU_document_structure end end class Object_para - attr_accessor :obj,:is,:tags,:of,:name,:idx,:bullet_,:indent,:ocn,:odv,:osp,:parent,:note_,:image_,:ocn_,:digest,:tmp + attr_accessor :obj,:is,:tags,:of,:name,:idx,:bullet_,:indent,:hang,:ocn,:odv,:osp,:parent,:note_,:image_,:ocn_,:digest,:tmp def initialize @of='para' - @is=@obj=@name=@idx=@bullet_=@indent=@size=@ocn=@odv=@osp=@parent=@note_=@image_=@ocn_=@digest=@tmp=nil + @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) @@ -185,6 +185,7 @@ module SiSU_document_structure osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] indent= h[:indent].to_s || ((defined? o.indent) ? o.indent.to_s : nil) #Integer, indent level + hang= h[:hang].to_s || ((defined? o.hang) ? o.hang.to_s : nil) #Integer, hanging indent level bullet_=h[:bullet_] || ((defined? o.bullet_) ? o.bullet_ : false) #Bool, bulleted? note_= h[:note_] || ((defined? o.note_) ? o.note_ : false) #Bool, endnotes/footnotes? (processing optimization) image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization) @@ -193,7 +194,7 @@ module SiSU_document_structure end digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5 tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@name,@tags,@obj,@indent,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,bullet_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp + @of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,hang,bullet_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp self end def docinfo(h,o=nil) @@ -208,6 +209,7 @@ module SiSU_document_structure osp= h[:osp] || ((defined? o.osp) ? o.osp : nil) parent= h[:parent] || ((defined? o.parent) ? o.parent : nil) #[Node parent] indent= nil #Integer, indent level + hang= nil #Integer, indent level bullet_=false #Bool, bulleted? note_= false #Bool, endnotes/footnotes? (processing optimization) image_= h[:image_] || ((defined? o.image_) ? o.image_ : false) #Bool, images? (processing optimization) @@ -216,7 +218,7 @@ module SiSU_document_structure end digest= h[:digest] || ((defined? o.digest) ? o.digest : nil) #hash digests, either sha256 or md5 tmp= h[:tmp] || ((defined? o.tmp) ? o.tmp : nil) #available for processing, empty after use - @of,@is,@name,@tags,@obj,@indent,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,bullet_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp + @of,@is,@name,@tags,@obj,@indent,@hang,@bullet_,@idx,@ocn,@odv,@osp,@parent,@image_,@note_,@ocn_,@digest,@tmp=of,is,name,tags,obj,indent,hang,bullet_,idx,ocn,odv,osp,parent,image_,note_,ocn_,digest,tmp self end end @@ -325,10 +327,10 @@ module SiSU_document_structure end end class Object_table - attr_accessor :obj,:is,:of,:lv,:tags,:name,:idx,:indent,:size,:ocn,:number,:head_,:cols,:widths,:odv,:osp,:parent,:note_,:ocn_,:digest,:tmp + 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' - @is=@obj=@lv=@name=@idx=@indent=@size=@ocn,@number,@head_,@cols,@widths=@odv=@osp=@parent=@note_=@ocn_=@digest=@tmp=nil + @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) diff --git a/lib/sisu/v3/dal_doc_str.rb b/lib/sisu/v3/dal_doc_str.rb index ed289015..52425437 100644 --- a/lib/sisu/v3/dal_doc_str.rb +++ b/lib/sisu/v3/dal_doc_str.rb @@ -92,8 +92,36 @@ module SiSU_document_structure_extract def bullet_test(str) bool=((str=~/\*/) ? true : false) end - def indent_test(str) - num=((str=~/^_([1-9])/) ? $1 : 0) + def hang_and_indent_test(str) + hang_indent=if str=~/^_([1-9])[^_]/ + [$1,$1] + elsif str=~/^__([1-9])/ + [0,$1] + elsif str=~/^_([0-9])_([0-9])/ + [$1,$2] + else + [0,0] + end + hang,indent=hang_indent[0],hang_indent[1] + [hang,indent] + end + def hang_and_indent_def_test(str1,str2) + hang_indent=if str1=~/^_([1-9])[^_]/ + [$1,$1] + elsif str1=~/^__([1-9])/ + [0,$1] + elsif str1=~/^_([0-9])_([0-9])/ + [$1,$2] + else + [0,0] + end + obj=if str2 =~/^(.+?)\s+\\\\(?:\s+|\n)/ + str2.gsub(/^(.+?)(\s+\\\\(?:\s+|\n))/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\\2") + else + str2.gsub(/^(.+?)\n/,"#{Mx[:fa_bold_o]}\\1#{Mx[:fa_bold_c]}\n") + end + hang,indent=hang_indent[0],hang_indent[1] + [hang,indent,obj] end def endnote_test?(str) bool=((str=~/~\{.+?\}~|~\[.+?\]~/) ? true : false) @@ -171,16 +199,37 @@ module SiSU_document_structure_extract SiSU_document_structure::Object_heading.new.heading(h) else nil end - when /^(?:_[1-9]|_[1-9]?\*)\s+/ #indented and/or bullet paragraph - t_o=if t_o=~/^(_(?:[1-9]?\*|[1-9])\s+)(.+)/m + when /^_(?:[1-9]!?|[1-9]?\*)\s+/ #indented and/or bullet paragraph + t_o=if t_o=~/^(_(?:[1-9]?\*|[1-9]!?)\s+)(.+)/m tst,obj=$1,$2 - indent=indent_test(tst) + if t_o=~/^_[1-9]!\s+.+/m + hang,indent,obj=hang_and_indent_def_test(tst,obj) + else + hang,indent=hang_and_indent_test(tst) + end bullet=bullet_test(tst) image=image_test(obj) note=endnote_test?(obj) obj,tags=extract_tags(obj) unless obj=~/\A\s*\Z/m - h={ bullet_: bullet, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags } + h={ bullet_: bullet, hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags } + SiSU_document_structure::Object_para.new.paragraph(h) + end + else nil + end + when /^_[0-9]?_[0-9]!?\s+/ #hanging indent paragraph + t_o=if t_o=~/^(_[0-9]?_[0-9]!?\s+)(.+)/m + tst,obj=$1,$2 + if t_o=~/^_[0-9]?_[0-9]!\s+.+/m + hang,indent,obj=hang_and_indent_def_test(tst,obj) + else + hang,indent=hang_and_indent_test(tst) + end + image=image_test(obj) + note=endnote_test?(obj) + obj,tags=extract_tags(obj) + unless obj=~/\A\s*\Z/m + h={ hang: hang, indent: indent, obj: obj, idx: idx, note_: note, image_: image, tags: tags } SiSU_document_structure::Object_para.new.paragraph(h) end else nil @@ -196,7 +245,7 @@ module SiSU_document_structure_extract note=endnote_test?(t_o) obj,tags=extract_tags(t_o) unless obj=~/\A\s*\Z/m - h={ bullet_: false, indent: 0, obj: obj, idx: idx, note_: note, image_: image, tags: tags } + h={ bullet_: false, indent: 0, hang: 0, obj: obj, idx: idx, note_: note, image_: image, tags: tags } SiSU_document_structure::Object_para.new.paragraph(h) end end @@ -725,7 +774,8 @@ module SiSU_document_structure_extract end def structure_markup #build structure where structure provided only in meta header @dob=if @dob.is =~/para/ \ - and @dob.indent !~/[1-9]/ \ + and ((@dob.hang !~/[1-9]/ and @dob.indent !~/[1-9]/) \ + or (@dob.hang != @dob.indent)) \ and not @dob.bullet_ @dob=case @dob.obj when /^#{@md.lv1}/ diff --git a/lib/sisu/v3/dal_syntax.rb b/lib/sisu/v3/dal_syntax.rb index 4595d6e1..bb1aacbe 100644 --- a/lib/sisu/v3/dal_syntax.rb +++ b/lib/sisu/v3/dal_syntax.rb @@ -398,9 +398,19 @@ module SiSU_Syntax dob.obj.gsub!(/=\{(.+?)\}/, "#{Mx[:idx_o]}\\1#{Mx[:idx_c]}") dob.obj.gsub!(/^\s*_([1-9])\*\s*/, - "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}") #bullets, shortcut + "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:gl_bullet]}") #bullets, shortcut dob.obj.gsub!(/^\s*_([1-9])\s+/, - "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}") #indent + "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}") #indent + dob.obj.gsub!(/^\s*_([1-9])!\s+(.+?)\s*$/, + "#{Mx[:pa_o]}:i\\1:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} ") #indent bold + dob.obj.gsub!(/^\s*__([1-9])\s+/, + "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}") #hang + dob.obj.gsub!(/^\s*__([1-9])!\s+(.+?)\s*$/, + "#{Mx[:pa_o]}:i0:\\1#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]} ") #hangdef + dob.obj.gsub!(/^\s*_([0-9])_([0-9])\s+/, + "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}") #hang + dob.obj.gsub!(/^\s*_([0-9])_([0-9])!\s+(.+?)\s*$/, + "#{Mx[:pa_o]}:i\\1:\\2#{Mx[:pa_c]}#{Mx[:fa_bold_o]}\\3#{Mx[:fa_bold_c]} ") #hangdef dob.obj.gsub!(/<:hi>/,"#{Mx[:fa_hilite_o]}") #'<span style="background-color: rgb(255,240,196)">') # bright yellow rgb(255,255,0) pale yellow rgb(255,255,200) dob.obj.gsub!(/<:\/hi>/,"#{Mx[:fa_hilite_c]}") #'</span>') dob.obj.gsub!(/(#{Mx[:gr_o]}verse#{Mx[:gr_c]}.+)/m,"\\1\n") @@ -517,7 +527,11 @@ module SiSU_Syntax line.gsub!(/^\s*_\([1-9]\)\(\*\+\)\s*/, "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}#{Mx[:fa_o]}\\2#{Mx[:fa_c_o]}") #bullets, shortcut line.gsub!(/^\s*_\([1-9]\)\s+/, - "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}") + "#{Mx[:pa_o]}:i\\1#{Mx[:pa_c]}") #watch + line.gsub!(/^\s*__\([1-9]\)\s+/, + "#{Mx[:pa_o]}:h\\1#{Mx[:pa_c]}") #watch + #line.gsub!(/^\s*__\([1-9]\)!\s+/, + # "#{Mx[:pa_o]}:hd\\1#{Mx[:pa_c]}") #watch line.gsub!(/#{Mx[:br_line]}\s*_[12]\s+/, "#{Mx[:br_line]} ") #indent used in endnotes, not implemented, replace when ready with: line.gsub!(/(?:<br>|<br \/>)\s*_([12])\s+/,'<br><:i\1> ') end diff --git a/lib/sisu/v3/db_columns.rb b/lib/sisu/v3/db_columns.rb index d8a6f3cf..99118f92 100644 --- a/lib/sisu/v3/db_columns.rb +++ b/lib/sisu/v3/db_columns.rb @@ -273,6 +273,7 @@ module SiSU_DB_columns #% creator @creator: :author: + :editor: :contributor: :illustrator: :photographer: @@ -353,6 +354,34 @@ module SiSU_DB_columns end self end + def creator_editor + def name + 'creator_editor' + end + def create_column + "#{name} VARCHAR(#{Db[:col_name]}) NULL," + end + def column_comment + %{COMMENT ON COLUMN metadata_and_text.#{name} + IS 'metadata document editor name(s)';} + end + def tuple + t=if defined? @md.creator.editor_detail \ + and @md.creator.editor_detail.class==Array \ + and @md.creator.editor_detail.length > 0 + txt=@md.creator.editor_detail #dc + txt='' + @md.creator.editor_detail.each do |h| + txt=txt + %{#{h[:the]}, #{h[:others]}; } + end + txt.gsub!(/[;, ]+\s*$/,'') + special_character_escape(txt) + ["#{name}, ","'#{txt}', "] + else ['',''] + end + end + self + end def creator_contributor # DublinCore 6 - contributor def name 'creator_contributor' diff --git a/lib/sisu/v3/db_create.rb b/lib/sisu/v3/db_create.rb index 35750c4b..1804410a 100644 --- a/lib/sisu/v3/db_create.rb +++ b/lib/sisu/v3/db_create.rb @@ -116,6 +116,7 @@ module SiSU_DB_create #{column.creator_author.create_column} #{column.creator_author_honorific.create_column} #{column.creator_author_nationality.create_column} + #{column.creator_editor.create_column} #{column.creator_contributor.create_column} #{column.creator_illustrator.create_column} #{column.creator_photographer.create_column} @@ -375,6 +376,7 @@ module SiSU_DB_create %{#{column.creator_author.column_comment}}, %{#{column.creator_author_honorific.column_comment}}, %{#{column.creator_author_nationality.column_comment}}, + %{#{column.creator_editor.column_comment}}, %{#{column.creator_contributor.column_comment}}, %{#{column.creator_illustrator.column_comment}}, %{#{column.creator_photographer.column_comment}}, diff --git a/lib/sisu/v3/db_import.rb b/lib/sisu/v3/db_import.rb index 541399a9..ac6f0104 100644 --- a/lib/sisu/v3/db_import.rb +++ b/lib/sisu/v3/db_import.rb @@ -393,8 +393,16 @@ module SiSU_DB_import SiSU_Format_Shared::CSS_Format.new(@md,data).html_table elsif data.is=='code' SiSU_Format_Shared::CSS_Format.new(@md,data).code - elsif defined? data.indent and data.indent =~/[1-9]/ + elsif defined? data.indent \ + and defined? data.hang \ + and data.indent =~/[1-9]/ \ + and data.indent == data.hang SiSU_Format_Shared::CSS_Format.new(@md,data).indent(data.indent) + elsif defined? data.indent \ + and defined? data.hang \ + and data.hang =~/[0-9]/ \ + and data.indent != data.hang + SiSU_Format_Shared::CSS_Format.new(@md,data).hang_indent(data.hang,data.indent) else SiSU_Format_Shared::CSS_Format.new(@md,data).norm end diff --git a/lib/sisu/v3/db_load_tuple.rb b/lib/sisu/v3/db_load_tuple.rb index b8408f22..f7f39c08 100644 --- a/lib/sisu/v3/db_load_tuple.rb +++ b/lib/sisu/v3/db_load_tuple.rb @@ -132,6 +132,7 @@ module SiSU_DB_tuple #{@tp.column.creator_author.tuple[0]} #{@tp.column.creator_author_honorific.tuple[0]} #{@tp.column.creator_author_nationality.tuple[0]} +#{@tp.column.creator_editor.tuple[0]} #{@tp.column.creator_contributor.tuple[0]} #{@tp.column.creator_illustrator.tuple[0]} #{@tp.column.creator_photographer.tuple[0]} @@ -216,6 +217,7 @@ tid) #{@tp.column.creator_author.tuple[1]} #{@tp.column.creator_author_honorific.tuple[1]} #{@tp.column.creator_author_nationality.tuple[1]} +#{@tp.column.creator_editor.tuple[1]} #{@tp.column.creator_contributor.tuple[1]} #{@tp.column.creator_illustrator.tuple[1]} #{@tp.column.creator_photographer.tuple[1]} diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index e75ad112..2a9af20e 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -161,6 +161,7 @@ module SiSU_EPUB_Format margin-right: 2em; margin-top: 10px; margin-bottom: 0px; + padding-left: 0em; text-indent: 0mm; } p, h0, h1, h2, h3, h4, h5, h6 { @@ -177,15 +178,426 @@ module SiSU_EPUB_Format margin-bottom: 3px; } p.norm { } - p.i1 {margin-left: 1em;} - p.i2 {margin-left: 2em;} - p.i3 {margin-left: 3em;} - p.i4 {margin-left: 4em;} - p.i5 {margin-left: 5em;} - p.i6 {margin-left: 6em;} - p.i7 {margin-left: 7em;} - p.i8 {margin-left: 8em;} - p.i9 {margin-left: 9em;} + p.i1 {padding-left: 1em;} + p.i2 {padding-left: 2em;} + p.i3 {padding-left: 3em;} + p.i4 {padding-left: 4em;} + p.i5 {padding-left: 5em;} + p.i6 {padding-left: 6em;} + p.i7 {padding-left: 7em;} + p.i8 {padding-left: 8em;} + p.i9 {padding-left: 9em;} + + p.h0i0 { + padding-left: 0em; + text-indent: 0em; + } + p.h0i1 { + padding-left: 1em; + text-indent: -1em; + } + p.h0i2 { + padding-left: 2em; + text-indent: -2em; + } + p.h0i3 { + padding-left: 3em; + text-indent: -3em; + } + p.h0i4 { + padding-left: 4em; + text-indent: -4em; + } + p.h0i5 { + padding-left: 5em; + text-indent: -5em; + } + p.h0i6 { + padding-left: 6em; + text-indent: -6em; + } + p.h0i7 { + padding-left: 7em; + text-indent: -7em; + } + p.h0i8 { + padding-left: 8em; + text-indent: -8em; + } + p.h0i9 { + padding-left: 9em; + text-indent: -9em; + } + + p.h1i0 { + padding-left: 0em; + text-indent: 1em; + } + p.h1i1 { + padding-left: 1em; + text-indent: 0em; + } + p.h1i2 { + padding-left: 2em; + text-indent: -1em; + } + p.h1i3 { + padding-left: 3em; + text-indent: -2em; + } + p.h1i4 { + padding-left: 4em; + text-indent: -3em; + } + p.h1i5 { + padding-left: 5em; + text-indent: -4em; + } + p.h1i6 { + padding-left: 6em; + text-indent: -5em; + } + p.h1i7 { + padding-left: 7em; + text-indent: -6em; + } + p.h1i8 { + padding-left: 8em; + text-indent: -7em; + } + p.h1i9 { + padding-left: 9em; + text-indent: -8em; + } + + p.h2i0 { + padding-left: 0em; + text-indent: 2em; + } + p.h2i1 { + padding-left: 1em; + text-indent: 1em; + } + p.h2i2 { + padding-left: 2em; + text-indent: 0em; + } + p.h2i3 { + padding-left: 3em; + text-indent: -1em; + } + p.h2i4 { + padding-left: 4em; + text-indent: -2em; + } + p.h2i5 { + padding-left: 5em; + text-indent: -3em; + } + p.h2i6 { + padding-left: 6em; + text-indent: -4em; + } + p.h2i7 { + padding-left: 7em; + text-indent: -5em; + } + p.h2i8 { + padding-left: 8em; + text-indent: -6em; + } + p.h2i9 { + padding-left: 9em; + text-indent: -7em; + } + + p.h3i0 { + padding-left: 0em; + text-indent: 3em; + } + p.h3i1 { + padding-left: 1em; + text-indent: 2em; + } + p.h3i2 { + padding-left: 2em; + text-indent: 1em; + } + p.h3i3 { + padding-left: 3em; + text-indent: 0em; + } + p.h3i4 { + padding-left: 4em; + text-indent: -1em; + } + p.h3i5 { + padding-left: 5em; + text-indent: -2em; + } + p.h3i6 { + padding-left: 6em; + text-indent: -3em; + } + p.h3i7 { + padding-left: 7em; + text-indent: -4em; + } + p.h3i8 { + padding-left: 8em; + text-indent: -5em; + } + p.h3i9 { + padding-left: 9em; + text-indent: -6em; + } + + p.h4i0 { + padding-left: 0em; + text-indent: 4em; + } + p.h4i1 { + padding-left: 1em; + text-indent: 3em; + } + p.h4i2 { + padding-left: 2em; + text-indent: 2em; + } + p.h4i3 { + padding-left: 3em; + text-indent: 1em; + } + p.h4i4 { + padding-left: 4em; + text-indent: 0em; + } + p.h4i5 { + padding-left: 5em; + text-indent: -1em; + } + p.h4i6 { + padding-left: 6em; + text-indent: -2em; + } + p.h4i7 { + padding-left: 7em; + text-indent: -3em; + } + p.h4i8 { + padding-left: 8em; + text-indent: -4em; + } + p.h4i9 { + padding-left: 9em; + text-indent: -5em; + } + + p.h5i0 { + padding-left: 0em; + text-indent: 5em; + } + p.h5i1 { + padding-left: 1em; + text-indent: 4em; + } + p.h5i2 { + padding-left: 2em; + text-indent: 3em; + } + p.h5i3 { + padding-left: 3em; + text-indent: 2em; + } + p.h5i4 { + padding-left: 4em; + text-indent: 1em; + } + p.h5i5 { + padding-left: 5em; + text-indent: 0em; + } + p.h5i6 { + padding-left: 6em; + text-indent: -1em; + } + p.h5i7 { + padding-left: 7em; + text-indent: -2em; + } + p.h5i8 { + padding-left: 8em; + text-indent: -3em; + } + p.h5i9 { + padding-left: 9em; + text-indent: -4em; + } + + p.h6i0 { + padding-left: 0em; + text-indent: 6em; + } + p.h6i1 { + padding-left: 1em; + text-indent: 5em; + } + p.h6i2 { + padding-left: 2em; + text-indent: 4em; + } + p.h6i3 { + padding-left: 3em; + text-indent: 3em; + } + p.h6i4 { + padding-left: 4em; + text-indent: 2em; + } + p.h6i5 { + padding-left: 5em; + text-indent: 1em; + } + p.h6i6 { + padding-left: 6em; + text-indent: 0em; + } + p.h6i7 { + padding-left: 7em; + text-indent: -1em; + } + p.h6i8 { + padding-left: 8em; + text-indent: -2em; + } + p.h6i9 { + padding-left: 9em; + text-indent: -3em; + } + + p.h7i0 { + padding-left: 0em; + text-indent: 7em; + } + p.h7i1 { + padding-left: 1em; + text-indent: 6em; + } + p.h7i2 { + padding-left: 2em; + text-indent: 5em; + } + p.h7i3 { + padding-left: 3em; + text-indent: 4em; + } + p.h7i4 { + padding-left: 4em; + text-indent: 3em; + } + p.h7i5 { + padding-left: 5em; + text-indent: 2em; + } + p.h7i6 { + padding-left: 6em; + text-indent: 1em; + } + p.h7i7 { + padding-left: 7em; + text-indent: 0em; + } + p.h7i8 { + padding-left: 8em; + text-indent: -1em; + } + p.h7i9 { + padding-left: 9em; + text-indent: -2em; + } + + p.h8i0 { + padding-left: 0em; + text-indent: 8em; + } + p.h8i1 { + padding-left: 1em; + text-indent: 7em; + } + p.h8i2 { + padding-left: 2em; + text-indent: 6em; + } + p.h8i3 { + padding-left: 3em; + text-indent: 5em; + } + p.h8i4 { + padding-left: 4em; + text-indent: 4em; + } + p.h8i5 { + padding-left: 5em; + text-indent: 3em; + } + p.h8i6 { + padding-left: 6em; + text-indent: 2em; + } + p.h8i7 { + padding-left: 7em; + text-indent: 1em; + } + p.h8i8 { + padding-left: 8em; + text-indent: 0em; + } + p.h8i9 { + padding-left: 9em; + text-indent: -1em; + } + + p.h9i0 { + padding-left: 0em; + text-indent: 9em; + } + p.h9i1 { + padding-left: 1em; + text-indent: 8em; + } + p.h9i2 { + padding-left: 2em; + text-indent: 7em; + } + p.h9i3 { + padding-left: 3em; + text-indent: 6em; + } + p.h9i4 { + padding-left: 4em; + text-indent: 5em; + } + p.h9i5 { + padding-left: 5em; + text-indent: 4em; + } + p.h9i6 { + padding-left: 6em; + text-indent: 3em; + } + p.h9i7 { + padding-left: 7em; + text-indent: 2em; + } + p.h9i8 { + padding-left: 8em; + text-indent: 1em; + } + p.h9i9 { + padding-left: 9em; + text-indent: 0em; + } + p.it0 { margin-left: 0em; @@ -1037,16 +1449,112 @@ WOK def metadata #metadata dc author=if defined? @md.creator.author \ and @md.creator.author =~/\S+/ - x=@md.creator.author.gsub!(/</,'<'); @md.creator.author.gsub!(/>/,'>') - @md.creator.author.gsub!(/<br(?: \/)?>/,'<br />') - %{\n <dc:creator opf:file-as="#{x}" opf:role="aut">#{x}</dc:creator>} + m='' + @md.creator.author_detail.each do |x| + surname=x[:the] \ + ? x[:the] \ + : '' + other_names=x[:others] \ + ? ', ' + x[:others] \ + : '' + m=(m.empty?) \ + ? (surname + other_names) \ + : (m + '; ' + surname + ', ' + other_names) + m.gsub!(/</,'<'); m.gsub!(/>/,'>') + m.gsub!(/<br(?: \/)?>/,';') + end + x=@md.creator.author.dup + x.gsub!(/</,'<'); x.gsub!(/>/,'>') + x.gsub!(/<br(?: \/)?>/,'<br />') + %{\n <dc:creator opf:file-as="#{m}" opf:role="aut">#{x}</dc:creator>} + else '' + end + editor=if defined? @md.creator.editor \ + and @md.creator.editor =~/\S+/ + m='' + @md.creator.editor_detail.each do |x| + surname=x[:the] \ + ? x[:the] \ + : '' + other_names=x[:others] \ + ? ', ' + x[:others] \ + : '' + m=(m.empty?) \ + ? (surname + other_names) \ + : (m + '; ' + surname + ', ' + other_names) + m.gsub!(/</,'<'); m.gsub!(/>/,'>') + m.gsub!(/<br(?: \/)?>/,';') + end + x=@md.creator.editor.dup + x.gsub!(/</,'<'); x.gsub!(/>/,'>') + x.gsub!(/<br(?: \/)?>/,'<br />') + %{\n <dc:creator opf:file-as="#{m}" opf:role="edt">#{x}</dc:creator>} + else '' + end + translator=if defined? @md.creator.translator \ + and @md.creator.translator =~/\S+/ + m='' + @md.creator.translator_detail.each do |x| + surname=x[:the] \ + ? x[:the] \ + : '' + other_names=x[:others] \ + ? ', ' + x[:others] \ + : '' + m=(m.empty?) \ + ? (surname + other_names) \ + : (m + '; ' + surname + ', ' + other_names) + m.gsub!(/</,'<'); m.gsub!(/>/,'>') + m.gsub!(/<br(?: \/)?>/,';') + end + x=@md.creator.translator.dup + x.gsub!(/</,'<'); x.gsub!(/>/,'>') + x.gsub!(/<br(?: \/)?>/,'<br />') + %{\n <dc:creator opf:file-as="#{m}" opf:role="trl">#{x}</dc:creator>} else '' end illustrator=if defined? @md.creator.illustrator \ and @md.creator.illustrator =~/\S+/ - x=@md.creator.illustrator.gsub!(/</,'<'); @md.creator.illustrator.gsub!(/>/,'>') - @md.creator.illustrator.gsub!(/<br(?: \/)?>/,'<br />') - %{\n <dc:creator opf:file-as="#{x}" opf:role="ill">#{x}</dc:creator>} + m='' + @md.creator.illustrator_detail.each do |x| + surname=x[:the] \ + ? x[:the] \ + : '' + other_names=x[:others] \ + ? ', ' + x[:others] \ + : '' + m=(m.empty?) \ + ? (surname + other_names) \ + : (m + '; ' + surname + ', ' + other_names) + m.gsub!(/</,'<'); m.gsub!(/>/,'>') + m.gsub!(/<br(?: \/)?>/,';') + end + x=@md.creator.illustrator.dup + x.gsub!(/</,'<'); x.gsub!(/>/,'>') + x.gsub!(/<br(?: \/)?>/,'<br />') + %{\n <dc:creator opf:file-as="#{m}" opf:role="ill">#{x}</dc:creator>} + else '' + end + date_published=if defined? @md.date.published \ + and @md.date.published =~/\S+/ + x=@md.date.published.dup + x.gsub!(/</,'<'); x.gsub!(/>/,'>') + x.gsub!(/<br(?: \/)?>/,'<br />') + %{\n <dc:date opf:event="published">#{x}</dc:date>} + else '' + end + subject=if defined? @md.classify.subject \ + and @md.classify.subject =~/\S+/ + x=@md.classify.subject.dup + x.gsub!(/</,'<'); x.gsub!(/>/,'>') + x.gsub!(/<br(?: \/)?>/,'<br />') + %{\n <dc:subject>#{x}</dc:subject>} + else '' + end + language=if defined? @md.opt.lng \ + and @md.opt.lng =~/\S+/ + language=@md.opt.lng.gsub(/<br>/,'<br />') + %{\n <dc:language>#{language}</dc:language>} else '' end rights=if defined? @md.rights.all \ @@ -1058,10 +1566,8 @@ WOK <<WOK <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf"> <dc:title>#{@md.title.full}</dc:title> - #{author}#{illustrator} - <dc:language>en-US</dc:language> + #{author}#{editor}#{translator}#{illustrator}#{language}#{date_published}#{subject}#{rights} <dc:identifier id="bookid">...</dc:identifier> - #{rights} <dc:identifier id="EPB-UUID">urn:uuid:#{@md.dgst[1]}</dc:identifier> </metadata> WOK diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb index ed8c8d39..b9b75b9c 100644 --- a/lib/sisu/v3/epub_segments.rb +++ b/lib/sisu/v3/epub_segments.rb @@ -360,8 +360,11 @@ WOK @p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,dob.ocn) end sto=SiSU_EPUB_Format::Format_text_object.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' \ + or dob.is=='heading_insert' \ + or dob.is=='para' + dob_xhtml=if dob.is=='heading' \ + or dob.is=='heading_insert' if dob.ln==4 sto.seg_heading4 # work on see Split_text_object elsif dob.ln==5 @@ -369,16 +372,23 @@ WOK elsif dob.ln==6; sto.seg_heading6 end elsif dob.is=='para' - if dob.indent and dob.indent =~/[1-9]/ + if dob.indent \ + and dob.hang \ + and dob.indent =~/[0-9]/ \ + and dob.hang =~/[0-9]/ if dob.bullet_ - sto.format('li',"i#{dob.indent}") - else sto.format('p',"i#{dob.indent}") - end - else - if dob.bullet_ - sto.format('li','bullet') + if dob.indent =~/[1-9]/ + sto.format('li',"i#{dob.indent}") + else + sto.format('li','bullet') + end + elsif dob.indent == dob.hang + sto.format('p',"i#{dob.indent}") + elsif dob.indent != dob.hang + sto.format('p',"h#{dob.hang}i#{dob.indent}") else sto.para end + else sto.para end end elsif dob.is =~/^(?:block|group|alt)$/ @@ -395,7 +405,8 @@ WOK if @md.flag_separate_endnotes # may need to revisit, check 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|para/ \ + and (not dob.ocn or dob.ocn.to_s.empty?) format_seg=SiSU_EPUB_Format::Format_seg.new(@md,dob) end if (dob.is=='heading' or dob.is=='heading_insert' or dob.is=='para') \ @@ -414,7 +425,8 @@ WOK end def tail format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md) - if @md.flag_auto_endnotes and @@seg_endnotes[@@get_hash_fn] + if @md.flag_auto_endnotes \ + and @@seg_endnotes[@@get_hash_fn] @@seg[:tail] << %{\n<div class="content">\n<div class="endnote">\n} if @@seg_endnotes[@@get_hash_fn].flatten.length > 0 @@seg[:tail] << format_head_seg.endnote_mark diff --git a/lib/sisu/v3/html_scroll.rb b/lib/sisu/v3/html_scroll.rb index d58dd502..0a37bcca 100644 --- a/lib/sisu/v3/html_scroll.rb +++ b/lib/sisu/v3/html_scroll.rb @@ -153,16 +153,22 @@ module SiSU_HTML_scroll end elsif dob.is=='para' if dob.indent \ - and dob.indent =~/[1-9]/ + and dob.hang \ + and dob.indent =~/[0-9]/ \ + and dob.hang =~/[0-9]/ if dob.bullet_ - sto.format('li',"i#{dob.indent}") - else sto.format('p',"i#{dob.indent}") - end - else - if dob.bullet_ - sto.format('li','bullet') + if dob.indent =~/[1-9]/ + sto.format('li',"i#{dob.indent}") + else + sto.format('li','bullet') + end + elsif dob.indent == dob.hang + sto.format('p',"i#{dob.indent}") + elsif dob.indent != dob.hang + sto.format('p',"h#{dob.hang}i#{dob.indent}") else sto.para end + else sto.para end elsif dob.is=='block' sto.block diff --git a/lib/sisu/v3/html_segments.rb b/lib/sisu/v3/html_segments.rb index ccd48407..e6dc0d35 100644 --- a/lib/sisu/v3/html_segments.rb +++ b/lib/sisu/v3/html_segments.rb @@ -389,16 +389,22 @@ module SiSU_HTML_seg end elsif dob.is=='para' if dob.indent \ - and dob.indent =~/[1-9]/ + and dob.hang \ + and dob.indent =~/[0-9]/ \ + and dob.hang =~/[0-9]/ if dob.bullet_ - sto.format('li',"i#{dob.indent}") - else sto.format('p',"i#{dob.indent}") - end - else - if dob.bullet_ - sto.format('li','bullet') + if dob.indent =~/[1-9]/ + sto.format('li',"i#{dob.indent}") + else + sto.format('li','bullet') + end + elsif dob.indent == dob.hang + sto.format('p',"i#{dob.indent}") + elsif dob.indent != dob.hang + sto.format('p',"h#{dob.hang}i#{dob.indent}") else sto.para end + else sto.para end end elsif dob.is=='block' diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb index 7b847d4f..5e288b96 100644 --- a/lib/sisu/v3/hub.rb +++ b/lib/sisu/v3/hub.rb @@ -157,6 +157,7 @@ module SiSU when /^xml_scaffold$/; SiSU_XML_scaffold::Source.new(@opt).read # -k xml_scaffold.rb when /^embedded$/; SiSU_Embedded::Source.new(@opt).read # -m embedded.rb (image and other content) #check when /^manifest$/; SiSU_Manifest::Source.new(@opt).read # -y manifest.rb + when /^qrcode$/; SiSU_QRcode::Source.new(@opt).read # -Q qrcode.rb when /^sitemaps$/; SiSU_Sitemaps::Source.new(@opt).read # -Y sitemaps.rb when /^zap$/; SiSU_Zap::Source.new(@opt).read # -Z zap.rb when /^dbi$/; SiSU_DBI::SiSU_SQL.new(@opt).connect # -D -d dbi.rb @@ -398,6 +399,9 @@ p "here #{__FILE__} #{__LINE__}" if @opt =~/M/ op('share_src_kdissert','kdissert (kdi)') #% -S share kdissert source end end + if @opt.act[:qrcode] #% --qrcode, -Q + op('qrcode','QRcode') + end if @opt.act[:hash_digests] #% --hash-digests, -N digest tree op('digests','digests') end diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb index 06745c35..f94534a4 100644 --- a/lib/sisu/v3/manifest.rb +++ b/lib/sisu/v3/manifest.rb @@ -415,6 +415,33 @@ module SiSU_Manifest published_languages(id,file) end end + def qrc_image + pth="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + fn=@f.base_filename.manifest_txt + #fix relative path for different output structures + img_md="../../_sisu/image/qrc_md.#{fn}.png" + img_title="../../_sisu/image/qrc_title.#{fn}.png" + if FileTest.file?("#{pth}/qrc_md.#{fn}.png")==true + @manifest[:html] <<<<WOK +<tr><td class="left"> + <p class="tiny">QR code SiSU document metadata:</p> + <p class="tiny"> + <img border="0" src="#{img_md}" alt="qrcode metadata" /> + </p> +</td></tr> +WOK + end + if FileTest.file?("#{pth}/qrc_title.#{fn}.png")==true + @manifest[:html] <<<<WOK +<tr><td class="left"> + <p class="tiny">QR code document title info:</p> + <p class="tiny"> + <img border="0" src="#{img_title}" alt="qrcode title" /> + </p> +</td></tr> +WOK + end + end def source_tests if @md.fns =~/\.ssm\.sst$/ #% decide whether to extract and include requested/required documents req=@md.fns @@ -463,6 +490,11 @@ module SiSU_Manifest id,info=@translate.author,@md.creator.author metadata(id,info) end + if defined? @md.creator.editor \ + and @md.creator.editor=~/\S+/ + id,info=@translate.editor,@md.creator.editor + metadata(id,info) + end if defined? @md.creator.contributor \ and @md.creator.contributor=~/\S+/ id,info=@translate.contributor,@md.creator.contributor @@ -813,6 +845,7 @@ WOK WOK language_versions + qrc_image @manifest[:html] <<<<WOK </table> </div> diff --git a/lib/sisu/v3/manpage.rb b/lib/sisu/v3/manpage.rb index 0a2c2fcc..e23caa76 100644 --- a/lib/sisu/v3/manpage.rb +++ b/lib/sisu/v3/manpage.rb @@ -202,11 +202,15 @@ WOK or dob.is=='heading' paragraph=dob.obj if dob.is=='para' - if dob.indent =~/[1-9]/ + if dob.indent =~/[1-9]/ \ + and dob.indent == dob.hang util=if dob.bullet_ SiSU_text_utils::Wrap.new("* #{paragraph}",78,dob.indent.to_i*2) else SiSU_text_utils::Wrap.new(paragraph,78,dob.indent.to_i*2) end + elsif dob.hang =~/[0-9]/ \ + and dob.indent != dob.hang # NOT yet implemented + util=SiSU_text_utils::Wrap.new(paragraph,78,dob.indent.to_i*2) else util=if dob.bullet_ SiSU_text_utils::Wrap.new("* #{paragraph}",78,0) diff --git a/lib/sisu/v3/odf.rb b/lib/sisu/v3/odf.rb index c42ce349..49856a87 100644 --- a/lib/sisu/v3/odf.rb +++ b/lib/sisu/v3/odf.rb @@ -308,7 +308,13 @@ module SiSU_ODF %{#{@brace_url.xml_open}<text:a xlink:type="simple" xlink:href="mailto:\\1">\\1</text:a>#{@brace_url.xml_close}}) dob.obj.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' and dob.indent.to_s =~/[0-9]/ # and t_o.bullet_==true + dob.obj= if dob.is=='para' \ + and dob.indent.to_s =~/[0-9]/ \ + and dob.indent == dob.hang + %{<text:p text:style-name="P1#{dob.indent}">#{dob.obj}#{p_num}</text:p>} + elsif dob.is=='para' \ + and dob.hang.to_s =~/[0-9]/ \ + and dob.indent != dob.hang # NOT yet implemented %{<text:p text:style-name="P1#{dob.indent}">#{dob.obj}#{p_num}</text:p>} else %{<text:p text:style-name="P1">#{dob.obj}#{p_num}</text:p>} end diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index 81d12db8..b5771590 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -309,6 +309,7 @@ module SiSU_commandline when /^--(?:po4a|pot?)$/; c=c+'P' when /^--(?:termsheet)$/; c=c+'T' when /^--(?:manifest)$/; c=c+'y' + when /^--(?:qrcode)$/; c=c+'Q' when /^--(?:sqlite)$/; c=c+'d' when /^--(?:pg|pg?sql|postgresql)$/; c=c+'D' when /^--(?:remote|rsync)$/; c=c+'R' @@ -551,6 +552,11 @@ module SiSU_commandline true else false end + act[:qrcode]=if cmd =~/Q/ \ + or mod.inspect =~/"--qrcode"/ + true + else false + end act[:manifest]=if cmd =~/y/ \ or mod.inspect =~/"--manifest"/ true diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index 22b711df..c33bab75 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -300,6 +300,27 @@ module SiSU_Param names=name_format(s) names[:name_a_h] end + def editor + names=@h['editor'] \ + ? name_format(@h['editor']) \ + : nil + s=(names.class==Hash) \ + ? names[:name_str] \ + : nil + s=if s + l,n=Db[:col_name],'creator.editor' + validate_length(s,l,n) + else nil + end + end + def editor_detail + names=@h['editor'] \ + ? name_format(@h['editor']) \ + : nil + (names.class==Hash) \ + ? names[:name_a_h] \ + : nil + end def contributor names=@h['contributor'] \ ? name_format(@h['contributor']) \ @@ -1172,17 +1193,8 @@ module SiSU_Param when /^\^~\s+\S/; @en[:note] +=1 #% processing end end - if para =~/~\{|\^~ |~\^|<:ee>|\{.+?\[[1-6]\]\}\S+?\.ss[tm]/m; @flag_auto_endnotes,@flag_endnotes=true,true - end - unless @flag_auto_endnotes - if para =~/^(4~endnotes\b|<:ee>)/ - @flag_separate_endnotes=true - @flag_endnotes=true - end - end - if para =~/^(?:4~endnotes|<:ee>)/; @flag_separate_endnotes_make=false - end - if para =~/<!!e[#0-9]+?!>\s*.+/; @flag_endnotes=true + if para =~/~\{|\^~ |~\^|\{.+?\[[1-6]\]\}\S+?\.ss[tm]/m + @flag_auto_endnotes,@flag_endnotes=true,true end if para =~/^(?:table\{|\{table)/i; @flag_tables=true end diff --git a/lib/sisu/v3/plaintext.rb b/lib/sisu/v3/plaintext.rb index b7ad1680..aee1e56f 100644 --- a/lib/sisu/v3/plaintext.rb +++ b/lib/sisu/v3/plaintext.rb @@ -225,7 +225,12 @@ WOK wrapped=if dob.is =='para' \ or dob.is=='heading' if dob.is=='para' - if dob.indent =~/[1-9]/ + if dob.hang \ + and dob.hang =~/[0-9]/ \ + and dob.indent != dob.hang + util=SiSU_text_utils::Wrap.new(dob.obj,@wrap_width,dob.indent.to_i*2,dob.hang.to_i*2) + #util=SiSU_text_utils::Wrap.new(dob.obj,@wrap_width,dob.hang.to_i*2,0) + elsif dob.indent =~/[1-9]/ util=if dob.bullet_ SiSU_text_utils::Wrap.new("* #{dob.obj}",@wrap_width,dob.indent.to_i*2) else SiSU_text_utils::Wrap.new(dob.obj,@wrap_width,dob.indent.to_i*2) diff --git a/lib/sisu/v3/po4a.rb b/lib/sisu/v3/po4a.rb index dd2aff7a..c87da346 100644 --- a/lib/sisu/v3/po4a.rb +++ b/lib/sisu/v3/po4a.rb @@ -498,8 +498,8 @@ GSUB #puts z unless z.empty? end end - def pot_structure(desc,orig,trans,indent=0) - SiSU_po4a_utils::Wrap.new(@md,orig,trans,desc,@wrap_width,indent) + def pot_structure(desc,orig,trans,indent=0,hang=0) + SiSU_po4a_utils::Wrap.new(@md,orig,trans,desc,@wrap_width,indent,hang) end def pot_structure_heading(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document lv=n=n3=nil @@ -533,7 +533,8 @@ GSUB end def pot_structure_para(dob_src='',notes_s='',dob_trn='',notes_t='') #% Used to extract the structure of a document util=nil - wrapped=if dob_src.indent =~/[1-9]/ + wrapped=if dob_src.indent =~/[1-9]/ \ + and dob_src.indent == dob_src.hang s_mark=desc=orig=trans='' if dob_src.bullet_ mark="_#{dob_src.indent}* " @@ -557,6 +558,20 @@ GSUB orig="#{s_mark}#{dob_src.obj}" trans=(dob_trn=='') ? '' : "#{s_mark}#{dob_trn.obj}" util=pot_structure(desc,orig,trans) + elsif dob_src.hang =~/[0-9]/ \ + 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}" + 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}"} + s_mark="\n# " + %{"\\n\\n#{mark}...\\n\\n"} + end + desc="#{d}#{s_mark}#{instruct}" + orig="#{s_mark}#{dob_src.obj}" + trans=(dob_trn=='') ? '' : "#{s_mark}#{dob_trn.obj}" + util=pot_structure(desc,orig,trans) else s_mark=desc=orig=trans='' if dob_src.bullet_ diff --git a/lib/sisu/v3/qrcode.rb b/lib/sisu/v3/qrcode.rb new file mode 100644 index 00000000..b31bc7a5 --- /dev/null +++ b/lib/sisu/v3/qrcode.rb @@ -0,0 +1,738 @@ +# encoding: utf-8 +=begin + + * Name: SiSU + + * Description: a framework for document structuring, publishing and search + + * Author: Ralph Amissah + + * Copyright: (C) 1997 - 2011, Ralph Amissah, All Rights Reserved. + + * License: GPL 3 or later: + + SiSU, a framework for document structuring, publishing and search + + Copyright (C) Ralph Amissah + + This program is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the Free + Software Foundation, either version 3 of the License, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. + + You should have received a copy of the GNU General Public License along with + this program. If not, see <http://www.gnu.org/licenses/>. + + If you have Internet connection, the latest version of the GPL should be + available at these locations: + <http://www.fsf.org/licensing/licenses/gpl.html> + <http://www.gnu.org/licenses/gpl.html> + + <http://www.jus.uio.no/sisu/gpl.fsf/toc.html> + <http://www.jus.uio.no/sisu/gpl.fsf/doc.html> + <http://www.jus.uio.no/sisu/gpl.fsf/plain.txt> + + * SiSU uses: + * Standard SiSU markup syntax, + * Standard SiSU meta-markup syntax, and the + * Standard SiSU object citation numbering and system + + * Hompages: + <http://www.jus.uio.no/sisu> + <http://www.sisudoc.org> + + * Download: + <http://www.jus.uio.no/sisu/SiSU/download.html> + + * Ralph Amissah + <ralph@amissah.com> + <ralph.amissah@gmail.com> + + ** Description: summary of generated outputs and metadata + +=end +module SiSU_QRcode + require_relative 'sysenv' # sysenv.rb + include SiSU_Env + require_relative 'prog_text_translation' # prog_text_translation.rb + require_relative 'particulars' # particulars.rb + include SiSU_Particulars + require_relative 'html' # html.rb + require_relative 'param' # param.rb + include SiSU_Param + require_relative 'i18n' # i18n.rb + include SiSU_Viz + class Source + def initialize(opt) + @opt=opt + @particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt) + l=SiSU_Env::Standardise_language.new(@opt.lng).language + @doc_language=l[:n] + end + def read + begin + @env=SiSU_Env::Info_env.new(@opt.fns) + @md=SiSU_Param::Parameters.new(@opt).get + SiSU_Env::Info_skin.new(@md).select + xbrowser=@env.program.web_browser + browser=@env.program.console_web_browser + unless @opt.cmd =~/q/ + url_html="file://#{@md.file.output_path.manifest.dir}/#{@md.file.base_filename.manifest}" + @opt.cmd=~/[MVvz]/ \ + ? SiSU_Screen::Ansi.new(@opt.cmd,'QR code',"#{xbrowser} #{url_html}").green_hi_blue \ + : SiSU_Screen::Ansi.new(@opt.cmd,'QR code',"[#{@opt.f_pth[:lng_is]}] #{@opt.fns}").green_title_hi + SiSU_Screen::Ansi.new(@opt.cmd,"#{browser} #{url_html}").grey_tab if @opt.cmd =~/v/i + end + data=SiSU_HTML::Source::Html_environment.new(@particulars).tuned_file_instructions + Output_Info.new(@md).check_output(data) + rescue; SiSU_Errors::Info_error.new($!,$@,@opt.cmd,@opt.fns).error + ensure + end + end + private + class Output_Info <Source + def initialize(md) + @manifest={ txt: [], txt_title: [] } + @md,@fns=md,md.fns + @env=SiSU_Env::Info_env.new(@md.fns) + @fnb=@md.fnb + @base_url="#{@env.url.root}/#{@fnb}" + @f=SiSU_Env::SiSU_file.new(@md) + @base_path=@f.output_path.manifest.dir + @@dg ||=SiSU_Env::Info_env.new.digest.type + @dg=@@dg + l=SiSU_Env::Standardise_language.new(@md.opt.lng).language + @language=l[:n] + @translate=SiSU_Translate::Source.new(@md,@language) + @brace_url=SiSU_Viz::Skin.new.url_decoration + @dest="#{@env.path.webserv}/#{@env.path.stub_pwd}/_sisu/image" + end + def output_metadata + fn=@f.base_filename.manifest_txt + mn='' + if @md.opt =~/M/ + pt=@f.output_path.manifest.dir + fn=@f.base_filename.manifest_txt + manifest=@f.write_file.manifest_txt + end + @manifest[:txt].each do |x| + manifest << x if @md.opt =~/M/ + mn += x + end + manifest.close if @md.opt =~/M/ + #system(%{ + # cat #{pt}/#{fn} | qrencode -s 3 -o qrcm.autonomy_markup0.png + #}) + cmd=SiSU_Env::System_call.new(mn,"#{@dest}/qrc_md.#{fn}.png",@md.opt.cmd) + cmd.qrencode + #system(%{ + # echo "#{mn}" | qrencode -s 3 -o #{@dest}/qrc_md.#{fn}.png + #}) + end + def output_metadata_short + fn=@f.base_filename.manifest_txt + mn='' + @manifest[:txt_title].each do |x| + mn += x + end + cmd=SiSU_Env::System_call.new(mn,"#{@dest}/qrc_title.#{fn}.png",@md.opt.cmd) + cmd.qrencode + #system(%{ + # echo "#{mn}" | qrencode -s 3 -o #{@dest}/qrc_title.#{fn}.png + #}) + end + def summarize(id,file,pth='',rel='',url='',img='● ') + size=(File.size("#{pth}/#{file}")/1024.00).to_s + kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] + @manifest[:txt] <<<<WOK +#{id} #{kb} + #{@brace_url.txt_open}#{url}/#{file}#{@brace_url.txt_close} +WOK + end + def summarize_html_seg(id,file,pth='',rel='',url='',img='● ') + size=(File.size("#{pth}/#{file}")/1024.00).to_s + kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] + @manifest[:txt] <<<<WOK +#{id} #{kb} + #{@brace_url.txt_open}#{url}/#{file}#{@brace_url.txt_close} +WOK + end + def summarize_sources(id,file,pth,rel,url) + sys=SiSU_Env::System_call.new + dgst =if @dg =~/^sha(?:2|256)$/; sys.sha256("#{pth}/#{file}") + else sys.md5("#{pth}/#{file}") + end + SiSU_Screen::Ansi.new(@md.opt.cmd,"#{dgst[1]} #{file}").warn if @md.opt.cmd =~/[vVM]/ + size=(File.size("#{pth}/#{file}")/1024.00).to_s + kb=/([0-9]+\.[0-9]{0,1})/m.match(size)[1] + @manifest[:txt] <<<<WOK +#{id} #{dgst[1]} #{kb} + #{@brace_url.txt_open}#{url}/#{file}#{@brace_url.txt_close} +WOK + end + def published_manifests? + @f=SiSU_Env::SiSU_file.new(@md) #.base_filename + @m=[] + url=@f.output_path.base.url + manifests={} + mp,mn,mt=nil,nil,nil + ln=SiSU_i18n::Languages.new.language.list + Px[:lng_lst].each do |lc| + if @env.output_dir_structure.by_language_code? + mp="#{@f.output_path.base.dir}/#{lc}/manifest" + mn="#{@md.fnb}.html" + mt="#{mp}/#{mn}" + mu="#{url}/#{lc}/manifest/#{mn}" + elsif @env.output_dir_structure.by_filetype? + mp="#{@f.output_path.base.dir}/manifest" + mn="#{@md.fnb}.#{lc}.html" + mt="#{mp}/#{mn}" + mu="#{url}/manifest/#{mn}" + else + mp="#{@f.output_path.base.dir}/#{@md.fnb}" + mn="sisu_manifest.#{lc}.html" + mt="#{mp}/#{mn}" + mu="#{url}/#{mn}" + end + if FileTest.directory?(mp) \ + && FileTest.file?(mt) + lng=ln[lc][:t] + manifests[lc]={ ln: lng, fn: mn } + @m << { mu: mu, l: lng } + end + end + #url=@f.output_path.base.url + #@en_manifest=if @env.output_dir_structure.by_language_code? + # "#{url}/en/manifest/#{@md.fnb}.html" + #elsif @env.output_dir_structure.by_filetype? + # "#{url}/manifest/#{@md.fnb}.#{lc}.html" + #else + # "#{url}/sisu_manifest.#{lc}.html" + #end + manifests + @m.uniq! + @m + end + def languages(id,file) + flv=published_manifests? + flv.each do |l| + lang=SiSU_Translate::Source.new(@md,@language,l[:n]).language_list + @manifest[:txt] << "#{l[:mu]} #{l[:l]}\n" + end + end + def published_languages(id,file) + flv=published_manifests? + flv.each do |l| + @manifest[:txt] << "#{l[:l]} #{@brace_url.txt_open}#{l[:mu]}#{@brace_url.txt_close}\n" + end + end + def metadata(id,info) + info.to_s.gsub!(/#{Mx[:br_line]}/,"\n") + @manifest[:txt] << %{#{id}: #{info}\n} + end + def md_title_info(id,info) + info.to_s.gsub!(/#{Mx[:br_line]}/,"\n") + @manifest[:txt_title] << %{#{info}\n} + end + def links(url,lnk,target) + static=if url =~/^\.\//; url.gsub(/^\.(\.)?/,@base_url) + elsif url =~/^\.\.\//; url.gsub(/^\.(\.)?/,@env.url.root) + else url + end + @manifest[:txt] << %{#{url} #{lnk} #{@brace_url.txt_open}#{static}#{@brace_url.txt_close}\n} + end + def output_tests + if FileTest.file?(@f.place_file.html_segtoc.dir)==true + pth=@f.output_path.html_seg.dir + rel=@f.output_path.html_seg.rel_sm + url=@f.output_path.html_seg.url + id,file='HTML, table of contents (for segmented text)',@f.base_filename.html_segtoc + summarize_html_seg(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.html_scroll.dir)==true + pth=@f.output_path.html_scroll.dir + rel=@f.output_path.html_scroll.rel_sm + url=@f.output_path.html_scroll.url + id,file='HTML, full length document',@f.base_filename.html_scroll + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.html_book_index.dir)==true + pth=@f.output_path.html_seg.dir + rel=@f.output_path.html_seg.rel_sm + url=@f.output_path.html_seg.url + id,file='HTML, (book type) index',@f.base_filename.html_book_index + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.html_concordance.dir)==true + pth=@f.output_path.html_seg.dir + rel=@f.output_path.html_seg.rel_sm + url=@f.output_path.html_seg.url + id,file='HTML, concordance file',@f.base_filename.html_concordance + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.epub.dir)==true + id,file='EPUB (Electronic Publication, e-book standard)',@f.base_filename.epub + pth=@f.output_path.epub.dir + rel=@f.output_path.epub.rel_sm + url=@f.output_path.epub.url + summarize(id,file,pth,rel,url) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_letter}")==true + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, U.S. letter size, portrait/vertical","#{@f.base_filename.pdf_p_letter}" + summarize(id,file,pth,rel,url) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_letter}")==true + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, U.S. letter size, landscape/horizontal","#{@f.base_filename.pdf_l_letter}" + summarize(id,file,pth,rel,url) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a4}")==true + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, A4 size, portrait/vertical","#{@f.base_filename.pdf_p_a4}" + summarize(id,file,pth,rel,url) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a4}")==true + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, A4 size, landscape/horizontal","#{@f.base_filename.pdf_l_a4}" + summarize(id,file,pth,rel,url) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_a5}")==true + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, A5 (book) size, portrait/vertical","#{@f.base_filename.pdf_p_a5}" + summarize(id,file,pth,rel,url) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_a5}")==true + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, A5 (book) size, landscape/horizontal","#{@f.base_filename.pdf_l_a5}" + summarize(id,file,pth,rel,url) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_b5}")==true + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, B5 (book) size, portrait/vertical","#{@f.base_filename.pdf_p_b5}" + summarize(id,file,pth,rel,url) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_b5}")==true + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, B5 (book) size, landscape/horizontal","#{@f.base_filename.pdf_l_b5}" + summarize(id,file,pth,rel,url) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_p_legal}")==true + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, U.S. legal size, portrait/vertical","#{@f.base_filename.pdf_p_legal}" + summarize(id,file,pth,rel,url) + end + if FileTest.file?("#{@f.output_path.pdf.dir}/#{@f.base_filename.pdf_l_legal}")==true + pth=@f.output_path.pdf.dir + rel=@f.output_path.pdf.rel_sm + url=@f.output_path.pdf.url + id,file="PDF, U.S. legal size, landscape/horizontal","#{@f.base_filename.pdf_l_legal}" + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.odt.dir)==true + pth=@f.output_path.odt.dir + rel=@f.output_path.odt.rel_sm + url=@f.output_path.odf.url + id,file='ODF:ODT (Open Document Format)',@f.base_filename.odt + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.xhtml.dir)==true + pth=@f.output_path.xhtml.dir + rel=@f.output_path.xhtml.rel_sm + url=@f.output_path.xhtml.url + id,file='ODF:ODT (Open Document Format)',@f.base_filename.odt + id,file='XHTML',@f.base_filename.xhtml + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.xml_sax.dir)==true + pth=@f.output_path.xml_sax.dir + rel=@f.output_path.xml_sax.rel_sm + url=@f.output_path.xml_sax.url + id,file='XML SAX',@f.base_filename.xml_sax + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.xml_dom.dir)==true + pth=@f.output_path.xml_dom.dir + rel=@f.output_path.xml_dom.rel_sm + url=@f.output_path.xml_dom.url + id,file='XML DOM',@f.base_filename.xml_dom + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.txt.dir)==true + if @md.opt.cmd =~/a/; id='Plaintext (Unix (UTF-8) with footnotes)' + elsif @md.opt.cmd =~/e/; id='Plaintext (Unix (UTF-8) with endnotes)' + elsif @md.opt.cmd =~/A/; id='Plaintext (dos (UTF-8) with footnotes)' + elsif @md.opt.cmd =~/E/; id='Plaintext (dos (UTF-8) with endnotes)' + else id='Plaintext (UTF-8)' + end + pth=@f.output_path.txt.dir + rel=@f.output_path.txt.rel_sm + url=@f.output_path.txt.url + file=@f.base_filename.txt + summarize(id,file,pth,rel,url) + end + if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true + id,file='LaTeX (portrait)',"#{@md.fns}.tex" + pth,rel,url='','','' + summarize(id,file,pth,rel,url) + end + if FileTest.file?("#{@base_path}/#{@md.fns}.tex")==true + id,file='LaTeX (landscape)',"#{@md.fns}.landscape.tex" + pth,rel,url='','','' + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.manpage.dir)==true + pth=@f.output_path.manpage.dir + rel=@f.output_path.manpage.rel_sm + url=@f.output_path.manpage.url + id,file='Manpage',@f.base_filename.manpage + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.texinfo.dir)==true + pth=@f.output_path.texinfo.dir + rel=@f.output_path.texinfo.rel_sm + url=@f.output_path.texinfo.url + id,file='Texinfo',@f.base_filename.texinfo + summarize(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.hash_digest.dir)==true + pth=@f.output_path.hash_digest.dir + rel=@f.output_path.hash_digest.rel_sm + url=@f.output_path.hash_digest.url + id,file="Digest/DCC - Document Content Certificate (#{@dg})",@f.base_filename.hash_digest + summarize(id,file,pth,rel,url) + end + end + def published_versions + id,file='Markup (SiSU source)',@md.fns + #languages(id,file) + published_languages(id,file) + end + def language_versions + if FileTest.file?(@f.place_file.manifest.dir)==true + id,file='Markup (SiSU source)',@md.fns + published_languages(id,file) + end + end + def source_tests + if @md.fns =~/\.ssm\.sst$/ #% decide whether to extract and include requested/required documents + req=@md.fns + if FileTest.file?(@f.place_file.src.dir)==true + pth=@f.output_path.src.dir + rel=@f.output_path.src.rel + url=@f.output_path.src.url + id,file='Markup Composite File (SiSU source)',@f.base_filename.src + summarize_sources(id,file,pth,rel,url) + end + else + if FileTest.file?(@f.place_file.src.dir)==true + pth=@f.output_path.src.dir + rel=@f.output_path.src.rel + url=@f.output_path.src.url + id,file='Markup (SiSU source)',@f.base_filename.src + summarize_sources(id,file,pth,rel,url) + end + end + if FileTest.file?(@f.place_file.sisupod.dir)==true + pth=@f.output_path.sisupod.dir + rel=@f.output_path.sisupod.rel + url=@f.output_path.sisupod.url + id,file='SiSU doc (zip)',@f.base_filename.sisupod + summarize_sources(id,file,pth,rel,url) + end + if FileTest.file?(@f.place_file.pot.dir)==true + pth=@f.output_path.pot.dir + rel=@f.output_path.pot.rel_sm + url=@f.output_path.pot.url + id,file='SiSU pot',@f.base_filename.pot + summarize_sources(id,file,pth,rel,url) + end + end + def metadata_tests + if defined? @md.title.full \ + and @md.title.full=~/\S+/ + id,info=@translate.full_title,@md.title.full + #id,info=@translate.full_title,%{"#{@md.title.full}"} + metadata(id,info) + md_title_info(id,info) + end + if defined? @md.creator.author \ + and @md.creator.author=~/\S+/ + id,info=@translate.author,@md.creator.author + metadata(id,info) + md_title_info(id,info) + end + if defined? @md.creator.editor \ + and @md.creator.editor=~/\S+/ + id,info=@translate.editor,@md.creator.editor + metadata(id,info) + end + if defined? @md.creator.contributor \ + and @md.creator.contributor=~/\S+/ + id,info=@translate.contributor,@md.creator.contributor + metadata(id,info) + end + if defined? @md.creator.translator \ + and @md.creator.translator=~/\S+/ + id,info=@translate.translator,%{(#{@md.creator.translator})} + metadata(id,info) + md_title_info(id,info) + end + if defined? @md.creator.illustrator \ + and @md.creator.illustrator=~/\S+/ + id,info=@translate.illustrator,@md.creator.illustrator + metadata(id,info) + end + if defined? @md.publisher \ + and @md.publisher=~/\S+/ #dc + id,info=@translate.publisher,@md.publisher + metadata(id,info) + end + if defined? @md.creator.prepared_by \ + and @md.creator.prepared_by=~/\S+/ + id,info=@translate.prepared_by,@md.creator.prepared_by + metadata(id,info) + end + if defined? @md.creator.digitized_by \ + and @md.creator.digitized_by=~/\S+/ + id,info=@translate.digitized_by,@md.creator.digitized_by + metadata(id,info) + end + if defined? @md.classify.subject \ + and @md.classify.subject=~/\S+/ + id,info=@translate.subject,@md.classify.subject + metadata(id,info) + end + if defined? @md.notes.description \ + and @md.notes.description=~/\S+/ + id,info=@translate.description,@md.notes.description + metadata(id,info) + end + if defined? @md.notes.abstract \ + and @md.notes.abstract=~/\S+/ + id,info=@translate.abstract,@md.notes.abstract + metadata(id,info) + end + if defined? @md.type \ + and @md.type=~/\S+/ #dc + id,info=@translate.type,@md.type + metadata(id,info) + end + if defined? @md.rights.all \ + and @md.rights.all=~/\S+/ #dc + id,info=@translate.rights,@md.rights.all + metadata(id,info) + end + if defined? @md.date.published + if defined? @md.date.published \ + and @md.date.published=~/\S+/ #dc + id,info=@translate.date,@md.date.published + metadata(id,info) + md_title_info(id,info) + end + if defined? @md.date.created \ + and @md.date.created=~/\S+/ #dc + id,info=@translate.date_created,@md.date.created + metadata(id,info) + end + if defined? @md.date.issued \ + and @md.date.issued=~/\S+/ #dc + id,info=@translate.date_issued,@md.date.issued + metadata(id,info) + end + if defined? @md.date.available \ + and @md.date.available=~/\S+/ #dc + id,info=@translate.date_available,@md.date.available + metadata(id,info) + end + if defined? @md.date.modified \ + and @md.date.modified=~/\S+/ #dc + id,info=@translate.date_modified,@md.date.modified + metadata(id,info) + end + if defined? @md.date.valid \ + and @md.date.valid=~/\S+/ #dc + id,info=@translate.date_valid,@md.date.valid + metadata(id,info) + end + end + if defined? @md.title.language \ + and @md.title.language=~/\S+/ + id,info=@translate.language,@md.title.language + metadata(id,info) + end + if defined? @md.original.language \ + and @md.original.language=~/\S+/ + id,info=@translate.language_original,@md.original.language + metadata(id,info) + end + if defined? @md.classify.format \ + and @md.classify.format=~/\S+/ + id,info=@transate.format,@md.classify.format + metadata(id,info) + end + if defined? @md.classify.identifier \ + and @md.classify.identifier=~/\S+/ + id,info=@translate.identifier,@md.classify.identifier + metadata(id,info) + end + if defined? @md.original.source \ + and @md.original.source=~/\S+/ + id,info=@translate.source,@md.original.source + metadata(id,info) + end + if defined? @md.classify.relation \ + and @md.classify.relation=~/\S+/ + id,info=@translate.relation,@md.classify.relation + metadata(id,info) + end + if defined? @md.classify.coverage \ + and @md.classify.coverage=~/\S+/ + id,info=@translate.coverage,@md.classify.coverage + metadata(id,info) + end + if defined? @md.classify.keywords \ + and @md.classify.keywords=~/\S+/ + id,info=@translate.keywords,@md.classify.keywords + metadata(id,info) + end + if defined? @md.notes.comment \ + and @md.notes.comment=~/\S+/ + id,info=@translate.comments,@md.notes.comment + metadata(id,info) + end + if defined? @md.classify.loc \ + and @md.classify.loc=~/\S+/ + id,info=@translate.cls_loc,@md.classify.loc + metadata(id,info) + end + if defined? @md.classify.dewey \ + and @md.classify.dewey=~/\S+/ + id,info=@translate.cls_dewey,@md.classify.dewey + metadata(id,info) + end + if defined? @md.classify.oclc \ + and @md.classify.oclc=~/\S+/ + id,info=@translate.cls_oclc,@md.classify.oclc + @manifest[:txt] << %{#{id}:\n} + @manifest[:txt] << %{#{info}\n} + end + if defined? @md.classify.pg \ + and @md.classify.pg=~/\S+/ + id,info=@translate.cls_gutenberg,@md.classify.pg + metadata(id,info) + end + if defined? @md.classify.isbn \ + and @md.classify.isbn=~/\S+/ + id,info=@translate.cls_isbn,@md.classify.isbn + metadata(id,info) + end + if defined? @md.notes.prefix_a \ + and @md.notes.prefix_a=~/\S+/ + id,info=@translate.prefix_a,@md.notes.prefix_a + metadata(id,info) + end + if defined? @md.notes.prefix_b \ + and @md.notes.prefix_b=~/\S+/ + id,info=@translate.prefix_b,@md.notes.prefix_b + metadata(id,info) + end + if defined? @md.topic_register_array \ + and @md.topic_register_array.length > 0 + @manifest[:txt] << %{#{@translate.topic_register}:\n} +@sp=' ' + @md.topic_register_array.each do |t| + t.each_with_index do |st,i| + if st.class==Array + st.each do |v| + @manifest[:txt] << %{#{@sp*i}#{v}\n} + end + else @manifest[:txt] << %{#{@sp*i}#{st}\n} + end + end + end + end + if @md.fns + id,info=@translate.sourcefile,@md.fns + metadata(id,info) + end + if @md.en[:mismatch] > 0 + id,info='WARNING document error in endnote markup, number mismatch',"endnotes: #{@md.en[:note]} != endnote reference marks: #{@md.en[:mark]} (difference = #{@md.en[:mismatch]})" + metadata(id,info) + end + if @md.wc_words + id,info=@translate.word_count,@md.wc_words + metadata(id,info) + end + if @md.dgst + id,info="#{@translate.sourcefile_digest} (#{@dg})",@md.dgst[1] + metadata(id,info) + end + if @md.sc_number + id,info=@translate.sc_number,@md.sc_number + metadata(id,info) + end + if @md.sc_date + id,info=@translate.sc_date,"#{@md.sc_date} at #{@md.sc_time}" + metadata(id,info) + end + end + def check_output(data) + begin + id,file='','' + vz=SiSU_Env::Get_init.instance.skin + @f=SiSU_Env::SiSU_file.new(@md) #.base_filename + url=@f.output_path.base.url + @en_manifest=if @env.output_dir_structure.by_language_code? + "#{url}/en/manifest/#{@md.fnb}.html" + elsif @env.output_dir_structure.by_filetype? + "#{url}/manifest/#{@md.fnb}.#{lc}.html" + else + "#{url}/sisu_manifest.#{lc}.html" + end + @manifest[:txt] <<<<WOK +#{@translate.manifest_description_metadata} + #{@brace_url.txt_open}#{@en_manifest}#{@brace_url.txt_close} +WOK + metadata_tests + @manifest[:txt_title] <<<<WOK + #{@brace_url.txt_open}#{@en_manifest}#{@brace_url.txt_close} +WOK + source_tests + @manifest[:txt] <<<<WOK +#{@translate.language_version_list} +WOK + language_versions + output_metadata + output_metadata_short + rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error + ensure + end + end + end + end +end +__END__ diff --git a/lib/sisu/v3/shared_html_lite.rb b/lib/sisu/v3/shared_html_lite.rb index fca0cfb8..0dd13a34 100644 --- a/lib/sisu/v3/shared_html_lite.rb +++ b/lib/sisu/v3/shared_html_lite.rb @@ -236,6 +236,12 @@ GSUB h={ txt: txt, class: "indent#{t}", type: 'substantive', id: @ocn } tag_para(h) end + def hang_indent(f,t) + txt=markup_object(@t_o) + h={ txt: txt, class: "hang#{f}indent#{t}", type: 'substantive', id: @ocn } + #h={ txt: txt, class: "h#{f}i#{t}", type: 'substantive', id: @ocn } + tag_para(h) + end def para_table %{<p class="norm" align="left"><font #{@vz.font_small} #{@vz.font_color} #{@vz.font_face}>} end diff --git a/lib/sisu/v3/shared_txt.rb b/lib/sisu/v3/shared_txt.rb index 6f25a06b..c81e1c37 100644 --- a/lib/sisu/v3/shared_txt.rb +++ b/lib/sisu/v3/shared_txt.rb @@ -84,8 +84,8 @@ module SiSU_text_utils line=line elsif word =~/\n\n/ word="\n" - @n_char_max_extend = @n_char_max + out[line].length - line=line + @n_char_max_extend = @n_char_max + line += 1 elsif (out[line].length + word.length) > (@n_char_max_extend - @n_indent) \ and out[line] =~/\S+/ @n_char_max_extend = @n_char_max @@ -104,7 +104,7 @@ module SiSU_text_utils end @oldword=word if word =~/\S+/ end - x=out.join(spaces_indent).gsub(/\A\n+/m,'').insert(0,spaces_hang) + spaces_hang + out.join(spaces_indent) end def line_wrap_indent1 @n_indent,@n_hang=2,2 diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index d709cd52..30ff2e9b 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -696,28 +696,39 @@ module SiSU_Env end def relaxng(cmd='') #trang - convert between different schema languages for XML program='trang' - program_ref="\n\t\tsee http://www.thaiopensource.com/relaxng/trang.html" + program_ref="\n\t\tsee <http://www.thaiopensource.com/relaxng/trang.html>" if program_found?(program); system("trang #{@input} #{@output}") else puts "\tWARN: #{program} is not installed #{program_ref}" if cmd =~/V/ end end + def qrencode #qrcode - for generating QR code + program='qrencode' + program_ref="\n\t\tsee <http://megaui.net/fukuchi/works/qrencode/index.en.html>" + found=(program_found?(program)) ? true : false + found \ + ? (system(%{ + echo "#{@input}" | #{program} -s 3 -o #{@output} + })) \ + : (puts "\tWARN: #{program} is not installed #{program_ref}" if cmd =~/V/) + #found + end def imagemagick #imagemagick is a image manipulation program program='identify' - program_ref="\n\t\tsee http://www.imagemagick.org/" + program_ref="\n\t\tsee <http://www.imagemagick.org/>" found=(program_found?(program)) ? true : false puts "\tWARN: #{program} is not installed #{program_ref}" unless found found end def graphicksmagick #graphicsmagick is a image manipulation program program='gm' - program_ref="\n\t\tsee http://www.graphicsmagick.org/" + program_ref="\n\t\tsee <http://www.graphicsmagick.org/>" found=(program_found?(program)) ? true : false puts "\tWARN: #{program} is not installed #{program_ref}" unless found found end def well_formed? #tidy - check for well formed xml xhtml etc. program=@prog.tidy - program_ref="\n\t\tsee http://tidy.sourceforge.net/" + program_ref="\n\t\tsee <http://tidy.sourceforge.net/>" if program_found?(program); system("#{@prog.tidy} -xml #{@input} > #{@output}") else puts "\tWARN: #{program} is not installed #{program_ref}" end @@ -741,8 +752,7 @@ module SiSU_Env end def latex2pdf(md,papersize='a4') #convert from latex to pdf tell=((@cmd =~/[MVv]/) ? '' : '> /dev/null' ) - mode='batchmode' - #mode='nonstopmode' + mode='batchmode' #mode='nonstopmode' program_ref="\n\t\tSee http://www.tug.org/applications/pdftex/\n\t\tOn Debian this is is included in tetex-extra" texpdf=tex2pdf_engine if @pdfetex_flag; @@ -2142,20 +2152,10 @@ WOK #end def images_local if FileTest.directory?(path.image_source_include) - if @@image_flag - images=Dir.glob("#{path.image_source_include}/*.{png,jpg,gif}") - pth="#{path.webserv}/#{@stub_pwd}" - mkdir_p("#{pth}/_sisu/image") unless FileTest.directory?("#{pth}/_sisu/image") - images.each { |i| File.install(i,"#{pth}/#{i}") } unless images.length > 0 - @@image_flag=false - end path.image_source_include -# "#{Xx[:html_relative2]}/_sisu/image" else if @@local_image==true - cmd=if @cmd; @cmd - else '' - end + cmd=@cmd ? @cmd : '' SiSU_Screen::Ansi.new(cmd,"WARNING - no local image directory or images:", defaults[:image_local] ).warn unless cmd =~/q/ @@local_image=false end @@ -2415,7 +2415,7 @@ WOK and not (@rc['flag']['default'].nil? \ or @rc['flag']['default'].empty?) @rc['flag']['default'] - else '-NhwepoabxXyYv' + else '-NQhewpotbxXyYv' end end def cf_1 #processing flag shortcuts @@ -2423,7 +2423,7 @@ WOK and not (@rc['flag']['i'].nil? \ or @rc['flag']['i'].empty?) @rc['flag']['i'] - else '-hwepoay' + else '-Qhewpoty' end end def cf_2 #processing flag shortcuts @@ -2431,7 +2431,7 @@ WOK and not (@rc['flag']['ii'].nil? \ or @rc['flag']['ii'].empty?) @rc['flag']['ii'] - else '-NhwepoabxXy' + else '-NQhewpotbxXy' end end def cf_3 #processing flag shortcuts @@ -2439,7 +2439,7 @@ WOK and not (@rc['flag']['iii'].nil? \ or @rc['flag']['iii'].empty?) @rc['flag']['iii'] - else '-NhwepoabxXyY' + else '-NQhewpotbxXyY' end end def cf_4 #processing flag shortcuts @@ -2447,7 +2447,7 @@ WOK and not (@rc['flag']['iv'].nil? \ or @rc['flag']['iv'].empty?) @rc['flag']['iv'] - else '-NhwepoabxXDyY --update' + else '-NQhewpotbxXDyY --update' end end def cf_5 #processing flag shortcuts @@ -2455,7 +2455,7 @@ WOK and not (@rc['flag']['v'].nil? \ or @rc['flag']['v'].empty?) @rc['flag']['v'] - else '-NhwepoabxXDyYv --update' + else '-NQhewpotbxXDyYv --update' end end end @@ -3282,6 +3282,12 @@ WOK fn=base_filename.manifest make_file(path,fn) end + def manifest_txt + path=output_path.manifest.dir + make_path(path) + fn=base_filename.manifest_txt + make_file(path,fn) + end def pot path=output_path.pot.dir make_path(path) @@ -3675,6 +3681,16 @@ WOK 'sitemap' + @md.lang_code_insert + ft end end + def manifest_txt + ft='.txt' + if @env.output_dir_structure.by_language_code? + @md.fnb + ft + elsif @env.output_dir_structure.by_filetype? + @md.fnb + @md.lang_code_insert + ft + else #fix + 'sisu_manifest' + @md.lang_code_insert + ft + end + end def manifest ft='.html' if @env.output_dir_structure.by_language_code? diff --git a/lib/sisu/v3/texpdf.rb b/lib/sisu/v3/texpdf.rb index 522480fd..9e223920 100644 --- a/lib/sisu/v3/texpdf.rb +++ b/lib/sisu/v3/texpdf.rb @@ -183,7 +183,7 @@ module SiSU_TeX when /legal/; pdf_p=@f.pdf_p_legal; pdf_l=@f.pdf_l_legal else pdf_p=@f.pdf_p_a4; pdf_l=@f.pdf_l_a4 end - Dir.mkdir(@md.file.output_path.pdf.dir) unless FileTest.directory?(@md.file.output_path.pdf.dir) + mkdir_p(@md.file.output_path.pdf.dir) unless FileTest.directory?(@md.file.output_path.pdf.dir) if FileTest.file?(portrait_pdf) cp(portrait_pdf,"#{@md.file.output_path.pdf.dir}/#{pdf_p}") rm(portrait_pdf) @@ -515,8 +515,14 @@ module SiSU_TeX if dob.bullet_ dob.tmp=tst.bullet elsif dob.indent \ - and dob.indent =~/[1-9]/ + and dob.hang \ + and dob.indent =~/[1-9]/ \ + and dob.indent == dob.hang dob.tmp=tst.indent + elsif dob.hang \ + and dob.hang =~/[0-9]/ \ + and (dob.indent != dob.hang or dob.indent =~/[1-9]/) + dob.tmp=tst.hang else dob.tmp.strip! dob=enclose(dob) unless dob.tmp =~/^$/ diff --git a/lib/sisu/v3/texpdf_format.rb b/lib/sisu/v3/texpdf_format.rb index d7942121..76f0630a 100644 --- a/lib/sisu/v3/texpdf_format.rb +++ b/lib/sisu/v3/texpdf_format.rb @@ -293,6 +293,141 @@ module SiSU_TeX_Pdf # '\subsubsection*{\1}') dob end + def hang + case @dob.indent + when /0/ + case @dob.hang + when /0/; indent,hang='0mm', '0mm' + when /1/; indent,hang='0mm','10mm' + when /2/; indent,hang='0mm','20mm' + when /3/; indent,hang='0mm','30mm' + when /4/; indent,hang='0mm','40mm' + when /5/; indent,hang='0mm','50mm' + when /6/; indent,hang='0mm','60mm' + when /7/; indent,hang='0mm','70mm' + when /8/; indent,hang='0mm','80mm' + when /9/; indent,hang='0mm','90mm' + end + when /1/ + case @dob.hang + when /0/; indent,hang='10mm','-10mm' + when /1/; indent,hang='10mm', '0mm' + when /2/; indent,hang='10mm', '10mm' + when /3/; indent,hang='10mm', '20mm' + when /4/; indent,hang='10mm', '30mm' + when /5/; indent,hang='10mm', '40mm' + when /6/; indent,hang='10mm', '50mm' + when /7/; indent,hang='10mm', '60mm' + when /8/; indent,hang='10mm', '70mm' + when /9/; indent,hang='10mm', '80mm' + end + when /2/ + case @dob.hang + when /0/; indent,hang='20mm','-20mm' + when /1/; indent,hang='20mm','-10mm' + when /2/; indent,hang='20mm', '0mm' + when /3/; indent,hang='20mm', '10mm' + when /4/; indent,hang='20mm', '20mm' + when /5/; indent,hang='20mm', '30mm' + when /6/; indent,hang='20mm', '40mm' + when /7/; indent,hang='20mm', '50mm' + when /8/; indent,hang='20mm', '60mm' + when /9/; indent,hang='20mm', '70mm' + end + when /3/ + case @dob.hang + when /0/; indent,hang='30mm','-30mm' + when /1/; indent,hang='30mm','-20mm' + when /2/; indent,hang='30mm','-10mm' + when /3/; indent,hang='30mm', '0mm' + when /4/; indent,hang='30mm', '10mm' + when /5/; indent,hang='30mm', '20mm' + when /6/; indent,hang='30mm', '30mm' + when /7/; indent,hang='30mm', '40mm' + when /8/; indent,hang='30mm', '50mm' + when /9/; indent,hang='30mm', '60mm' + end + when /4/ + case @dob.hang + when /0/; indent,hang='40mm','-40mm' + when /1/; indent,hang='40mm','-30mm' + when /2/; indent,hang='40mm','-20mm' + when /3/; indent,hang='40mm','-10mm' + when /4/; indent,hang='40mm', '0mm' + when /5/; indent,hang='40mm', '10mm' + when /6/; indent,hang='40mm', '20mm' + when /7/; indent,hang='40mm', '30mm' + when /8/; indent,hang='40mm', '40mm' + when /9/; indent,hang='40mm', '50mm' + end + when /5/ + case @dob.hang + when /0/; indent,hang='50mm','-50mm' + when /1/; indent,hang='50mm','-40mm' + when /2/; indent,hang='50mm','-30mm' + when /3/; indent,hang='50mm','-20mm' + when /4/; indent,hang='50mm','-10mm' + when /5/; indent,hang='50mm', '0mm' + when /6/; indent,hang='50mm', '10mm' + when /7/; indent,hang='50mm', '20mm' + when /8/; indent,hang='50mm', '30mm' + when /9/; indent,hang='50mm', '40mm' + end + when /6/ + case @dob.hang + when /0/; indent,hang='60mm','-60mm' + when /1/; indent,hang='60mm','-50mm' + when /2/; indent,hang='60mm','-40mm' + when /3/; indent,hang='60mm','-30mm' + when /4/; indent,hang='60mm','-20mm' + when /5/; indent,hang='60mm','-10mm' + when /6/; indent,hang='60mm', '0mm' + when /7/; indent,hang='60mm', '10mm' + when /8/; indent,hang='60mm', '20mm' + when /9/; indent,hang='60mm', '30mm' + end + when /7/ + case @dob.hang + when /0/; indent,hang='70mm','-70mm' + when /1/; indent,hang='70mm','-60mm' + when /2/; indent,hang='70mm','-50mm' + when /3/; indent,hang='70mm','-40mm' + when /4/; indent,hang='70mm','-30mm' + when /5/; indent,hang='70mm','-20mm' + when /6/; indent,hang='70mm','-10mm' + when /7/; indent,hang='70mm', '0mm' + when /8/; indent,hang='70mm', '10mm' + when /9/; indent,hang='70mm', '20mm' + end + when /8/ + case @dob.hang + when /0/; indent,hang='80mm','-80mm' + when /1/; indent,hang='80mm','-70mm' + when /2/; indent,hang='80mm','-60mm' + when /3/; indent,hang='80mm','-50mm' + when /4/; indent,hang='80mm','-40mm' + when /5/; indent,hang='80mm','-30mm' + when /6/; indent,hang='80mm','-20mm' + when /7/; indent,hang='80mm','-10mm' + when /8/; indent,hang='80mm', '0mm' + when /9/; indent,hang='80mm', '10mm' + end + when /9/ + case @dob.hang + when /0/; indent,hang='90mm','-90mm' + when /1/; indent,hang='90mm','-80mm' + when /2/; indent,hang='90mm','-70mm' + when /3/; indent,hang='90mm','-60mm' + when /4/; indent,hang='90mm','-50mm' + when /5/; indent,hang='90mm','-40mm' + when /6/; indent,hang='90mm','-30mm' + when /7/; indent,hang='90mm','-20mm' + when /8/; indent,hang='90mm','-10mm' + when /9/; indent,hang='90mm', '0mm' + end + end + "\\begin{ParagraphHang}{#{indent}}{#{hang}}#{@dob.tmp} \\end{ParagraphHang}}" + end def indent indent=case @dob.indent when /1/; '0mm' @@ -636,10 +771,20 @@ module SiSU_TeX_Pdf end def tex_head_lang #babel 18n lang_char_arr=@md.i18n - mainlang_char=lang_char_arr.slice(0) + mainlang_char=if @md.i18n == Array \ + and @md.i18n.length > 0 + lang_char_arr.slice(0) + else @md.opt.lng + end mainlang=@lang.list[mainlang_char][:xlp] - otherlang=[] - lang_char_arr.slice(1..9).each { |ch| otherlang << @lang.list[ch][:xlp] } + otherlang=if mainlang != 'english' + [ @lang.list['en'][:xlp] ] + else [] + end + if lang_char_arr.length > 0 + lang_char_arr.slice(1..9).each { |ch| otherlang << @lang.list[ch][:xlp] } + otherlang.uniq! + end otherlang=otherlang.join(',') { mainlang: mainlang, otherlang: otherlang } end @@ -918,6 +1063,19 @@ WOK \\item[] } {\\end{list}} + +\\newenvironment{ParagraphHang}[2]% +{ +\\begin{list}{}{% +\\setlength\\topsep{0pt}% +\\addtolength{\\leftmargin}{#1} +\\itemindent=#2 +\\setlength\\parsep{0pt plus 1pt}% +} +\\item[] +} +{\\end{list}} + \\newenvironment{Bullet}[1]% { \\begin{list}{}{% diff --git a/lib/sisu/v3/urls.rb b/lib/sisu/v3/urls.rb index 2e73a91f..d5698b53 100644 --- a/lib/sisu/v3/urls.rb +++ b/lib/sisu/v3/urls.rb @@ -118,7 +118,7 @@ module SiSU_urls 'X --xml-dom (XML dom type)'=>@fn[:dom], 'y --manifest (Manifest, html)'=>@fn[:manifest], 'Y (Sitemap, xml)'=>@fn[:sitemap], - 'w -concordance (Concordance, html)'=>@fn[:concordance], + 'w --concordance (Concordance, html)'=>@fn[:concordance], }.sort {|a,b| a[0].downcase<=>b[0].downcase} end def songsheet diff --git a/lib/sisu/v3/xhtml.rb b/lib/sisu/v3/xhtml.rb index ba8238d2..569b1dc3 100644 --- a/lib/sisu/v3/xhtml.rb +++ b/lib/sisu/v3/xhtml.rb @@ -107,7 +107,7 @@ module SiSU_XHTML def song begin SiSU_XHTML::Source::Scroll.new(@particulars).songsheet - SiSU_XHTML::Source::Tidy.new(@md,@env).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use + SiSU_XHTML::Source::Tidy.new(@md,@file.place_file.xhtml.dir).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use SiSU_Rexml::Rexml.new(@md,@file.place_file.xhtml.dir).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error ensure @@ -321,8 +321,13 @@ WOK and dob.bullet_==true xml_structure(dob,"indent_bullet#{dob.indent}") elsif dob.is =='para' \ - and dob.indent.to_s =~/[1-9]/ + and dob.indent.to_s =~/[1-9]/ \ + and dob.indent == dob.hang xml_structure(dob,"indent#{dob.indent}") + 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}") else xml_structure(dob) end end @@ -395,8 +400,8 @@ WOK end end class Tidy - def initialize(md,dir) - @md,@env=md,dir + def initialize(md,file) + @md,@file=md,file @prog=SiSU_Env::Info_program.new end def xml @@ -408,7 +413,7 @@ WOK tell.grey_open end tidyfile='/dev/null' #don't want one or screen output, check for alternative flags - tidy=SiSU_Env::System_call.new("#{@env.path.output}/#{@md.fnb}/#{@md.fn[:xhtml]}",tidyfile) + tidy=SiSU_Env::System_call.new(@file,tidyfile) tidy.well_formed? tell.p_off unless @md.opt.cmd =~/q/ end diff --git a/lib/sisu/v3/xml.rb b/lib/sisu/v3/xml.rb index 23cfb5bc..73e9345c 100644 --- a/lib/sisu/v3/xml.rb +++ b/lib/sisu/v3/xml.rb @@ -107,7 +107,7 @@ module SiSU_XML_SAX def song begin SiSU_XML_SAX::Source::Scroll.new(@particulars).songsheet - SiSU_XML_SAX::Source::Tidy.new(@md,@env).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use + SiSU_XML_SAX::Source::Tidy.new(@md,@file.place_file.xml_sax.dir).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use SiSU_Rexml::Rexml.new(@md,@file.place_file.xml_sax.dir).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error ensure @@ -346,8 +346,13 @@ WOK and dob.bullet_==true xml_structure(dob,"indent_bullet#{dob.indent}") elsif dob.is =~ /^para/ \ - and dob.indent.to_s =~/[1-9]/ + and dob.indent.to_s =~/[1-9]/ \ + and dob.indent == dob.hang xml_structure(dob,"indent#{dob.indent}") + 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}") else xml_structure(dob) end end @@ -437,8 +442,8 @@ WOK end end class Tidy - def initialize(md,dir) - @md,@env=md,dir + def initialize(md,file) + @md,@file=md,file @prog=SiSU_Env::Info_program.new end def xml @@ -450,7 +455,7 @@ WOK tell.grey_open end tidyfile='/dev/null' #don't want one or screen output, check for alternative flags - tidy=SiSU_Env::System_call.new("#{@env.path.output}/#{@md.fnb}/#{@md.fn[:sax]}",tidyfile) + tidy=SiSU_Env::System_call.new(@file,tidyfile) tidy.well_formed? tell.p_off unless @md.opt.cmd =~/q/ end diff --git a/lib/sisu/v3/xml_dom.rb b/lib/sisu/v3/xml_dom.rb index 22b11ebc..664bccdc 100644 --- a/lib/sisu/v3/xml_dom.rb +++ b/lib/sisu/v3/xml_dom.rb @@ -104,7 +104,7 @@ module SiSU_XML_DOM def songsheet begin SiSU_XML_DOM::Source::Scroll.new(@particulars).songsheet - SiSU_XML_DOM::Source::Tidy.new(@md,@env).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use + SiSU_XML_DOM::Source::Tidy.new(@md,@file.place_file.xml_dom.dir).xml if @md.opt.cmd =~/[vVM]/ # test wellformedness, comment out when not in use SiSU_Rexml::Rexml.new(@md,@file.place_file.xml_dom.dir).xml if @md.opt.cmd =~/M/ # test rexml parsing, comment out when not in use #debug rescue; SiSU_Errors::Info_error.new($!,$@,@md.opt.cmd,@md.fns).error ensure @@ -412,9 +412,15 @@ WOK type="indent_bullet#{dob.indent.to_s}" xml_markup(dob) elsif dob.is=='para' \ - and dob.indent.to_s =~/[1-9]/ + 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' \ + and dob.hang.to_s =~/[0-9]/ \ + and dob.indent != dob.hang + type="hang#{dob.hang.to_s}_indent#{dob.indent.to_s}" + xml_markup(dob) else type='norm' xml_markup(dob) @@ -513,8 +519,8 @@ WOK end end class Tidy - def initialize(md,dir) - @md,@env=md,dir + def initialize(md,file) + @md,@file=md,file @prog=SiSU_Env::Info_program.new end def xml @@ -524,7 +530,7 @@ WOK tell=SiSU_Screen::Ansi.new(@md.opt.cmd,'invert','','') tell.grey_open unless @md.opt.cmd =~/q/ tidyfile='/dev/null' #don't want one or screen output, check for alternative flags - tidy=SiSU_Env::System_call.new("#{@env.path.output}/#{@md.fnb}/#{@md.fn[:dom]}",tidyfile) + tidy=SiSU_Env::System_call.new(@file,tidyfile) tidy.well_formed? tell.p_off unless @md.opt.cmd =~/q/ end |