aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2012-10-01 16:17:42 -0400
committerRalph Amissah <ralph@amissah.com>2012-10-01 16:17:42 -0400
commitd6ef30b3f58d9278c11ca7de73b012968a35ba9b (patch)
treeaae88c7355d95c9fc85e7854e9d58b09d7d4ee6e
parentv3: dal, sysenv, file processing, split objects; remove ref to old ruby (diff)
v3: header @classify: :topic_register: provide greater classification "depth"
* param, manifest * harvest_topics
-rw-r--r--data/doc/sisu/CHANGELOG_v34
-rw-r--r--lib/sisu/v3/harvest_topics.rb4
-rw-r--r--lib/sisu/v3/manifest.rb8
-rw-r--r--lib/sisu/v3/param.rb17
4 files changed, 25 insertions, 8 deletions
diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3
index 6a3e78f4..a48f5fe9 100644
--- a/data/doc/sisu/CHANGELOG_v3
+++ b/data/doc/sisu/CHANGELOG_v3
@@ -71,6 +71,10 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.3.3.orig.tar.xz
* v3: html, epub, fix
* group text, bullet
+* v3: header @classify: :topic_register: provide greater classification "depth"
+ * param, manifest
+ * harvest_topics
+
* v3: dal, sysenv
* markup file processing, change to sourcefile readlines & split of sourcefile array
* removal of RUBY_VERSION references to older versions of ruby
diff --git a/lib/sisu/v3/harvest_topics.rb b/lib/sisu/v3/harvest_topics.rb
index 445d8c8e..762f4be0 100644
--- a/lib/sisu/v3/harvest_topics.rb
+++ b/lib/sisu/v3/harvest_topics.rb
@@ -104,10 +104,10 @@ module SiSU_HarvestTopics
rgx[:author]=/^@creator:(?:[ ]+|.+?:author:[ ]+)(.+?)(?:\||\n)/m
rgx[:title]=/^@title:[ ]+(.+)/
rgx[:subtitle]=/^@title:.+?:subtitle:[ ]+(.+?)\n/m
- rgx[:idx]=/^@classify:.+?:topic_register:[ ]+(.+?)\n/m
+ rgx[:idx]=/^@classify:.+?:topic_register:[ ]+(.+?)(?:\n\n|\n\s+:\S|\n%)/m
data.each do |para|
if para=~ rgx[:idx]
- @idx_list=rgx[:idx].match(para)[1]
+ @idx_list=(rgx[:idx].match(para)[1]).split(/\s*\n\s*/).join
end
if para=~ rgx[:title]
@title=rgx[:title].match(para)[1]
diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb
index c2490837..58f2d8eb 100644
--- a/lib/sisu/v3/manifest.rb
+++ b/lib/sisu/v3/manifest.rb
@@ -699,7 +699,13 @@ WOK
t.each_with_index do |st,i|
if st.is_a?(Array)
st.each do |v|
- @manifest[:html] << %{<p class="it#{i}">#{v}</p>\n}
+ if v.is_a?(Array)
+ v.each do |w,i|
+ @manifest[:html] << %{<p class="it#{i}">#{w}</p>\n}
+ end
+ else
+ @manifest[:html] << %{<p class="it#{i}">#{v}</p>\n}
+ end
end
else @manifest[:html] << %{<p class="it#{i}">#{st}</p>\n}
end
diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb
index 492b8044..bffba529 100644
--- a/lib/sisu/v3/param.rb
+++ b/lib/sisu/v3/param.rb
@@ -227,6 +227,13 @@ module SiSU_Param
if x =~/^%\s/ #ignore comment
elsif x =~/:(\S+?):\s+(.+)/
a,b=/:(\S+?):\s+(.+)\Z/m.match(x)[1,2]
+ b=if b =~/\n/m
+ (b =~/;\n/m) \
+ ? (b.split(/;\s*\n\s*/).join(';'))
+ : (b.split(/\s*\n\s*/).join(' '))
+ else
+ b
+ end
elsif i == 0
a='main'
b=x
@@ -598,7 +605,7 @@ module SiSU_Param
self
end
def classify
- a=@s.split(/\n%\s.+?$|[ ]*\n[ ]*/m)
+ a=@s.split(/(\n%\s.+?$|[ ]*)(?:\n[ ]*(?=:)|\Z)/m)
@h=build_hash(a)
def coverage
s=@h['coverage']
@@ -1424,16 +1431,16 @@ module SiSU_Param
and @classify.topic_register.is_a?(String) \
and @classify.topic_register.length >3
topic_register=@classify.topic_register
- u=topic_register.scan(/[^;]+/)
+ u=topic_register.scan(/[^;]+/m).sort
v=[]
u.each do |l|
- v << l.scan(/[^:]+/)
+ v << l.scan(/[^:]+/m)
end
v.each do |m|
- m[-1]=m[-1].scan(/[^|]+/) if m[-1] =~/[|]/
+ m[-1]=m[-1].scan(/[^|]+/m) if m[-1] =~/[|]/m
@topic_register_array << m
end
- @topic_register_array=@topic_register_array.sort
+ @topic_register_array
end
if @i18n
@i18n=@i18n.uniq