From d6ef30b3f58d9278c11ca7de73b012968a35ba9b Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 1 Oct 2012 16:17:42 -0400 Subject: v3: header @classify: :topic_register: provide greater classification "depth" * param, manifest * harvest_topics --- data/doc/sisu/CHANGELOG_v3 | 4 ++++ lib/sisu/v3/harvest_topics.rb | 4 ++-- lib/sisu/v3/manifest.rb | 8 +++++++- lib/sisu/v3/param.rb | 17 ++++++++++++----- 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] << %{

#{v}

\n} + if v.is_a?(Array) + v.each do |w,i| + @manifest[:html] << %{

#{w}

\n} + end + else + @manifest[:html] << %{

#{v}

\n} + end end else @manifest[:html] << %{

#{st}

\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 -- cgit v1.2.3