diff options
Diffstat (limited to 'lib/sisu/v1')
-rw-r--r-- | lib/sisu/v1/cgi_pgsql.rb | 14 | ||||
-rw-r--r-- | lib/sisu/v1/cgi_sql_common.rb | 93 | ||||
-rw-r--r-- | lib/sisu/v1/cgi_sqlite.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v1/constants.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v1/css.rb | 17 | ||||
-rw-r--r-- | lib/sisu/v1/dal_doc_str.rb | 1 | ||||
-rw-r--r-- | lib/sisu/v1/dal_images.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v1/dal_substitutions_and_insertions.rb | 73 | ||||
-rw-r--r-- | lib/sisu/v1/dal_syntax.rb | 16 | ||||
-rw-r--r-- | lib/sisu/v1/db_import.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v1/harvest_authors.rb | 39 | ||||
-rw-r--r-- | lib/sisu/v1/harvest_topics.rb | 72 | ||||
-rw-r--r-- | lib/sisu/v1/help.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v1/manpage.rb | 5 | ||||
-rw-r--r-- | lib/sisu/v1/param.rb | 199 | ||||
-rw-r--r-- | lib/sisu/v1/sst_from_kdissert.rb | 4 | ||||
-rw-r--r-- | lib/sisu/v1/sst_to_s_xml_dom.rb | 27 | ||||
-rw-r--r-- | lib/sisu/v1/sst_to_s_xml_node.rb | 33 | ||||
-rw-r--r-- | lib/sisu/v1/sysenv.rb | 15 |
19 files changed, 335 insertions, 287 deletions
diff --git a/lib/sisu/v1/cgi_pgsql.rb b/lib/sisu/v1/cgi_pgsql.rb index 4f201dfa..f6f62bfb 100644 --- a/lib/sisu/v1/cgi_pgsql.rb +++ b/lib/sisu/v1/cgi_pgsql.rb @@ -153,11 +153,11 @@ module SiSU_CGI_pgsql end search_construct=[] if @c - unescaped_search.gsub!(/\s*(AND|OR)\s*/,"' \) \\1 #@l~\( '") - unescaped_search.gsub!(/(.+)/,"#@l~\( '\\1' \)") + unescaped_search.gsub!(/\s*(AND|OR)\s*/,"' \) \\1 #{@l}~\( '") + unescaped_search.gsub!(/(.+)/,"#{@l}~\( '\\1' \)") else - unescaped_search.gsub!(/\s*(AND|OR)\s*/,"' \) \\1 #@l~*\( '") - unescaped_search.gsub!(/(.+)/,"#@l~*\( '\\1' \)") + unescaped_search.gsub!(/\s*(AND|OR)\s*/,"' \) \\1 #{@l}~*\( '") + unescaped_search.gsub!(/(.+)/,"#{@l}~*\( '\\1' \)") end search_construct << unescaped_search search_construct=search_construct.join(' ') @@ -188,7 +188,7 @@ module SiSU_CGI_pgsql def sql_select_body limit ||=@@limit offset ||=@@offset - @sql_statement[:body]=%{SELECT metadata.title, metadata.subtitle, metadata.creator, metadata.filename, metadata.suffix, documents.body, documents.seg, documents.ocn, metadata.tid FROM documents, metadata WHERE (#@search_text) AND documents.metadata_tid = metadata.tid ORDER BY metadata.title, metadata.filename, documents.ocn} + @sql_statement[:body]=%{SELECT metadata.title, metadata.subtitle, metadata.creator, metadata.filename, metadata.suffix, documents.body, documents.seg, documents.ocn, metadata.tid FROM documents, metadata WHERE (#{@search_text}) AND documents.metadata_tid = metadata.tid ORDER BY metadata.title, metadata.filename, documents.ocn} @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} select=@sql_statement[:body] + ' ' + @sql_statement[:range] select @@ -196,7 +196,7 @@ module SiSU_CGI_pgsql def sql_select_endnotes limit ||=@@limit offset ||=@@offset - @sql_statement[:endnotes]=%{SELECT metadata.title, metadata.subtitle, metadata.creator, metadata.filename, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata, endnotes WHERE (#@search_endnotes) AND metadata.tid = endnotes.metadata_tid ORDER BY metadata.title, metadata.filename, endnotes.nr} + @sql_statement[:endnotes]=%{SELECT metadata.title, metadata.subtitle, metadata.creator, metadata.filename, endnotes.body, endnotes.nr, endnotes.ocn, endnotes.metadata_tid FROM metadata, endnotes WHERE (#{@search_endnotes}) AND metadata.tid = endnotes.metadata_tid ORDER BY metadata.title, metadata.filename, endnotes.nr} @sql_statement[:range]=%{LIMIT #{limit} OFFSET #{offset} ;} select=@sql_statement[:endnotes] + ' ' + @sql_statement[:range] select @@ -218,7 +218,7 @@ module SiSU_CGI_pgsql end def buttons1_pgsql <<-'WOK_SQL' - <input type="checkbox" name="casesense" #@checked_case> case sensitive + <input type="checkbox" name="casesense" #{@checked_case}> case sensitive WOK_SQL end def dbi_connect diff --git a/lib/sisu/v1/cgi_sql_common.rb b/lib/sisu/v1/cgi_sql_common.rb index bd0b38a5..5138e311 100644 --- a/lib/sisu/v1/cgi_sql_common.rb +++ b/lib/sisu/v1/cgi_sql_common.rb @@ -129,7 +129,7 @@ module SiSU_CGI_sql <<-'WOK_SQL' #Common TOP @@limit,@@offset=1000,0 - @base="#@hosturl_db/cgi-bin/#@version.cgi" + @base="#{@hosturl_db}/cgi-bin/#{@version}.cgi" @@canned_search_url=@base @color_heading='#DDFFAA' @color_match='#ffff48' @@ -160,12 +160,12 @@ module SiSU_CGI_sql <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <meta name="sourcefile" content="SiSU._sst" /> <link rel="generator" href="http://www.jus.uio.no/sisu" /> - <link rel="shortcut icon" href="#@image_src/rb7.ico" /> + <link rel="shortcut icon" href="#{@image_src}/rb7.ico" /> <link rel="stylesheet" href="../_sisu/css/html.css" type="text/css" /> </head> <body bgcolor="#ffffff" text="#000000" link="#003090" lang="en" xml:lang="en"> <table summary="band" border="0" cellpadding="3" cellspacing="0"> - <tr><td align="left" bgcolor="#ffffff"><a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" src="#@image_src/sisu.png" alt="SiSU -->" /></a></td><td> + <tr><td align="left" bgcolor="#ffffff"><a href="http://www.jus.uio.no/sisu/" target="_top"><img border="0" src="#{@image_src}/sisu.png" alt="SiSU -->" /></a></td><td> <!-- <p class="tiny"><a href="http://www.jus.uio.no/sisu/SiSU/"> http://www.jus.uio.no/sisu/SiSU/</a></p> --> <label for="find"><b>#{@env.sample_search_form_title}</b></label> </td></tr> @@ -174,49 +174,49 @@ module SiSU_CGI_sql end def header2 <<-'WOK_SQL' - <form action="#@base" id="Test Form" method="post"> + <form action="#{@base}" id="Test Form" method="post"> <table cellpadding="2"> <tr><td valign=\"top\"> - <textarea id="find" name="find" type="text" rows="6" cols="40" maxlength="256">#@search_field</textarea> + <textarea id="find" name="find" type="text" rows="6" cols="40" maxlength="256">#{@search_field}</textarea> </td> <td valign=\"top\"> - #@tip - #@search_note - #@the_can + #{@tip} + #{@search_note} + #{@the_can} </td></tr></table> <td valign=\"top\"><tr><td> - <!input type="text" id="find" name="find" value="#@search_field" /> + <!input type="text" id="find" name="find" value="#{@search_field}" /> <!input type="text" id="find" name="find" value="" /> <font size="2" color="#222222"> <b>to search:</b> select which database to search (drop-down menu below); enter your search query (in the form above); and <b>click on the search button</b> (below) <br /> <select name="db" size="1"> - #@selected_db + #{@selected_db} WOK_SQL end def buttons1 <<-'WOK_SQL' </select> <input type="submit" value="SiSU search" /> - <input type="radio" name="view" value="index" #@checked_index> index - <input type="radio" name="view" value="text" #@checked_text> text / grep + <input type="radio" name="view" value="index" #{@checked_index}> index + <input type="radio" name="view" value="text" #{@checked_text}> text / grep WOK_SQL end def buttons2 <<-'WOK_SQL' <br /> - <input type="checkbox" name="echo" #@checked_echo> echo query - <input type="checkbox" name="stats" #@checked_stats> result stats - <input type="checkbox" name="url" #@checked_url> search url - <input type="checkbox" name="searched" #@checked_searched> searched - <input type="checkbox" name="tip" #@checked_tip> available fields - <input type="checkbox" name="sql" #@checked_sql> sql statement + <input type="checkbox" name="echo" #{@checked_echo}> echo query + <input type="checkbox" name="stats" #{@checked_stats}> result stats + <input type="checkbox" name="url" #{@checked_url}> search url + <input type="checkbox" name="searched" #{@checked_searched}> searched + <input type="checkbox" name="tip" #{@checked_tip}> available fields + <input type="checkbox" name="sql" #{@checked_sql}> sql statement <br /> checks: - <input type="radio" name="checks" value="check_default" #@checked_default> default - <input type="radio" name="checks" value="check_selected" #@checked_selected> selected - <input type="radio" name="checks" value="check_all" #@checked_all> all - <input type="radio" name="checks" value="check_none" #@checked_none> none + <input type="radio" name="checks" value="check_default" #{@checked_default}> default + <input type="radio" name="checks" value="check_selected" #{@checked_selected}> selected + <input type="radio" name="checks" value="check_all" #{@checked_all}> all + <input type="radio" name="checks" value="check_none" #{@checked_none}> none </font> </td></tr> </table> @@ -285,8 +285,9 @@ module SiSU_CGI_sql @date_modified=q['dtm'] if q['dtm']=~/\S/ @date_available=q['dta'] if q['dta']=~/\S/ @date_valid=q['dtv'] if q['dtv']=~/\S/ - @filename=q['fns'] if q['fns']=~/\S/ - @filename=q['doc'] if q['search'] !~/search db/ + @filename=if q['doc'] and q['search'] !~/search db/; q['doc'] + elsif q['fns']=~/\S/; q['fns']· + end @@limit=q['ltd'] if q['ltd']=~/\d+/ # 1000 @@offset=q['off'] if q['off']=~/\d+/ # 0 end @@ -525,7 +526,7 @@ module SiSU_CGI_sql <tr><td valign="top" width="10%"> <p class="tiny_left"><font color="#666666" size="2"> <a href="http://www.jus.uio.no/sisu" > - <img border="0" src="#@image_src/sisu.png" alt="SiSU" width="120" height="39" /> + <img border="0" src="#{@image_src}/sisu.png" alt="SiSU" width="120" height="39" /> </a> </font></p> </td><td valign="top" width="45%"> @@ -572,7 +573,7 @@ module SiSU_CGI_sql <tr><td valign="top" width="10%"> <p class="tiny_left"><font color="#666666" size="2"> <a href="http://www.gnu.org/licenses/gpl.html"> - <img border="0" src="#@image_src/gplv3_free_software.png" alt="GPLv3" width="127" height="51" /> + <img border="0" src="#{@image_src}/gplv3_free_software.png" alt="GPLv3" width="127" height="51" /> </a> </font></p> </td><td valign="top" width="45%"> @@ -692,10 +693,10 @@ 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=if checked_all =~/checked/ - "#@base?#{s1}#{key}#{ti}#{au}#{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" - else "#@base?#{s1}#{key}#{ti}#{au}#{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}#{key}#{ti}#{au}#{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" + else "#{@base}?#{s1}#{key}#{ti}#{au}#{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']}" end - @canned_base_url="#@base?#{s1}&db=#{cgi['db']}" + @canned_base_url="#{@base}?#{s1}&db=#{cgi['db']}" if checked_case=~/\S/ @search[:text][1]=%{documents.clean~'#{@search_for.text1}'} #s1 @search[:endnotes][1]=%{endnotes.clean~'#{@search_for.text1}'} #s1 @@ -705,7 +706,7 @@ module SiSU_CGI_sql end canned_note='search url:' else - @@canned_search_url="#@base?db=#{@db}&view=index" + @@canned_search_url="#{@base}?db=#{@db}&view=index" canned_note='search url example:' end if search_field =~/\S+/ @@ -748,7 +749,7 @@ module SiSU_CGI_sql p_filename=%{filename: #{green}#{@search_for.filename}</font><br />} if @search_for.filename =~/\S+/ search_note=<<-WOK <font size="2" color="#666666"> - <b>database:</b> #{green}#@db</font>; <b>selected view:</b> #{green}#{cgi['view']}</font> + <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_keywords} #{p_title} #{p_author} #{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} </font> @@ -805,10 +806,10 @@ module SiSU_CGI_sql ti=if c['subtitle'] =~/\S+/; "#{c['title']} - #{c['subtitle']}" else c['title'] end - can_txt_srch=if cgi['view']=~/index/; %{<a href="#{@canned_base_url}&fns=#{c['filename']}&view=text"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } - else %{<a href="#{@canned_base_url}&fns=#{c['filename']}&view=index"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } + can_txt_srch=if cgi['view']=~/index/; %{<a href="#{@canned_base_url}&fns=#{c['filename']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } + else %{<a href="#{@canned_base_url}&fns=#{c['filename']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } end - title=%{<span style="background-color: #@color_heading"><a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"> #{ti}</a></span> by #{c['creator']} #{can_txt_srch}<a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"></a> <a href="#@hosturl_files/#@stub/#{location}/portrait#{lang}.pdf"><img border="0" width="15" height="18" src="#@image_src/b_pdf.png" alt="pdf portrait"></a> <a href="#@hosturl_files/#@stub/#{location}/landscape#{lang}.pdf"><img border="0" width="18" height="15" src="#@image_src/b_pdf.png" alt="pdf landscape"></a> <a href="#@hosturl_files/#@stub/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#@image_src/b_odf.png" alt="odf"></a> <a href="#@hosturl_files/#@stub/#{location}/sisu_manifest#{lang}.html"><img border="0" width="15" height="15" src="#@image_src/b_info.png" alt="manifest"></a><br />} if file_suffix=~/s/ #hmm watch file_suffix + title=%{<span style="background-color: #{@color_heading}"><a href="#{@hosturl_files}/#{@stub}/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"> #{ti}</a></span> by #{c['creator']} #{can_txt_srch}<a href="#{@hosturl_files}/#{@stub}/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"></a> <a href="#{@hosturl_files}/#{@stub}/#{location}/portrait#{lang}.pdf"><img border="0" width="15" height="18" src="#{@image_src}/b_pdf.png" alt="pdf portrait"></a> <a href="#{@hosturl_files}/#{@stub}/#{location}/landscape#{lang}.pdf"><img border="0" width="18" height="15" src="#{@image_src}/b_pdf.png" alt="pdf landscape"></a> <a href="#{@hosturl_files}/#{@stub}/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#{@image_src}/b_odf.png" alt="odf"></a> <a href="#{@hosturl_files}/#{@stub}/#{location}/sisu_manifest#{lang}.html"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a><br />} if file_suffix=~/s/ #hmm watch file_suffix if @text_search_flag; title='<br /><hr>'+title else title='<br />'+title end @@ -844,10 +845,10 @@ module SiSU_CGI_sql else nil end matched_para=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) - matched=c['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#@search_regx)/mi,%{<span style="background-color: #@color_match">\\1</span>}) + matched=c['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>}) else c['body'] end - %{<hr><p><font size="2">ocn <b><a href="#@hosturl_files/#@stub/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a></b>:</font></p>#{matched_para}} + %{<hr><p><font size="2">ocn <b><a href="#{@hosturl_files}/#{@stub}/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a></b>:</font></p>#{matched_para}} elsif c['suffix'] =~/1/ #doc %{#{title}<hr><p><font size="2">ocn #{c['ocn']}:#{c['body']}} end @@ -857,9 +858,9 @@ module SiSU_CGI_sql end else #elsif cgi['view']=~/index/ #% idx body if c['suffix'] !~/1/ #seg - index=%{<a href="#@hosturl_files/#@stub/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, } if @text_search_flag + index=%{<a href="#{@hosturl_files}/#{@stub}/#{location}/#{c['seg']}#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, } if @text_search_flag elsif c['suffix'] =~/1/ #doc - index=%{<a href="#@hosturl_files/#@stub/#{location}/doc#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, } + index=%{<a href="#{@hosturl_files}/#{@stub}/#{location}/doc#{lang}.html##{c['ocn']}">#{c['ocn']}</a>, } end if c['seg'] =~/\S+/ if @text_search_flag @@ -884,7 +885,7 @@ module SiSU_CGI_sql over='' false end - %{<hr /><font size="2" color="#666666">Found in the main body of #@counter_txt_doc documents, and at #{over} #@counter_txt_ocn locations within.</font><br />} + %{<hr /><font size="2" color="#666666">Found in the main body of #{@counter_txt_doc} documents, and at #{over} #{@counter_txt_ocn} locations within.</font><br />} else '' end else '' @@ -908,10 +909,10 @@ module SiSU_CGI_sql ti=if e['subtitle'] =~/\S+/; "#{e['title']} - #{e['subtitle']}" else e['title'] end - can_txt_srch=if cgi['view']=~/index/; %{<a href="#{@canned_base_url}&fns=#{e['filename']}&view=text"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } - else %{<a href="#{@canned_base_url}&fns=#{e['filename']}&view=index"><img border="0" width="12" height="12" src="#@image_src/bullet_red.png" alt="red bullet"></a> } + can_txt_srch=if cgi['view']=~/index/; %{<a href="#{@canned_base_url}&fns=#{e['filename']}&view=text"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } + else %{<a href="#{@canned_base_url}&fns=#{e['filename']}&view=index"><img border="0" width="24" height="16" src="#{@image_src}/b_search.png" alt="search"></a> } end - title=%{<br /><hr><span style="background-color: #@color_heading"><a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"> #{ti}</a></span> by #{e['creator']} #{can_txt_srch}<a href="#@hosturl_files/#@stub/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#@image_src/b_toc.png" alt="toc html"></a> <a href="#@hosturl_files/#@stub/#{location}/portrait.pdf"><img border="0" width="15" height="18" src="#@image_src/b_pdf.png" alt="pdf portrait"></a> <a href="#@hosturl_files/#@stub/#{location}/landscape.pdf"><img border="0" width="18" height="15" src="#@image_src/b_pdf.png" alt="pdf landscape"></a> <a href="#@hosturl_files/#@stub/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#@image_src/b_odf.png" alt="odf"></a> <a href="#@hosturl_files/#@stub/#{location}/sisu_manifest#{lang}.html"><img border="0" width="15" height="15" src="#@image_src/b_info.png" alt="manifest"></a><br />} if file_suffix=~/s/ + title=%{<br /><hr><span style="background-color: #{@color_heading}"><a href="#{@hosturl_files}/#{@stub}/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"> #{ti}</a></span> by #{e['creator']} #{can_txt_srch}<a href="#{@hosturl_files}/#{@stub}/#{location}/toc#{lang}.html"><img border="0" width="15" height="18" src="#{@image_src}/b_toc.png" alt="toc html"></a> <a href="#{@hosturl_files}/#{@stub}/#{location}/portrait.pdf"><img border="0" width="15" height="18" src="#{@image_src}/b_pdf.png" alt="pdf portrait"></a> <a href="#{@hosturl_files}/#{@stub}/#{location}/landscape.pdf"><img border="0" width="18" height="15" src="#{@image_src}/b_pdf.png" alt="pdf landscape"></a> <a href="#{@hosturl_files}/#{@stub}/#{location}/opendocument#{lang}.odt"><img border="0" width="15" height="15" src="#{@image_src}/b_odf.png" alt="odf"></a> <a href="#{@hosturl_files}/#{@stub}/#{location}/sisu_manifest#{lang}.html"><img border="0" width="15" height="15" src="#{@image_src}/b_info.png" alt="manifest"></a><br />} if file_suffix=~/s/ @counter_endn_doc+=1 oldtid=e['metadata_tid'].to_i else title = '' @@ -920,13 +921,13 @@ module SiSU_CGI_sql or (cgi['view']!~/index/ and cgi['search'] !~/search db/) #% txt endnotes @counter_endn_ocn+=1 matched_endnote=if (@search_regx.to_s.class==String && @search_regx.to_s=~/\S\S+/) - matched=e['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#@search_regx)/mi,%{<span style="background-color: #@color_match">\\1</span>}) + matched=e['body'].gsub(/(<a\s+href="https?:\/\/[^><\s]+#{@search_regx}[^>]+?>|#{@search_regx})/mi,%{<span style="background-color: #{@color_match}">\\1</span>}) else e['body'] end - output=%{#{title}<hr><font size="2">note <b><a href="#@hosturl_files/#@stub/#{location}/endnotes.html#_#{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#@hosturl_files/#@stub/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}} + output=%{#{title}<hr><font size="2">note <b><a href="#{@hosturl_files}/#{@stub}/#{location}/endnotes.html#_#{e['nr']}">#{e['nr']}</a></b> referred to from ocn <a href="#{@hosturl_files}/#{@stub}/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>:</font> #{matched_endnote}} else #elsif cgi['view']=~/index/ #% idx endnotes @counter_endn_ocn+=1 - output=%{#{title}<a href="#@hosturl_files/#@stub/#{location}/endnotes.html#_#{e['nr']}">#{e['nr']}</a> [§ <a href="#@hosturl_files/#@stub/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>], } + output=%{#{title}<a href="#{@hosturl_files}/#{@stub}/#{location}/endnotes.html#_#{e['nr']}">#{e['nr']}</a> [§ <a href="#{@hosturl_files}/#{@stub}/#{location}/doc.html##{e['ocn']}">#{e['ocn']}</a>], } end @counters_endn=if @counter_endn_doc > 0 if checked_stats =~/\S/ @@ -937,7 +938,7 @@ module SiSU_CGI_sql over='' false end - %{<font size="2" color="#666666">Found in the endnotes of #@counter_endn_doc documents, and at #{over} #@counter_endn_ocn locations within.</font><br />} + %{<font size="2" color="#666666">Found in the endnotes of #{@counter_endn_doc} documents, and at #{over} #{@counter_endn_ocn} locations within.</font><br />} else '' end end diff --git a/lib/sisu/v1/cgi_sqlite.rb b/lib/sisu/v1/cgi_sqlite.rb index 34cb67dc..9a2be6dd 100644 --- a/lib/sisu/v1/cgi_sqlite.rb +++ b/lib/sisu/v1/cgi_sqlite.rb @@ -148,8 +148,8 @@ module SiSU_CGI_sqlite elsif @q =~/\S+/; unescaped_search=CGI.unescape(@q) end search_construct=[] - unescaped_search.gsub!(/\s*(AND|OR)\s*/,"%' \) \\1 #@l LIKE \( '%") - unescaped_search.gsub!(/(.+)/,"#@l LIKE \( '%\\1%' \)") + unescaped_search.gsub!(/\s*(AND|OR)\s*/,"%' \) \\1 #{@l} LIKE \( '%") + unescaped_search.gsub!(/(.+)/,"#{@l} LIKE \( '%\\1%' \)") search_construct << unescaped_search search_construct=search_construct.join(' ') search[:search] << search_construct diff --git a/lib/sisu/v1/constants.rb b/lib/sisu/v1/constants.rb index 5c93d543..b2fdf5a1 100644 --- a/lib/sisu/v1/constants.rb +++ b/lib/sisu/v1/constants.rb @@ -167,6 +167,6 @@ check: ‹ › ∗ '〔lv1〕','〔lv2〕','〔lv3〕','〔lv4〕','〔lv5〕','〔lv6〕','〔lv7〕','〔lv8〕','〔lv9〕' '〔 Ѳ1〕','〔 Ѳ2〕','〔 Ѳ3〕','〔 Ѳ4〕','〔 Ѳ5〕','〔Ѳ6〕','〔Ѳ7〕','〔Ѳ8〕','〔Ѳ9〕' -◁▷ +◁▷ ◀this is text or an image▶ http:// diff --git a/lib/sisu/v1/css.rb b/lib/sisu/v1/css.rb index ced72d17..60ebf35c 100644 --- a/lib/sisu/v1/css.rb +++ b/lib/sisu/v1/css.rb @@ -104,8 +104,8 @@ WOK /* SiSU harvest css default stylesheet */ body { color: black; - background: "#ffffff"; - background-color: "#ffffff"; + background: #ffffff; + background-color: #ffffff; } a:link { color: #003399; @@ -120,7 +120,7 @@ WOK background-color: #f9f9aa; } a:hover img { - background-color: "#ffffff"; + background-color: #ffffff; } a:active { color: #003399; @@ -229,13 +229,13 @@ WOK } WOK end - def html #stylesheet for css html pages == html.css + def html #stylesheet for css html pages== html.css <<WOK /* SiSU css default stylesheet */ body { color: black; - background: "#ffffff"; - background-color: "#ffffff"; + background: #ffffff; + background-color: #ffffff; } /* table { @@ -245,7 +245,7 @@ WOK tr { display: block; } - th, td { + th,td { display: inline; vertical-align: top; } @@ -269,7 +269,7 @@ WOK } */ a:hover img { - background-color: "#ffffff"; + background-color: #ffffff; } a:active { color: #003399; @@ -429,6 +429,7 @@ WOK font-family: inconsolata, andale mono, courier new, courier, monospace; font-size: 90%; text-align: left; + background-color: #eeeeee; } p.caption { diff --git a/lib/sisu/v1/dal_doc_str.rb b/lib/sisu/v1/dal_doc_str.rb index 2e135243..bed3115c 100644 --- a/lib/sisu/v1/dal_doc_str.rb +++ b/lib/sisu/v1/dal_doc_str.rb @@ -101,6 +101,7 @@ module SiSU_document_structure @para.gsub!(/^:?B~\s+/,"#{Mx[:lv_o]}2:#{Mx[:lv_c]}") @para.gsub!(/^:?A~(\S+)/,"#{Mx[:lv_o]}1:\\1#{Mx[:lv_c]}") @para.gsub!(/^:?A~\s+/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]}") + @para.gsub!(/^:?A~\s*$/,"#{Mx[:lv_o]}1:#{Mx[:lv_c]} @title @author") @para=if @para =~/^@(?:level|markup):\s/ @para.gsub!(/3/,'6') @para.gsub!(/2/,'5') diff --git a/lib/sisu/v1/dal_images.rb b/lib/sisu/v1/dal_images.rb index 1882aea5..2e3e3fdd 100644 --- a/lib/sisu/v1/dal_images.rb +++ b/lib/sisu/v1/dal_images.rb @@ -22,7 +22,7 @@ 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 + 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 diff --git a/lib/sisu/v1/dal_substitutions_and_insertions.rb b/lib/sisu/v1/dal_substitutions_and_insertions.rb index cadae8a7..1ffb22d4 100644 --- a/lib/sisu/v1/dal_substitutions_and_insertions.rb +++ b/lib/sisu/v1/dal_substitutions_and_insertions.rb @@ -79,29 +79,55 @@ module SiSU_substitute_and_insert @skin.select ins=SiSU_Viz::Inserts.new case para - when /^\s*<:insert1>\s*$/ - para=[] - ins.insert1.split(/\n\n/).each{|x| para << x } - when /^\s*<:insert2>\s*$/ - para=[] - ins.insert2.split(/\n\n/).each{|x| para << x } - when /^\s*<:insert3>\s*$/ - para=[] - ins.insert3.split(/\n\n/).each{|x| para << x << "\n"} - para=ins.insert3 - when /^\s*<:insert4>\s*$/ - para=[] - ins.insert4.split(/\n\n/).each{|x| para << x << "\n"} - para=ins.insert4 - when /^\s*<:insert5>\s*$/ - para=[] - ins.insert5.split(/\n\n/).each{|x| para << x << "\n"} - when /^\s*<:insert6>\s*$/ - para=[] - ins.insert6.split(/\n\n/).each{|x| para << x << "\n"} - when /^\s*<:insert7>\s*$/ - para=[] - ins.insert7.split(/\n\n/).each{|x| para << x << "\n"} + when /^\s*<:(insert1)>\s*$/ + i=$1 + if defined? ins.insert1 + para=[] + ins.insert1.split(/\n\n/).each{|x| para << x } + else p "skin #{i} not found in #{@skin.select}" + end + when /^\s*<:(insert2)>\s*$/ + i=$1 + if defined? ins.insert2 + para=[] + ins.insert2.split(/\n\n/).each{|x| para << x } + else p "skin #{i} not found in #{@skin.select}" + end + when /^\s*<:(insert3)>\s*$/ + i=$1 + if defined? ins.insert3 + para=[] + ins.insert3.split(/\n\n/).each{|x| para << x << "\n"} + else p "skin #{i} not found in #{@skin.select}" + end + when /^\s*<:(insert4)>\s*$/ + i=$1 + if defined? ins.insert4 + para=[] + ins.insert4.split(/\n\n/).each{|x| para << x << "\n"} + else p "skin #{i} not found in #{@skin.select}" + end + when /^\s*<:(insert5)>\s*$/ + i=$1 + if defined? ins.insert5 + para=[] + ins.insert5.split(/\n\n/).each{|x| para << x << "\n"} + else p "skin #{i} not found in #{@skin.select}" + end + when /^\s*<:(insert6)>\s*$/ + i=$1 + if defined? ins.insert6 + para=[] + ins.insert6.split(/\n\n/).each{|x| para << x << "\n"} + else p "skin #{i} not found in #{@skin.select}" + end + when /^\s*<:(insert7)>\s*$/ + i=$1 + if defined? ins.insert7 + para=[] + ins.insert7.split(/\n\n/).each{|x| para << x << "\n"} + else p "skin #{i} not found in #{@skin.select}" + end end para.each{|x| data_expand << x } else data_expand << para @@ -126,4 +152,3 @@ module SiSU_substitute_and_insert end end __END__ - diff --git a/lib/sisu/v1/dal_syntax.rb b/lib/sisu/v1/dal_syntax.rb index e917621a..c6bab08f 100644 --- a/lib/sisu/v1/dal_syntax.rb +++ b/lib/sisu/v1/dal_syntax.rb @@ -252,18 +252,12 @@ module SiSU_Syntax line.gsub!(/~\{(.+?)\}~/m,Mx[:en_a_o] + '\1' + Mx[:en_a_c]) line.gsub!(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]) #default if markup does not specify line.gsub!(/~\[(.+?)\]~/m,Mx[:en_b_o] + '\1' + Mx[:en_b_c]) - if @md.subtitle and not @md.subtitle.empty? - if line =~/(?:by\s+)?(?:@creator|@author)/ - line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s+(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1#{@md.title} - #{@md.subtitle},<br />\\2#{@md.author}") - else - line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s*$/,"\\1 #{@md.title} - #{@md.subtitle}") - end - else - if line =~/(?:by\s+)?(?:@creator|@author)/ - line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s+(?:(by\s+)?(?:@creator|@author))\s*$/,"\\1#{@md.title},<br />\\2#{@md.author}") - else - line.gsub!(/^(#{Mx[:lv_o]}1:\??#{Mx[:lv_c]})\s*@title\s*$/,"\\1 #{@md.title}") + if line =~/^#{Mx[:lv_o]}1:\S*?#{Mx[:lv_c]}/ + if @md.subtitle and not @md.subtitle.empty? + line.gsub!(/\s*@title\b/," #{@md.title} - #{@md.subtitle}") + else line.gsub!(/\s*@title\b/," #{@md.title}") end + line.gsub!(/\s+(?:@creator|@author)/,",<br />#{@md.author}") end line.gsub!(/^(1~\??) @title\s*$/,"\\1 #{@md.title} - #{@md.subtitle}") # line.gsub!(/^(#{Mx[:lv_o]}[23]:\??#{Mx[:lv_c]}) (?:(by\s+)?(?:@creator|@author))\s*$/,"\\1 \\2#{@md.author}") # diff --git a/lib/sisu/v1/db_import.rb b/lib/sisu/v1/db_import.rb index 7268616b..3ead75f6 100644 --- a/lib/sisu/v1/db_import.rb +++ b/lib/sisu/v1/db_import.rb @@ -1,4 +1,4 @@ -#j coding: utf-8 +# coding: utf-8 =begin * Name: SiSU diff --git a/lib/sisu/v1/harvest_authors.rb b/lib/sisu/v1/harvest_authors.rb index a75c9ce8..e413b1d2 100644 --- a/lib/sisu/v1/harvest_authors.rb +++ b/lib/sisu/v1/harvest_authors.rb @@ -79,9 +79,10 @@ module HARVEST_authors file_array=[] File.open(filename,'r') do |file| file.each_line("\n\n") do |line| - if line =~/^@\S+?: / + if line =~/^@(?:title|subtitle|author|creator|date|original_publication):(?:\s|$)/m file_array << line - elsif line =~/^(?:\s*\n|%+ )/ + elsif line =~/^@\S+?:(?:\s|$)/m \ + or line =~/^(?:\s*\n|%+ )/ else break end end @@ -104,10 +105,10 @@ module HARVEST_authors @orig_pub,@title,@subtitle,@fulltitle,@author,@author_format=nil,nil,nil,nil,nil,nil @authors=[] rgx={} - rgx[:author]=/^@(?:author|creator):\s+(.+)/ + rgx[:author]=/^@(?:author|creator):(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m rgx[:title]=/^@title:\s+(.+)/ - rgx[:subtitle]=/^@subtitle:\s+(.+)/ - rgx[:date]=/^@date:\s+(\d{4})/ + rgx[:subtitle]=/^(?:@subtitle:\s+|@title:.+?:subtitle:[ ]+)(.+)/m + rgx[:date]=/^@date:(?:[ ]+|.+?:published:[ ]+)(\d{4})/m rgx[:orig_pub]=/^@original_publication:\s+(.+)/ data.each do |para| if para=~ rgx[:orig_pub] @@ -127,10 +128,7 @@ module HARVEST_authors end break if @title and @subtitle and @author and @date and @orig_pub end - @fulltitle=if @subtitle - @title + ' - ' + @subtitle - else @title - end + @fulltitle=@subtitle ? (@title + ' - ' + @subtitle) : @title if @title and @author_format #and @orig_pub (publication details) creator=FORMAT::Author.new(@author_format.strip).author_details @authors,@authorship=creator[:authors],creator[:authorship] @@ -144,7 +142,7 @@ module HARVEST_authors page="sisu_manifest#{lang}.html" idx_array <<= { :filename => filename, :file => file, :orig_pub => @orig_pub, :date => @date, :title => @fulltitle, :author => creator, :page => page } else - #p "missing author field: #@filename title: #@title; author: #@author_format; idx: #@orig_pub" + #p "missing author field: #{@filename} title: #{@title}; author: #{@author_format}; idx: #{@orig_pub}" end idx_array.flatten! idx_array @@ -191,7 +189,7 @@ module HARVEST_authors end def html_file_close @output[:html].close - @output[:html_mnt].close if @output[:html_mnt].class == File + @output[:html_mnt].close if @output[:html_mnt].class==File end def html_print def html_songsheet @@ -239,12 +237,9 @@ WOK a=[] a << '<p>' @alph.each do |x| - a << if x =~/[0-9]/; '' - else - %{<a href="##{x}">#{x}</a>, } - end + a << (x =~/[0-9]/) ? '' : %{<a href="##{x}">#{x}</a>, } end - @output[:html_mnt] << a.join if @output[:html_mnt].class == File + @output[:html_mnt] << a.join if @output[:html_mnt].class==File @output[:html] << a.join end def html_tail @@ -261,11 +256,11 @@ WOK </body> </html> WOK - @output[:html_mnt] << a if @output[:html_mnt].class == File + @output[:html_mnt] << a if @output[:html_mnt].class==File @output[:html] << a end def do_html(html) - @output[:html_mnt] << html if @output[:html_mnt].class == File + @output[:html_mnt] << html if @output[:html_mnt].class==File @output[:html] << html end def do_string(attrib,string) @@ -278,7 +273,7 @@ WOK while @letter < f if @alph.length > 0 @letter=@alph.shift - if @output[:html_mnt].class == File + if @output[:html_mnt].class==File @output[:html_mnt] << %{\n<p class="letter"><a name="#{@letter}"></p>#{@letter}</a><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>} end @output[:html] << %{\n<p class="letter"><a name="#{@letter}">#{@letter}</a></p><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>} @@ -293,21 +288,21 @@ WOK do_string_name('',a) name=a[0].sub(/(.+?)(?:,.+|$)/,'\1').gsub(/\s+/,'_') x = %{<p class="author"><a name="#{name}">#{a[0]}</a></p>} - if @output[:html_mnt].class == File + if @output[:html_mnt].class==File @output[:html_mnt] << x end @output[:html] << x works=[] a[1][:md].each do |x| work=[ "#{x[:date]} #{x[:title]}", %{<p class="publication">#{x[:date]} <a href="../#{x[:file]}/#{x[:page]}">#{x[:title]}</a>, #{x[:author][:authors_s]}</p>} ] - works<<=if @output[:html_mnt].class == File + works<<=if @output[:html_mnt].class==File work.concat([%{<p class="publication">[<a href="#{x[:file]}.sst">src</a>] #{x[:date]} <a href="file://#{@env.path.output}/#{x[:file]}/#{x[:page]}">#{x[:title]}</a>, #{x[:author][:authors_s]} -- [<a href="#{x[:file]}.sst">#{x[:file]}.sst</a>]</p>}]) else work end end works.sort_by {|x| x[0]}.each do |x| @output[:html] << x[1] - @output[:html_mnt] << x[2] if @output[:html_mnt].class == File + @output[:html_mnt] << x[2] if @output[:html_mnt].class==File end end end diff --git a/lib/sisu/v1/harvest_topics.rb b/lib/sisu/v1/harvest_topics.rb index 1ab62a95..f1274b40 100644 --- a/lib/sisu/v1/harvest_topics.rb +++ b/lib/sisu/v1/harvest_topics.rb @@ -79,10 +79,10 @@ module HARVEST_topics file_array=[] File.open(filename,'r') do |file| file.each_line("\n\n") do |line| - if line =~/^@\S+?: / - #line=line.gsub(/\n/,' ') + if line =~/^@(?:title|subtitle|author|creator|classify|topic_register|date):(?:\s|$)/m file_array << line - elsif line =~/^(?:\s*\n|%+ )/ + elsif line =~/^@\S+?:(?:\s|$)/m \ + or line =~/^(?:\s*\n|%+ )/ else break end end @@ -105,10 +105,10 @@ module HARVEST_topics data,filename,idx_array=@data,@filename,@idx_array @idx_lst,@title,@subtitle,@fulltitle,@author,@author_format=nil,nil,nil,nil,nil,nil rgx={} - rgx[:author]=/^@(?:author|creator):\s+(.+)/ + rgx[:author]=/^@(?:author|creator):(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m rgx[:title]=/^@title:\s+(.+)/ - rgx[:subtitle]=/^@subtitle:\s+(.+)/ - rgx[:idx]=/^@topic_register:\s+(.+)/ + rgx[:subtitle]=/^(?:@subtitle:\s+|@title:.+?:subtitle:[ ]+)(.+)/m + rgx[:idx]=/^(?:@topic_register:[ ]+|@classify:.+?:topic_register:[ ]+)(.+?)\n/m data.each do |para| if para=~ rgx[:idx] @idx_list=rgx[:idx].match(para)[1] @@ -124,10 +124,7 @@ module HARVEST_topics end break if @title and @subtitle and @author and @idx_lst end - @fulltitle=if @subtitle - @title + ' - ' + @subtitle - else @title - end + @fulltitle=@subtitle ? (@title + ' - ' + @subtitle) : @title if @title and @author_format and @idx_list creator=FORMAT::Author.new(@author_format.strip).author_details @authors,@authorship=creator[:authors],creator[:authorship] @@ -196,7 +193,7 @@ module HARVEST_topics if @@the_idx_topics[lv0].class==NilClass @@the_idx_topics[lv0]={:md => []} end - @lv0=lv0 if lev0.length == 1 + @lv0=lv0 if lev0.length==1 j=@@the_idx_topics[lv0][:md] contents(j,idx) if idx_lst_alt.length - 1 == t end @@ -207,7 +204,7 @@ module HARVEST_topics if @@the_idx_topics[@lv0][lv1].class==NilClass @@the_idx_topics[@lv0][lv1]={:md => []} end - @lv1=lv1 if lev1.length == 1 + @lv1=lv1 if lev1.length==1 j=@@the_idx_topics[@lv0][lv1][:md] contents(j,idx) if idx_lst_alt.length - 1 == t end @@ -218,7 +215,7 @@ module HARVEST_topics if @@the_idx_topics[@lv0][@lv1][lv2].class==NilClass @@the_idx_topics[@lv0][@lv1][lv2]={:md => []} end - @lv2=lv2 if lev2.length == 1 + @lv2=lv2 if lev2.length==1 j=@@the_idx_topics[@lv0][@lv1][lv2][:md] contents(j,idx) if idx_lst_alt.length - 1 == t end @@ -229,7 +226,7 @@ module HARVEST_topics if @@the_idx_topics[@lv0][@lv1][@lv2][lv3].class==NilClass @@the_idx_topics[@lv0][@lv1][@lv2][lv3]={:md => []} end - @lv3=lv3 if lev3.length == 1 + @lv3=lv3 if lev3.length==1 j=@@the_idx_topics[@lv0][@lv1][@lv2][lv3][:md] contents(j,idx) if idx_lst_alt.length - 1 == t end @@ -240,7 +237,7 @@ module HARVEST_topics if @@the_idx_topics[@lv0][@lv1][@lv2][@lv3][lv4].class==NilClass @@the_idx_topics[@lv0][@lv1][@lv2][@lv3][lv4]={:md => []} end - @lv4=lv4 if lev4.length == 1 + @lv4=lv4 if lev4.length==1 j=@@the_idx_topics[@lv0][@lv1][@lv2][@lv3][lv4][:md] contents(j,idx) if idx_lst_alt.length - 1 == t end @@ -269,7 +266,7 @@ module HARVEST_topics end def html_file_close @output[:html].close - @output[:html_mnt].close if @output[:html_mnt].class == File + @output[:html_mnt].close if @output[:html_mnt].class==File end def html_print def html_songsheet @@ -339,19 +336,19 @@ WOK </body> </html> WOK - @output[:html_mnt] << a if @output[:html_mnt].class == File + @output[:html_mnt] << a if @output[:html_mnt].class==File @output[:html] << a end def do_html(html) @output[:html] << html end def do_html_maintenance(html) - @output[:html_mnt] << html if @output[:html_mnt].class == File + @output[:html_mnt] << html if @output[:html_mnt].class==File end def do_string(attrib,string) html=%{<p class="#{attrib}">#{string}</p>} do_html(html) - do_html_maintenance(html) if @output[:html_mnt].class == File + do_html_maintenance(html) if @output[:html_mnt].class==File end def do_string_default(attrib,string) html=%{<p class="#{attrib}">#{string}</p>} @@ -359,7 +356,7 @@ WOK end def do_string_maintenance(attrib,string) html=%{<p class="#{attrib}">#{string}</p>} - do_html_maintenance(html) if @output[:html_mnt].class == File + do_html_maintenance(html) if @output[:html_mnt].class==File end def do_string_name(attrib,string) f=/^(\S)/.match(string)[1] @@ -367,7 +364,7 @@ WOK while @letter < f if @alph.length > 0 @letter=@alph.shift - if @output[:html_mnt].class == File + if @output[:html_mnt].class==File @output[:html_mnt] << %{\n<p class="letter"><a name="#{@letter}">#{@letter}</a></p><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>} end @output[:html] << %{\n<p class="letter"><a name="#{@letter}">#{@letter}</a></p><p class="book_index_lev1"><a name="#{@letter.downcase}"></a></p>} @@ -378,7 +375,7 @@ WOK name=string.strip.gsub(/\s+/,'_') html=%{<p class="#{attrib}"><a name="#{name}">#{string}</a></p>} do_html(html) - do_html_maintenance(html) if @output[:html_mnt].class == File + do_html_maintenance(html) if @output[:html_mnt].class==File end def do_array(lv,array) lv+=1 @@ -391,7 +388,7 @@ WOK do_string_default(attrib,html) end def do_hash_md_maintenance(attrib,hash) - if @output[:html_mnt].class == File #should not be run for presentation output + if @output[:html_mnt].class==File #should not be run for presentation output html=%{[<a href="#{hash[:file]}.sst">src</a>] <a href="file://#{@env.path.output}/#{hash[:file]}/#{hash[:page]}">#{hash[:title]}</a> - #{hash[:author]}} do_string_maintenance(attrib,html) end @@ -412,10 +409,7 @@ WOK if key.length > 0 key.sort.each do |m| attrib="lev#{lv}" - if lv == 0 - do_string_name(attrib,m) - else do_string(attrib,m) - end + lv==0 ? do_string_name(attrib,m) : do_string(attrib,m) do_case(lv,hash[m]) end end @@ -423,16 +417,12 @@ WOK def do_case(lv,a) y = a.class case - when y == String + when y==String attrib="lev#{lv}" - if lv == 0 - do_string_name(attrib,a) - else do_string(attrib,a) - end - #do_string_name(attrib,a) - when y == Array + lv==0 ? do_string_name(attrib,a) : do_string(attrib,a) + when y==Array do_array(lv,a) - when y == Hash + when y==Hash do_hash(lv,a) end end @@ -482,11 +472,11 @@ WOK s=' '*4 y = a.class case - when y == String + when y==String do_string(lv,a) - when y == Array + when y==Array do_array(lv,a) - when y == Hash + when y==Hash do_hash(lv,a) end end @@ -533,11 +523,11 @@ WOK s=' '*4 y = a.class case - when y == String + when y==String do_string(lv,a) - when y == Array + when y==Array do_array(lv,a) - when y == Hash + when y==Hash do_hash(lv,a) end end diff --git a/lib/sisu/v1/help.rb b/lib/sisu/v1/help.rb index cd5eaf25..101f673b 100644 --- a/lib/sisu/v1/help.rb +++ b/lib/sisu/v1/help.rb @@ -269,11 +269,11 @@ WOK #{@cX.ruby}-M#{@cX.off} #{@cX.green}[filename/wildcard/url]#{@cX.off} maintenance mode, files created for processing are not deleted, and their locations are indicated (also see -V) - #{@cX.ruby}-m#{@cX.off} #{@cX.green}[filename/wildcard/url]#{@cX.off} create (new)metaVerse (used in all subsequent processing). Produce a meta file, the first step in processing, and the file all subsequent processing utilize. (Should usually be run together with other commands to ensure that the lated version of markup source document is used, i.e. add -m flag to other flags required). + #{@cX.ruby}-m#{@cX.off} #{@cX.green}[filename/wildcard/url]#{@cX.off} assumed for most other flags, creates new intermediate files for processing (document abstraction) that is used in all subsequent processing of other output. This step is assumed for most processing flags. To skip it see -n #{@cX.ruby}-N#{@cX.off} #{@cX.green}[filename/wildcard/url]#{@cX.off} document content certificate as md5 digest tree of document produced (as digest.txt), the digest for the document, and digests for each object contained within the document (together with information on software versions that produced it). Try -mNV for verbose digest output to screen - #{@cX.ruby}-n#{@cX.off} #{@cX.green}[filename/wildcard/url]#{@cX.off} skip meta-markup (building of "metaverse"), this skips the equivalent of -m + #{@cX.ruby}-n#{@cX.off} #{@cX.green}[filename/wildcard/url]#{@cX.off} skip the creation of intermediate processing files (document abstraction) if they already exist, this skips the equivalent of -m which is otherwise assumed by most processing flags. #{@cX.ruby}-p#{@cX.off} #{@cX.green}[filename/wildcard]#{@cX.off} produces LaTeX pdf (portrait & landscape). Default paper size is set in config file, or document header, or provided with additional command line parameter, e.g. --papersize='a4' preset sizes include: 'A4', U.S. 'letter' and 'legal' and book sizes 'A5' and 'B5' (system defaults to A4). diff --git a/lib/sisu/v1/manpage.rb b/lib/sisu/v1/manpage.rb index 7129e45a..d3886fc2 100644 --- a/lib/sisu/v1/manpage.rb +++ b/lib/sisu/v1/manpage.rb @@ -270,6 +270,9 @@ WOK para.gsub!(/#{Mx[:gl_bullet]}\s*/,'* ') # bullet markup, marked down para.gsub!(/#{Mx[:fa_superscript_o]}(.+?)#{Mx[:fa_superscript_c]}/,'^\1^') para.gsub!(/#{Mx[:fa_subscript_o]}(.+?)#{Mx[:fa_subscript_c]}/,'[\1]') + para.gsub!(/#{Mx[:fa_insert_o]}(.+?)#{Mx[:fa_insert_c]}/,'++\1++') + para.gsub!(/#{Mx[:fa_strike_o]}(.+?)#{Mx[:fa_strike_c]}/,'--\1--') + para.gsub!(/#{Mx[:fa_cite_o]}(.+?)#{Mx[:fa_cite_c]}/,'"\1"') para.gsub!(/\A\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}#{Mx[:br_line]}/m,"#{Mx[:br_line]}.I \\1#{Mx[:br_line]}") para.gsub!(/\s*#{Mx[:fa_italics_o]}(.+?)#{Mx[:fa_italics_c]}/m,"#{Mx[:br_line]}.I \\1#{Mx[:br_line]}") para.gsub!(/\A\s*#{Mx[:fa_bold_o]}(.+?)#{Mx[:fa_bold_c]}#{Mx[:br_line]}/m,"#{Mx[:br_line]}.BI \\1#{Mx[:br_line]}") @@ -330,7 +333,7 @@ WOK para.gsub!(/<a href=".+?">(.+?)<\/a>/m,'\1') para.gsub!(/#{Mx[:mk_o]}name#\S+?#{Mx[:mk_c]}/,'') # remove name links para.gsub!(/ |#{Mx[:nbsp]}/,' ') # decide on - para.gsub!(/(["''])/,"\\\\\\1") # quotation marks need escape + #para.gsub!(/(["''])/,"\\\\\\1") #check note claims that quotation marks need escape, however that appears to result in error para.gsub!(/(?:^|[^_\\])#{Mx[:lnk_o]}\s*(\S+?\.(?:png|jpg|gif)) .+?#{Mx[:lnk_c]}(?:(?:https?|file|ftp):\/\/\S+|image)/,' [ \1 ]') #"[ #{dir.url.images_local}\/\\1 ]") para.gsub!(/^(?:^|[^_\\])#{Mx[:lnk_o]}\s*\S+?\.(?:png|jpg|gif)\s+.+?"(.*?)"\s*#{Mx[:lnk_c]}\S+/,'[image: "\1"]') wordlist=para.scan(/\S+/) diff --git a/lib/sisu/v1/param.rb b/lib/sisu/v1/param.rb index 4efdebb5..72593207 100644 --- a/lib/sisu/v1/param.rb +++ b/lib/sisu/v1/param.rb @@ -82,7 +82,7 @@ module SiSU_Param @fns=opt.fns.gsub(/\.ssm$/,'.ssm.sst') #revisit CHECK Instantiate.new.param_instantiate @env=SiSU_Env::Info_env.new(@fns) - @pstorefile="#{@env.path.dal}/#@fns.pstore" + @pstorefile="#{@env.path.dal}/#{@fns}.pstore" end def get unless @@fns==@fns @@ -233,13 +233,13 @@ module SiSU_Param @flag_auto_heading_num=false if @fns =~ /(?:-|ssm\.)?sst$/ #watch @env_out_root=@env.path.output - @dir_out="#{@env.path.output}/#@fnb" + @dir_out="#{@env.path.output}/#{@fnb}" @dir_tex=@env.path.tex @dir_lout=@env.path.lout @@publisher='SiSU http://www.jus.uio.no/sisu' end @txt_path=@txt_path ||= @env.path.output - @stmp=%{#@fns}[/^(.+?)\..*/m,1] + @stmp=%{#{@fns}}[/^(.+?)\..*/m,1] @fnstex=@fns.gsub(/_/,'\_') @flag_separate_endnotes=false @flag_separate_endnotes_make=true @@ -260,10 +260,10 @@ module SiSU_Param else '' end s_a,s_b,s_c=@sisu_version[:version].match(/^([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?(?:\-\S+)?$/)[1..3] - tell=if @markup_version_declared.to_f == @markup_version.to_f - SiSU_Screen::Ansi.new(@cmd,"Markup version (#@markup_version)",sv) + tell=if @markup_version_declared.to_f==@markup_version.to_f + SiSU_Screen::Ansi.new(@cmd,"Markup version (#{@markup_version})",sv) else - SiSU_Screen::Ansi.new(@cmd,"Markup version declared (#@markup_version_declared), determined (#@markup_version)",sv) + SiSU_Screen::Ansi.new(@cmd,"Markup version declared (#{@markup_version_declared}), determined (#{@markup_version})",sv) end ok=if s_a.to_i > sm_a.to_i true @@ -279,7 +279,7 @@ module SiSU_Param if ok tell.txt_green if @cmd =~/[vVM]/ else - tell=SiSU_Screen::Ansi.new(@cmd,"Warning: markup version determined (#@markup_version) or markup version declared (#@markup_version_declared) is newer than SiSU version (#{@sisu_version[:version]})") + tell=SiSU_Screen::Ansi.new(@cmd,"Warning: markup version determined (#{@markup_version}) or markup version declared (#{@markup_version_declared}) is newer than SiSU version (#{@sisu_version[:version]})") tell.warn unless @cmd =~/q/ end else @@ -294,19 +294,19 @@ module SiSU_Param fns_array.each do |para| #% Scan document if para !~/^%+\s/ \ and para =~/<![abcdeghijklmnopqrstuvwxyz]/i # <!f not included - raise "Old markup style in file #@fns, current version #{@sisu_version[:project]} #{@sisu_version[:version]} #{@sisu_version[:date_stamp]} #{@sisu_version[:date]}:\n\t\t#{para}\n\n" + raise "Old markup style in file #{@fns}, current version #{@sisu_version[:project]} #{@sisu_version[:version]} #{@sisu_version[:date_stamp]} #{@sisu_version[:date]}:\n\t\t#{para}\n\n" end @code_flag=case para when /^code\{\s*$/; true when /^\}code\s*$/; false else @code_flag end - regx_header=/^(?:@\S+?:[+-]?\s|0~\S+)/ + regx_header=/^@\S+?:[+-]?\s/ if para =~regx_header \ and not @code_flag #or para=~/^(?:1|:?A)~/ case para - when /^(?:@ocn:|0~ocn)\s+(.+?)$/m; @ocn=$1 #% processing - when /^(?:@title:|0~title)\s+(.+?)$/m #% metainfo DC + when /^@ocn:\s+(.+?)$/m; @ocn=$1 #% processing + when /^@title:\s+(.+?)$/m #% metainfo DC @title=$1.strip @full_title=@title.dup @html_title=@title.gsub(/(<p>|<p \/>|<br>|<br \/>)/,'') @@ -315,41 +315,46 @@ module SiSU_Param @html_title.chomp!(' ') tell=SiSU_Screen::Ansi.new(@cmd,'Parameters',@html_title) tell.txt_grey unless @cmd =~/q/ - when /^(?:@subtitle:|0~subtitle)\s+(.+?)$/m #% metainfo + when /^@subtitle:\s+(.+?)$/m #% metainfo @subtitle=$1.strip @full_title="#{@title} - #{@subtitle}" @subtitle_tex=@subtitle - when /^(?:@(?:creator|author)-?:|0~(?:creator|author)-?)\s+(.+?)$/ #% metainfo DC + when /^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:[|]|$)/m #when /^@(?:creator|author):(?:[ ]+|.+?:author:[ ]+)(.+?)(?:[|]|$)/m + names=name_format($1) + @authorship=@author=names[:name_str] + @authors=names[:name_a_h] + when /^@author:\s+(.+?)$/ names=name_format($1) @authorship=@author=names[:name_str] @authors=names[:name_a_h] when /^@(?:creator|author)\.title:\s+(.+?)$/; @author_title=$1 # Prof. Dr. etc. when /^@(?:creator|author)\.nationality:\s+(.+?)$/; @author_nationality=$1 - when /^(?:@(?:translator|translated_by):|0~(?:translator|translated_by))\s+(.+?)$/m #% metainfo + when /^@(?:translator|translated_by):\s+(.+?)$/m #% metainfo names=name_format($1) @translator=names[:name_str] - when /^(?:@(?:illustrator|illustrated_by):|0~(?:illustrator|illustrated_by))\s+(.+?)$/m #% metainfo + when /^@(?:illustrator|illustrated_by):\s+(.+?)$/m #% metainfo names=name_format($1) @illustrator=names[:name_str] - when /^(?:@prepared_by:|0~prepared_by)\s+(.+?)$/m #% metainfo + when /^@prepared_by:\s+(.+?)$/m #% metainfo names=name_format($1) @prepared_by=names[:name_str] - when /^(?:@digitized_by:|0~digitized_by)\s+(.+?)$/m #% metainfo DC + when /^@digitized_by:\s+(.+?)$/m #% metainfo DC names=name_format($1) @digitized_by=names[:name_str] - when /^(?:@subject:|0~subject)\s+(.+?)$/m; @subject=$1 #% metainfo DC - when /^(?:@description:|0~description)\s+(.+?)$/m; @description=$1 #% metainfo DC & rss feed - when /^(?:@contributor:|0~contributor)\s+(.+?)$/m #% metainfo DC + when /^@subject:\s+(.+?)$/m; @subject=$1 #% metainfo DC + when /^@description:\s+(.+?)$/m; @description=$1 #% metainfo DC & rss feed + when /^@contributor:\s+(.+?)$/m #% metainfo DC names=name_format($1) @contributor=names[:name_str] - when /^(?:@publisher:|0~publisher)\s+(.+?)$/m; @publisher=$1 #% metainfo DC + when /^@publisher:\s+(.+?)$/m; @publisher=$1 #% metainfo DC when /^@original_publication:\s+(.+?)$/m; @original_publication=$1 when /^@original_publication\.date:\s+(.+?)$/; @original_publication_date=$1 when /^@original_publication\.nationality:\s+(.+?)$/; @original_publication_nationality=$1 when /^@original_publication\.institution:\s+(.+?)$/; @original_publication_institution=$1 when /^@writing_focus\.nationality:\s+(.+?)$/; @writing_focus=$1 # e.g. Finland (where and article on Finnish law) - when /^(?:@|0~)date.+?$/m #% metainfo DC - if para =~/(?:@date:|0~date)\s+(.+?)$/m + when /^@date:(?:[ ]+|.+?:published:[ ]+)(\d{4})/m #% metainfo DC + #when /^@date.+?$/m #% metainfo DC + if para =~/@date:\s+(.+?)$/m @date=$1.strip #% original publication date unless the substantive text is updated/modified, then date of update if @date !~regx_date \ and not @date.empty? @@ -358,7 +363,7 @@ module SiSU_Param end @date_scheme='scheme="ISO-8601"' if @date =~/\d{4}-\d{2}-\d{2}/ end - if para =~/(?:@date\.added_to_site:|0~date\.added_to_site)\s+(.+?)$/m + if para =~/@date\.added_to_site:\s+(.+?)$/m @date_added_to_site=$1.strip if @date_added_to_site !~regx_date \ and not @date_added_to_site.empty? @@ -367,7 +372,7 @@ module SiSU_Param end @date_scheme='scheme="ISO-8601"' if @date_added_to_site =~/\d{4}-\d{2}-\d{2}/ end - if para =~/(?:@date\.created:|0~date\.created)\s*(.+?)$/m + if para =~/@date\.created:\s*(.+?)$/m date=$1.strip if date !~regx_date \ and not date.empty? @@ -377,7 +382,7 @@ module SiSU_Param @date_created=date @date_created_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/ end - if para =~/(?:@date\.issued:|0~date\.issued)\s*(.+?)$/m + if para =~/@date\.issued:\s*(.+?)$/m date=$1.strip if date !~regx_date \ and not date.empty? @@ -387,7 +392,7 @@ module SiSU_Param @date_issued=date @date_issued_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/ end - if para =~/(?:@date\.available:|0~date\.available)\s*(.+?)$/m + if para =~/@date\.available:\s*(.+?)$/m date=$1.strip if date !~regx_date \ and not date.empty? @@ -397,7 +402,7 @@ module SiSU_Param @date_available=date @date_available_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/ end - if para =~/^(?:@date\.valid:|0~date\.valid)\s*(.+?)$/m + if para =~/^@date\.valid:\s*(.+?)$/m date=$1.strip if date !~regx_date \ and not date.empty? @@ -407,7 +412,7 @@ module SiSU_Param @date_valid=date @date_valid_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/ end - if para =~/^(?:@date\.modified:|0~date\.modified)\s*(.+?)$/m #% of interest rss feed & sitemap + if para =~/^@date\.modified:\s*(.+?)$/m #% of interest rss feed & sitemap date=$1.strip if date !~regx_date \ and not date.empty? @@ -417,7 +422,7 @@ module SiSU_Param @date_modified=date @date_modified_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/ end - if para =~/^(?:@date\.translated:|0~date\.translated)\s*(.+?)$/m + if para =~/^@date\.translated:\s*(.+?)$/m date=$1.strip if date !~regx_date \ and not date.empty? @@ -427,33 +432,33 @@ module SiSU_Param @date_translated=date @date_translated_scheme='scheme="ISO-8601"' if date =~/\d{4}-\d{2}-\d{2}/ end - when /^(?:@type:|0~type)\s+(.+?)$/m; @type=$1 #% metainfo DC - when /^(?:@format:|0~format)\s+(.+?)$/m; @format=$1 #% metainfo DC - #when /^(?:@identifier:|0~identifier)\s+(.+?)$/m; @identifier=$1 #% metainfo DC - when /^(?:@source:|0~source)\s+(.+?)$/m; @source=$1 #% metainfo DC - when /^(?:@language(?:\.document)?:|0~language(?:\.document)?)\s+(.+?)$/m #% metainfo DC + when /^@type:\s+(.+?)$/m; @type=$1 #% metainfo DC + when /^@format:\s+(.+?)$/m; @format=$1 #% metainfo DC + #when /^@identifier:\s+(.+?)$/m; @identifier=$1 #% metainfo DC + when /^@source:\s+(.+?)$/m; @source=$1 #% metainfo DC + when /^@language(?:\.document)?:\s+(.+?)$/m #% metainfo DC x=$1.strip lang=SiSU_Env::Standardise_language.new(x.dup) @language[:code]=lang.code @language[:name]=lang.title - when /^(?:@language\.original:|0~language\.original)\s+(.+?)$/m #% metainfo DC + when /^@language\.original:\s+(.+?)$/m #% metainfo DC x=$1.strip lang=SiSU_Env::Standardise_language.new(x.dup) @language_original[:name]=lang.title - when /^(?:@relation:|0~relation)\s+(.+?)$/m; @relation=$1 #% metainfo DC - when /^(?:@coverage:|0~coverage)\s+(.+?)$/m; @coverage=$1 #% metainfo DC - when /^(?:@rights:|0~rights)\s+(.+?)$/m; @rights=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC copyright, public domain, copyleft, creative commons, etc. - when /^(?:@papersize:|0~papersize)\s+(.+?)$/m #% metainfo DC + when /^@relation:\s+(.+?)$/m; @relation=$1 #% metainfo DC + when /^@coverage:\s+(.+?)$/m; @coverage=$1 #% metainfo DC + when /^@rights:\s+(.+?)$/m; @rights=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC copyright, public domain, copyleft, creative commons, etc. + when /^@papersize:\s+(.+?)$/m #% metainfo DC l=$1 if @mod.inspect !~/--papersize[=-]\S+/ l=determine_papersize(l.dup) @papersize=l end - when /^(?:@keywords?:|0~keywords?)\s+(.+?)$/m; @keywords=$1 #% metainfo DC - when /^(?:@comments?:|0~comments?)\s+(.+?)$/m; @comments=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC - when /^(?:@abstract:|0~abstract)\s+(.+?)$/m; @abstract=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC - when /^(?:@tags?:|0~tags?)\s+\S/m #% metainfo - tags=para.match(/^(?:@tags?:|0~tags?)\s+(.+)\Z/m)[1] + when /^@keywords?:\s+(.+?)$/m; @keywords=$1 #% metainfo DC + when /^@comments?:\s+(.+?)$/m; @comments=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC + when /^@abstract:\s+(.+?)$/m; @abstract=$1.gsub(/<(?:\/\s*)?br(?:\s*\/)?>/,Mx[:br_line]) #% metainfo DC + when /^@tags?:\s+\S/m #% metainfo + tags=para.match(/^@tags?:\s+(.+)\Z/m)[1] tags.split(/,|$/).each do |tag| tag.strip! @tags << tag @@ -462,18 +467,50 @@ module SiSU_Param tag_a=tag_a.split(/:/).join('][') @tag_a << tag_a end - when /^(?:@catalogue:|0~catalogue)\s+(.+)?$/m #% metainfo + when /^@catalogue:\s+(.+)?$/m #% metainfo m=$1 @cls_pg=m.match(/pg=(\S+)/)[1] if m =~/pg=/ @cls_isbn=m.match(/isbn=(\S+)/)[1] if m =~/isbn=/ @cls_dewey=m.match(/dewey=(\S+)/)[1] if m =~/dewey=/ @cls_loc=m.match(/loc=(\S+)/)[1] if m =~/loc=/ - when /^(?:@class(?:ify)?_loc:|0~class(?:ify)?_loc)\s+(.+?)$/m; @cls_loc=$1 #% metainfo - when /^(?:@class(?:ify)?_dewey:|0~class(?:ify)?_dewey)\s+(.+?)$/m; @cls_dewey=$1 #% metainfo - when /^(?:@class(?:ify)?_pg:|0~class(?:ify)?_pg)\s+(.+?)$/m; @cls_pg=$1 #% metainfo - when /^(?:@(?:class(?:ify)?_)?isbn:|0~(?:class(?:ify)?_)?isbn)\s+(\S+?)$/m; @cls_isbn=$1 #% metainfo - when /^(?:@images?:|0~images?)\s+(.+?)$/m; @image=$1 #% processing - when /^(?:@(?:toc|structure):|0~(?:toc|structure))\s+(.+?)\Z/m #% processing + when /^@class(?:ify)?_loc:\s+(.+?)$/m; @cls_loc=$1 #% metainfo + when /^@class(?:ify)?_dewey:\s+(.+?)$/m; @cls_dewey=$1 #% metainfo + when /^@class(?:ify)?_pg:\s+(.+?)$/m; @cls_pg=$1 #% metainfo + when /^@(?:class(?:ify)?_)?isbn:\s+(\S+?)$/m; @cls_isbn=$1 #% metainfo + when /^@images?:\s+(.+?)$/m; @image=$1 #% processing + + when /^@make:/m #% metainfo DC + + if para=~ /^@make:.+?:breaks:[ ]+(.+?)\n/m + #p $1 #FIX + #@pagenew= + #@pagebreak= + end + if para=~ /^@make:.+?:headings:[ ]+(.+?)\n/m + s=$1 + lv=[] + s=(s =~/;/) ? (s.split(/;\s*/)) : [ s ] + @toc=s + lv1=s[0] ||='1~ ' + @lv1=/^#{lv1}/ + lv2=s[1] ||='2~ ' + @lv2=/^#{lv2}/ + lv3=s[2] ||='3~ ' + @lv3=/^#{lv3}/ + lv4=s[3] ||='4~ ' + @lv4=/^#{lv4}/ + lv5=s[4] ||='5~ ' + @lv5=/^#{lv5}/ + lv6=s[5] ||='6~ ' + @lv6=/^#{lv6}/ + end + if para=~ /^@make:.+?:num_top:[ ]+(.+?)\n/m + @num_top=$1 + end + if para=~ /^@make:.+?:skin:[ ]+(.+?)\n/m + @doc_skin=$1 + end + when /^@(?:toc|structure):\s+(.+?)\Z/m #% processing doc_toc_str=$1 @toc=doc_toc_str.split(/;\s*/) @toc=[ @toc ] if @toc == String @@ -490,8 +527,8 @@ module SiSU_Param @lv5=/^#{lv5}/ lv6=@toc[5] ||='6~ ' @lv6=/^#{lv6}/ - when /^(?:@(?:level|page|markup):|0~(?:level|page|markup))\s+(.+?)$/m #% processing revisit..., use syntax 0~level new=1,2,3; break=4 - if para =~/(?:@|0~)(?:markup|level|page):?\s+(.+?)\Z/m + when /^@(?:level|page|markup):\s+(.+?)$/m #% processing revisit..., use syntax 0~level new=1,2,3; break=4 + if para =~/@(?:markup|level|page):?\s+(.+?)\Z/m page_break_str=$1 pagebreaks=page_break_str.split(/;\s*/) #pagebreaks=[ pagebreaks ] if pagebreaks == String @@ -508,11 +545,11 @@ module SiSU_Param @toc_lev_limit=toc_lev_limit if toc_lev_limit @flag_auto_heading_num=true if para =~/num_top/ end - if para =~/^(?:@markup:|0~markup)\s+(.+?)$/m #%use of markup depreciated for num_top + if para =~/^@markup:\s+(.+?)$/m #%use of markup depreciated for num_top @markup=$1 @flag_auto_heading_num=true if para =~/num_top/ end - when /^(?:@bold:|0~bold)\s+(.+?)$/m #% processing + when /^@bold:\s+(.+?)$/m #% processing m=$1.strip x=case m when /\/i$/; 'i' @@ -526,7 +563,7 @@ module SiSU_Param else /#{rgx}/ end @make_bold - when /^(?:@(?:italics?|itali[sz]e):|0~(?:italics?|itali[sz]e))\s+(.+?)$/m #% processing Dublin Core - dublin core within + when /^@(?:italics?|itali[sz]e):\s+(.+?)$/m #% processing Dublin Core - dublin core within m=$1.strip x=case m when /\/i$/; 'i' @@ -540,11 +577,11 @@ module SiSU_Param else /#{rgx}/ end @make_italic - when /^(?:@(?:vocabulary|wordlist):|0~(?:vocabulary|wordlist))\s+(.+?)$/m #% processing + when /^@(?:vocabulary|wordlist):\s+(.+?)$/m #% processing @vocabulary=$1 #not actually used by concordance - when /^(?:@skin:|0~skin)\s+(.+?)$/; @doc_skin=$1.strip #% processing - when /^(?:@(?:css|stylesheet):|0~(?:css|stylesheet))\s+(.+?)$/; @doc_css=$1.strip #% processing - when /^(?:@links:|0~links)\s+(.+?)\Z/m #% processing + when /^@skin:\s+(.+?)$/; @doc_skin=$1.strip #% processing + when /^@(?:css|stylesheet):\s+(.+?)$/; @doc_css=$1.strip #% processing + when /^@links:\s+(.+?)\Z/m #% processing doc_links_str=$1 @lnk=[] if doc_links_str=~/\{.+?\}(?:(?:https?|file|ftp):\/|\.\.)\/\S+(?:\s|$)/ @@ -568,16 +605,18 @@ module SiSU_Param end end end - when /^(?:@prefix(?:_[ab])?:|0~prefix(?:_[ab])?)\s/ #% metainfo + when /^@prefix(?:_[ab])?:\s/ #% metainfo if para =~/prefix_a:?\s+/ - @prefix_a=para[/(?:@prefix_a:|0~prefix_a)\s+(.+?)$/im,1] + @prefix_a=para[/@prefix_a:\s+(.+?)$/im,1] end if para =~/prefix(?:_b)?:?\s+/ - @prefix_b=para[/(?:@prefix(?:_b)?:|0~prefix(?:_b)?)\s+(.+?)$/im,1] + @prefix_b=para[/@prefix(?:_b)?:\s+(.+?)$/im,1] end - when /^(?:@suffix:|0~suffix)\s+(.+?)$/m; @suffix=$1 #% metainfo - when /^(?:@information:|0~information)\s+(.+?)$/m; @information=$1 #% metainfo - when /^(?:@topic_register:|0~topic_register)\s+(.+?)$/m; @topic_register=$1 #% metainfo, similar syntax to book index, leave out the ={} i.e. use equivalent of ={(.+?)} + when /^@suffix:\s+(.+?)$/m; @suffix=$1 #% metainfo + when /^@information:\s+(.+?)$/m; @information=$1 #% metainfo + when /^(?:@topic_register:[ ]+|@classify:.+?:topic_register:[ ]+)(.+?)\n/m #% metainfo, similar syntax to book index, leave out the ={} i.e. use equivalent of ={(.+?)} + #when /^@topic_register:\s+(.+?)$/m; @topic_register=$1 #% metainfo, similar syntax to book index, leave out the ={} i.e. use equivalent of ={(.+?)} + @topic_register=$1 u=@topic_register.scan(/[^;]+/) v=[] u.each do |l| @@ -588,30 +627,30 @@ module SiSU_Param @topic_register_array << m end @topic_register_array.sort! - when /^(?:@contact:|0~contact)\s+(.+?)$/m; @contact=$1 #% metainfo - when /^(?:@original_publication:|0~original_publication)\s+(.+?)$/m; @original_publication=$1 #% details of original publication - when /^(?:@icon:|0~icon)\s+(.+?)$/m; @icon=$1 #% processing - when /^(?:@promo:|0~promo)\s+(.+?)$/m + when /^@contact:\s+(.+?)$/m; @contact=$1 #% metainfo + when /^@original_publication:\s+(.+?)$/m; @original_publication=$1 #% details of original publication + when /^@icon:\s+(.+?)$/m; @icon=$1 #% processing + when /^@promo:\s+(.+?)$/m @flag_promo=true @promo=$1.split(/[,;]\s*/) - when /^(?:@ad:|0~ad)\s+(\S+)?\s+(\S+\.png)?\s+(.+?!)\s+(\d+)\s*$/m #% processing + when /^@ad:\s+(\S+)?\s+(\S+\.png)?\s+(.+?!)\s+(\d+)\s*$/m #% processing @ad_url,@ad_png,@ad_alt,@ad_began=$1,$2,$3,$4 - when /0~ad\.home\s+(.+)?\s*$/m #% processing - ad_home_str=$1 - @ad_home=ad_home_str.split(/\s+!/) - when /^(?:@sta?mp(?:ed)?:|0~sta?mp(?:ed)?)\s+(.+?)$/m; @stmp= $1.downcase! #% processing - when /^(?:@(?:rcs|cvs):|0~(?:rcs|cvs))\+?\s+/ #% processing - m=/(?:@(?:rcs|cvs):|0~(?:rcs|cvs))\+?\s+/ #note the + sign to turn on use of rcs or cvs id +# when /0~ad\.home\s+(.+)?\s*$/m #% processing +# ad_home_str=$1 +# @ad_home=ad_home_str.split(/\s+!/) + when /^@sta?mp(?:ed)?:\s+(.+?)$/m; @stmp= $1.downcase! #% processing + when /^@(?:rcs|cvs):\+?\s+/ #% processing + m=/@(?:rcs|cvs):\+?\s+/ #note the + sign to turn on use of rcs or cvs id ver=para[/#{m}(.+)/,1] #RCS or CVS ID tag # eg. # $Id$ contains=/[\$]Id:\s+(\S+),v\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+Exp\s+(?:\S+\s+)?[\$]/ # reason for [$] which is apparently unnecessary is that rcs or cvs will otherwise expand id! if contains.match(ver) filename,vnumber,date,time,operator=contains.match(ver).captures @sc_filename,@sc_number,@sc_date,@sc_time=filename,vnumber,date,time end - @sc_info=true if para[/(?:@(?:rcs|cvs):|0~(?:rcs|cvs))\+/] + @sc_info=true if para[/@(?:rcs|cvs):\+/] when /^@base_program:\s+(.+?)$/; @base_program=$1 #% processing #% break - break, not necessary to process headers further :-) but necessary to extract endnotes etc. ;-( - when /^(?:@man:|0~man)\s+(.+?)\Z/m #% man pages + when /^@man:\s+(.+?)\Z/m #% man pages maninfo_str=$1 maninfo=maninfo_str.split(/;\s*/m) maninfo.each do |x| diff --git a/lib/sisu/v1/sst_from_kdissert.rb b/lib/sisu/v1/sst_from_kdissert.rb index 53840fcd..8f22c5f5 100644 --- a/lib/sisu/v1/sst_from_kdissert.rb +++ b/lib/sisu/v1/sst_from_kdissert.rb @@ -74,7 +74,7 @@ module SiSU_Kdissert sisu_head=<<WOK % SiSU #{@ver[:version]} auto-conversion from Kdissert file [check necessary] -@title: #@title +@title: #{@title} @prefix: Kdissert document map, converted to SiSU markup @@ -128,7 +128,7 @@ WOK txt=root.elements["item[#{idx}]/text"].text.to_s.strip end @el[id]={ :id=>id,:ma=>ma,:ch=>ch,:sum=>sum,:txt=>txt } - if ma == '-1' + if ma=='-1' @el[id][:lev]=':A' @top=id end diff --git a/lib/sisu/v1/sst_to_s_xml_dom.rb b/lib/sisu/v1/sst_to_s_xml_dom.rb index 3db194b2..39ae7bcc 100644 --- a/lib/sisu/v1/sst_to_s_xml_dom.rb +++ b/lib/sisu/v1/sst_to_s_xml_dom.rb @@ -22,7 +22,7 @@ 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 + 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 @@ -214,13 +214,13 @@ WOK #{@tab*n2}</object> #{@tab*n1}</heading>#{xml_content} WOK - if lv == 4 + if lv==4 @copen[1]=true @copen[2]=@copen[3]=false - elsif lv == 5 + elsif lv==5 @copen[2]=true @copen[3]=false - elsif lv == 6 + elsif lv==6 @copen[3]=true end end @@ -264,7 +264,7 @@ WOK when 4..6 6.downto(lv) do |x| y=x - 1 - if @level[x] == true + if @level[x]==true u=x - 3; @xml_contents_close[x]='' end @@ -275,11 +275,11 @@ WOK case lv when 4 @@xml[:body] << "#{@tab*5}</content>\n" if @cont[1] - if @copen[3] == true # 6{ + if @copen[3]==true # 6{ [3,2,1].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" } - elsif @copen[2] == true # 5{ + elsif @copen[2]==true # 5{ [2,1].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" } - elsif @copen[1] == true # 4{ + elsif @copen[1]==true # 4{ [1].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" } end @cont[1]=true @@ -288,9 +288,9 @@ WOK or @cont[1] @@xml[:body] << "#{@tab*5}</content>\n" end - if @copen[3] == true #6{ + if @copen[3]==true #6{ [3,2].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" } - elsif @copen[2] == true #5{ + elsif @copen[2]==true #5{ [2].each { |v| @@xml[:body] << "#{@tab*n}</contents#{v}>\n" } end @cont[2]=true @@ -479,7 +479,7 @@ WOK @content_flag=true 6.downto(4) do |x| y=x - 1; v=x - 3 - if @level[x] == true + if @level[x]==true if @content_flag==true @@xml[:body] << "#{@tab*5}</content>\n#{@tab*y}</contents#{v}>\n" @content_flag=false @@ -490,9 +490,8 @@ WOK end 3.downto(1) do |x| y=x - 1 - @@xml[:body] << "#{@tab*y}</heading#{x}>\n" if @level[x] == true + @@xml[:body] << "#{@tab*y}</heading#{x}>\n" if @level[x]==true end - #6.downto(1) { |x| y=x - 1; @@xml[:body] << "#{@tab*y}</level #{x}>\n" if @level[x] == true } end def pre rdf=SiSU_XML_tags::RDF.new(@md) @@ -559,7 +558,7 @@ WOK @sisu=new_file_data.scan(/.+/) SiSU_Env::SiSU_file.new(@md).mkdir filename_sxm=SiSU_Env::SiSU_file.new(@md,@md.fn[:sxd]).mkfile_pwd - if filename_sxm.class == File + if filename_sxm.class==File @sisu.each {|para| filename_sxm.puts para} filename_sxm.close else puts 'file not created, is directory writable?' diff --git a/lib/sisu/v1/sst_to_s_xml_node.rb b/lib/sisu/v1/sst_to_s_xml_node.rb index 09e9f740..3cbd1156 100644 --- a/lib/sisu/v1/sst_to_s_xml_node.rb +++ b/lib/sisu/v1/sst_to_s_xml_node.rb @@ -22,7 +22,7 @@ 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 + 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 @@ -203,10 +203,10 @@ WOK @@parent[:ocn] end def prt_node - parent.node.each_with_index { |a,n| puts "n.#{n} a.#{a}" unless n == 0 } #x == node + parent.node.each_with_index { |a,n| puts "n.#{n} a.#{a}" unless n==0 } #x==node end def prt_ocn - parent.ocn.each_with_index { |a,n| puts "n.#{n} a.#{a}" unless n == 0 } #x == node + parent.ocn.each_with_index { |a,n| puts "n.#{n} a.#{a}" unless n==0 } #x==node end self end @@ -233,10 +233,10 @@ WOK end if lv.inspect =~/^[1-6]/; @@current=lv end - if o.node == 1 \ - or lv == 1 + if o.node==1 \ + or lv==1 @@parent[:node][o.node]=0 - elsif @@current == lv \ + elsif @@current==lv \ and @@current !=nil if @node[:no][lv-1] != nil @@parent[:node][o.node]=@node[:no][lv-1] @@ -246,14 +246,14 @@ WOK @@parent[:node][o.node]=@node[:no][lv-3] else puts 'error' end - elsif lv == nil - if o.ocn.class == Fixnum \ + elsif lv==nil + if o.ocn.class==Fixnum \ and @@current @@parent[:node][o.node]=@node[:no][@@current] end else puts 'error' end - if @@current == lv \ + if @@current==lv \ and @@current !=nil if @node[:ocn][lv-1] != nil @@parent[:ocn][o.ocn]=@node[:ocn][lv-1] @@ -263,8 +263,8 @@ WOK @@parent[:ocn][o.ocn]=@node[:ocn][lv-3] else puts 'error' end - elsif lv == nil - if o.ocn.class == Fixnum \ + elsif lv==nil + if o.ocn.class==Fixnum \ and @@current @@parent[:ocn][o.ocn]=@node[:ocn][@@current] end @@ -274,7 +274,7 @@ WOK #def node_structure(o='',para='',lv='',hname='') #extracted endnotes # if o.ocn # lv=lv.to_i - # lv=nil if lv == 0 + # lv=nil if lv==0 # build_relationships(o,lv) # end #end @@ -284,7 +284,7 @@ WOK lv=lv.to_i n=lv - 1 n3=lv + 2 - lv=nil if lv == 0 + lv=nil if lv==0 embedded_endnotes(para) if para[@regx] paragraph="#{para[@regx,2]}" @@ -533,13 +533,12 @@ WOK end 6.downto(4) do |x| y=x - 1; v=x - 3 - @@xml[:body] << "#{@tab*5}</content>\n#{@tab*y}</contents#{v}>\n" if @level[x] == true + @@xml[:body] << "#{@tab*5}</content>\n#{@tab*y}</contents#{v}>\n" if @level[x]==true end 3.downto(1) do |x| y=x - 1 - @@xml[:body] << "#{@tab*y}</heading#{x}>\n" if @level[x] == true + @@xml[:body] << "#{@tab*y}</heading#{x}>\n" if @level[x]==true end - #6.downto(1) { |x| y=x - 1; @@xml[:body] << "#{@tab*y}</level #{x}>\n" if @level[x] == true } end def pre rdf=SiSU_XML_tags::RDF.new(@md) @@ -591,7 +590,7 @@ WOK @sisu=new_file_data.scan(/.+/) SiSU_Env::SiSU_file.new(@md).mkdir filename_sxm=SiSU_Env::SiSU_file.new(@md,@md.fn[:sxn]).mkfile_pwd - if filename_sxm.class == File + if filename_sxm.class==File @sisu.each {|para| filename_sxm.puts para} filename_sxm.close else puts 'file not created, is directory writable?' diff --git a/lib/sisu/v1/sysenv.rb b/lib/sisu/v1/sysenv.rb index 945cf07c..1adb3509 100644 --- a/lib/sisu/v1/sysenv.rb +++ b/lib/sisu/v1/sysenv.rb @@ -211,11 +211,11 @@ module SiSU_Env @@default_dir=DEFAULT_DIR m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m stub_pwd=@@pwd[m,1] - @@rc_path=["#@@pwd/_sisu","#@@home/.sisu",@@sisu_etc] + @@rc_path=["#@@pwd/_sisu","#@@home/.sisu","#@@sisu_etc/#{SiSU_version_dir}"] @@yamlrc_path=unless stub_pwd =~/^sisupod$/ - ["#@@pwd/_sisu","#@@home/.sisu",@@sisu_etc] + ["#@@pwd/_sisu","#@@home/.sisu","#@@sisu_etc/#{SiSU_version_dir}"] else #security policy: prevent reading of sisurc.yml in sisupod - ["#@@home/.sisu",@@sisu_etc] + ["#@@home/.sisu","#@@sisu_etc/#{SiSU_version_dir}"] end @@ad_path=unless stub_pwd =~/^sisupod$/ ["#@@pwd/_sisu/skin/yml","#@@home/.sisu/skin/yml","#{@@sisu_etc}/skin/yml"] @@ -2019,7 +2019,6 @@ WOK end def i18n def language # language settings -## m=/.+\/\S+?\~(\S+)/ pwd=Dir.pwd conf=if defined? @rc['default']['language']; @rc['default']['language'] @@ -2075,7 +2074,7 @@ WOK end def odf_structure rm_rf("#{path.processing}/odf") - system("unzip -q #{path.share}/odf/odt.zip -d #{path.processing}") + system("unzip -q #{path.share}/#{SiSU_version_dir}/odf/odt.zip -d #{path.processing}") end def sisupod_gen(fns_pod) pwd=Dir.pwd @@ -2642,11 +2641,13 @@ WOK class Info_version <Info_env include Singleton require 'rbconfig' + @@lib_path=nil def get_version @version={} @pwd=ENV['PWD'] - yst_etc="#{defaults[:sisu_etc]}/version1.yml" - lib_path=`echo $RUBYLIB`.split(':') + yst_etc="#{defaults[:sisu_etc]}/#{SiSU_version_dir}/version.yml" + lib_path=@@lib_path ? @@lib_path : `echo $RUBYLIB`.split(':') + @@lib_path ||=lib_path if File.exist?(yst_etc); @version=YAML::load(File::open(yst_etc)) #unless @@noyaml end @version |