aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2009-12-19 16:28:24 -0500
committerRalph Amissah <ralph@amissah.com>2009-12-19 16:29:28 -0500
commit31d9927f356d05c24d5495bb3e4d59597bcea6eb (patch)
treec1299783d209bc07300986a5e560393fbb1ad2f0
parentdocument samples, v1 minor fixes (diff)
minor code adjustments
-rw-r--r--lib/sisu/v1/cgi_pgsql.rb14
-rw-r--r--lib/sisu/v1/cgi_sqlite.rb4
-rw-r--r--lib/sisu/v1/constants.rb2
-rw-r--r--lib/sisu/v1/css.rb17
-rw-r--r--lib/sisu/v1/dal_images.rb2
-rw-r--r--lib/sisu/v1/db_import.rb2
-rw-r--r--lib/sisu/v1/harvest_authors.rb39
-rw-r--r--lib/sisu/v1/harvest_topics.rb72
-rw-r--r--lib/sisu/v1/sst_from_kdissert.rb4
-rw-r--r--lib/sisu/v1/sst_to_s_xml_dom.rb27
-rw-r--r--lib/sisu/v1/sst_to_s_xml_node.rb33
11 files changed, 100 insertions, 116 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_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_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/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>,&nbsp;}
- end
+ a << (x =~/[0-9]/) ? '' : %{<a href="##{x}">#{x}</a>,&nbsp;}
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>]&nbsp;&nbsp;#{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>]&nbsp;&nbsp;<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/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?'