From e9b1f97a7c9367e64c02c6d68c2155e0d79c572f Mon Sep 17 00:00:00 2001
From: Ralph Amissah
Date: Thu, 5 Sep 2013 23:39:13 -0400
Subject: v4 v5: version & changelog
---
data/doc/sisu/CHANGELOG_v4 | 7 +++++++
data/doc/sisu/CHANGELOG_v5 | 7 +++++++
data/sisu/v4/v/version.yml | 6 +++---
data/sisu/v5/v/version.yml | 6 +++---
4 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4
index d84e0dab..82f82751 100644
--- a/data/doc/sisu/CHANGELOG_v4
+++ b/data/doc/sisu/CHANGELOG_v4
@@ -23,6 +23,13 @@ v2 branch is removed; it is available in sisu =< 3.3.2
%% Reverse Chronological:
+%% 4.2.2.orig.tar.xz (2013-09-05:35/4)
+http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.2.2
+http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.2.2-1
+http://www.jus.uio.no/sisu/pkg/src/sisu_4.2.2.orig.tar.xz
+ sisu_4.2.2.orig.tar.xz
+ sisu_4.2.2-1.dsc
+
%% 4.2.1.orig.tar.xz (2013-08-28:34/3)
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.2.1
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.2.1-1
diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index e7a27cc6..ab3e139e 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -23,6 +23,13 @@ v2 branch is removed; it is available in sisu =< 3.3.2
%% Reverse Chronological:
+%% 5.0.15.orig.tar.xz (2013-09-05:35/4)
+http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.15
+http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.0.15-1
+http://www.jus.uio.no/sisu/pkg/src/sisu_5.0.15.orig.tar.xz
+ sisu_5.0.15.orig.tar.xz
+ sisu_5.0.15-1.dsc
+
%% 5.0.14.orig.tar.xz (2013-08-28:34/3)
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.14
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.0.14-1
diff --git a/data/sisu/v4/v/version.yml b/data/sisu/v4/v/version.yml
index b8b4ff72..4b14daf8 100644
--- a/data/sisu/v4/v/version.yml
+++ b/data/sisu/v4/v/version.yml
@@ -1,5 +1,5 @@
---
-:version: 4.2.1
-:date_stamp: 2013w34/3
-:date: "2013-08-28"
+:version: 4.2.2
+:date_stamp: 2013w35/4
+:date: "2013-09-05"
:project: SiSU
diff --git a/data/sisu/v5/v/version.yml b/data/sisu/v5/v/version.yml
index 50a3185d..c350fdf9 100644
--- a/data/sisu/v5/v/version.yml
+++ b/data/sisu/v5/v/version.yml
@@ -1,5 +1,5 @@
---
-:version: 5.0.14
-:date_stamp: 2013w34/3
-:date: "2013-08-28"
+:version: 5.0.15
+:date_stamp: 2013w35/4
+:date: "2013-09-05"
:project: SiSU
--
cgit v1.2.3
From d756e90690f3a395b52c60843015ba2b8e89df2a Mon Sep 17 00:00:00 2001
From: Ralph Amissah
Date: Thu, 5 Sep 2013 23:40:49 -0400
Subject: v4: dal, grouped text with fontface spanning newlines, partial
solution
* merged from v5
---
data/doc/sisu/CHANGELOG_v4 | 3 +++
lib/sisu/v4/dal_syntax.rb | 35 ++++++++++++++++++++++++++++++-----
2 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4
index 82f82751..f41bafaa 100644
--- a/data/doc/sisu/CHANGELOG_v4
+++ b/data/doc/sisu/CHANGELOG_v4
@@ -30,6 +30,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_4.2.2.orig.tar.xz
sisu_4.2.2.orig.tar.xz
sisu_4.2.2-1.dsc
+* dal, grouped text with fontface spanning newlines, partial solution, merge
+ from 5.0.14
+
%% 4.2.1.orig.tar.xz (2013-08-28:34/3)
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.2.1
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.2.1-1
diff --git a/lib/sisu/v4/dal_syntax.rb b/lib/sisu/v4/dal_syntax.rb
index eb23fd22..c49f41f7 100644
--- a/lib/sisu/v4/dal_syntax.rb
+++ b/lib/sisu/v4/dal_syntax.rb
@@ -308,16 +308,41 @@ module SiSU_DAL_Syntax
end
dob
end
+ def fontface_lines(dob,leader)
+ while (dob.obj =~/#{Mx[:br_nl]}/ \
+ and dob.obj =~/(?:#{leader})([*!\/_#])\{(.+?)\}\1/m) \
+ and $2 =~/#{Mx[:br_nl]}/
+ dob=if dob.obj =~/#{Mx[:br_nl]}/ \
+ and dob.obj =~/(#{leader})([*!\/_#])\{(.+?)\}\2/m
+ lead,fce,txt=$1,$2,$3
+ dob=if txt =~/#{Mx[:br_nl]}/
+ lead_break=if dob.obj =~/^#{Mx[:br_nl]}/
+ dob.obj=dob.obj.sub(/^#{Mx[:br_nl]}/,'')
+ Mx[:br_nl]
+ else ''
+ end
+ txt="#{lead_break}#{fce}\{" + txt.split(Mx[:br_nl]).join("\}#{fce}#{Mx[:br_nl]}#{fce}\{") + "\}#{fce}"
+ dob.obj=dob.obj.sub(/(?:^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>)([*!\/_#])\{.+?\}\1/m,"#{lead}#{txt}")
+ dob
+ else dob
+ end
+ end
+ dob
+ end
+ dob
+ end
def fontface(dob)
- dob.obj=dob.obj.gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>)\*\{(.+?)\}\*/m,
+ leader=/^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>/
+ dob=fontface_lines(dob,leader)
+ dob.obj=dob.obj.gsub(/(#{leader})\*\{(.+?)\}\*/m,
"\\1#{@emph[:o]}\\2#{@emph[:c]}"). #emphasis
- gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>)!\{(.+?)\}!/m,
+ gsub(/(#{leader})!\{(.+?)\}!/m,
"\\1#{Mx[:fa_bold_o]}\\2#{Mx[:fa_bold_c]}"). #bold
- gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\(|\>)\/\{(.+?)\}\//m,
+ gsub(/(#{leader})\/\{(.+?)\}\//m,
"\\1#{Mx[:fa_italics_o]}\\2#{Mx[:fa_italics_c]}"). #italics
- gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>)_\{(.+?)\}_/m,
+ gsub(/(#{leader})_\{(.+?)\}_/m,
"\\1#{Mx[:fa_underscore_o]}\\2#{Mx[:fa_underscore_c]}"). #underscore
- gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}#{Mx[:lnk_o]}#{Mx[:br_nl]}#{Mx[:br_line]}#{Mx[:br_paragraph]}#{Mx[:tc_c]}#{Mx[:tc_p]}]|[\(\[\{]|\>)#\{(.+?)\}#/m,
+ gsub(/(#{leader})#\{(.+?)\}#/m,
"\\1#{Mx[:fa_monospace_o]}\\2#{Mx[:fa_monospace_c]}"). #monospace
gsub(/(^|#{Mx[:gl_c]}|\s+|['"]|[#{Mx[:nbsp]}#{Mx[:fa_o_c]}#{Mx[:fa_c]}]|\(|\>)\"\{(.+?)\}\"/m,
"\\1#{Mx[:fa_cite_o]}\\2#{Mx[:fa_c_o]}cite#{Mx[:fa_c]}"). #cite /blockquote?
--
cgit v1.2.3
From 55617009d55521dc4c9bf3e998dc8354a74fb8e1 Mon Sep 17 00:00:00 2001
From: Ralph Amissah
Date: Thu, 5 Sep 2013 23:42:16 -0400
Subject: v4 v5: dal, book index markup, round delimiters: allow spaces or
space & newline
* allow spaces on both sides of delimiters, or a space before & newline
following a delimiter \s+[:|;](\s+|\n) [else parses as before no spaces]
---
data/doc/sisu/CHANGELOG_v4 | 4 ++++
data/doc/sisu/CHANGELOG_v5 | 4 ++++
lib/sisu/v4/dal_doc_str.rb | 3 +++
lib/sisu/v5/dal_doc_str.rb | 3 +++
4 files changed, 14 insertions(+)
diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4
index f41bafaa..d7e1b7ea 100644
--- a/data/doc/sisu/CHANGELOG_v4
+++ b/data/doc/sisu/CHANGELOG_v4
@@ -33,6 +33,10 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_4.2.2.orig.tar.xz
* dal, grouped text with fontface spanning newlines, partial solution, merge
from 5.0.14
+* dal, book index markup, allow spaces on both sides of delimiters, or a space
+ before and newline following a delimiter \s+[:|;](\s+|\n)
+ [else parses as before no spaces]
+
%% 4.2.1.orig.tar.xz (2013-08-28:34/3)
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.2.1
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.2.1-1
diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index ab3e139e..54b251a7 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -30,6 +30,10 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.0.15.orig.tar.xz
sisu_5.0.15.orig.tar.xz
sisu_5.0.15-1.dsc
+* dal, book index markup, allow spaces on both sides of delimiters, or a space
+ before and newline following a delimiter \s+[:|;](\s+|\n)
+ [else parses as before no spaces]
+
%% 5.0.14.orig.tar.xz (2013-08-28:34/3)
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.14
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.0.14-1
diff --git a/lib/sisu/v4/dal_doc_str.rb b/lib/sisu/v4/dal_doc_str.rb
index e7d9917b..2a3e6b83 100644
--- a/lib/sisu/v4/dal_doc_str.rb
+++ b/lib/sisu/v4/dal_doc_str.rb
@@ -203,6 +203,9 @@ module SiSU_DAL_DocumentStructureExtract
and @@flag[:table]==:off
unless t_o =~/^(?:@\S+?:|%+)\s/ # extract book index for paragraph if any
idx=if t_o=~/^=\{(.+)\}\s*$\Z/m; m=$1
+ m=m.split(/\n/).join(' ').
+ gsub(/\s+([|:;])\s+/,'\1').
+ gsub(/\s+([+])\s+/,'\1')
t_o=t_o.gsub(/\n=\{.+\}\s*$\Z/m,'')
m
else nil
diff --git a/lib/sisu/v5/dal_doc_str.rb b/lib/sisu/v5/dal_doc_str.rb
index 612d2905..83493c48 100644
--- a/lib/sisu/v5/dal_doc_str.rb
+++ b/lib/sisu/v5/dal_doc_str.rb
@@ -203,6 +203,9 @@ module SiSU_DAL_DocumentStructureExtract
and @@flag[:table]==:off
unless t_o =~/^(?:@\S+?:|%+)\s/ # extract book index for paragraph if any
idx=if t_o=~/^=\{(.+)\}\s*$\Z/m; m=$1
+ m=m.split(/\n/).join(' ').
+ gsub(/\s+([|:;])\s+/,'\1').
+ gsub(/\s+([+])\s+/,'\1')
t_o=t_o.gsub(/\n=\{.+\}\s*$\Z/m,'')
m
else nil
--
cgit v1.2.3
From d711e3f86c3c534be2fa84aa0e6dea806d4fb9d1 Mon Sep 17 00:00:00 2001
From: Ralph Amissah
Date: Thu, 5 Sep 2013 23:44:05 -0400
Subject: v4 v5: vim syntax, book index markup, hilight delimeters
---
data/doc/sisu/CHANGELOG_v4 | 2 ++
data/doc/sisu/CHANGELOG_v5 | 2 ++
data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim | 10 +++++++---
3 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/data/doc/sisu/CHANGELOG_v4 b/data/doc/sisu/CHANGELOG_v4
index d7e1b7ea..2c8dc9f8 100644
--- a/data/doc/sisu/CHANGELOG_v4
+++ b/data/doc/sisu/CHANGELOG_v4
@@ -37,6 +37,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_4.2.2.orig.tar.xz
before and newline following a delimiter \s+[:|;](\s+|\n)
[else parses as before no spaces]
+* vim syntax, book index markup, hilight delimeters
+
%% 4.2.1.orig.tar.xz (2013-08-28:34/3)
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_4.2.1
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_4.2.1-1
diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index 54b251a7..466513b2 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -34,6 +34,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.0.15.orig.tar.xz
before and newline following a delimiter \s+[:|;](\s+|\n)
[else parses as before no spaces]
+* vim syntax, book index markup, hilight delimeters
+
%% 5.0.14.orig.tar.xz (2013-08-28:34/3)
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/sisu_5.0.14
http://sources.sisudoc.org/gitweb/?p=code/sisu.git;a=shortlog;h=refs/tags/debian/sisu_5.0.14-1
diff --git a/data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim b/data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim
index 7666b75f..a0f17272 100644
--- a/data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim
+++ b/data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim
@@ -1,7 +1,7 @@
" SiSU Vim syntax file
" SiSU Maintainer: Ralph Amissah
-" SiSU Markup: SiSU (sisu-4.2.1)
-" Last Change: 2013-08-28
+" SiSU Markup: SiSU (sisu-4.2.2)
+" Last Change: 2013-09-02
" URL:
"(originally looked at Ruby Vim by Mirko Nasato)
@@ -45,6 +45,8 @@ if !exists("sisu_no_identifiers")
syn match sisu_sub_header_original "^\s\+:\(publisher\|date\|language\|lang_char\|institution\|nationality\|source\):\s"
syn match sisu_sub_header_make "^\s\+:\(headings\|num_top\|breaks\|language\|italics\|bold\|emphasis\|substitute\|omit\|plaintext_wrap\|texpdf_font_mono\|texpdf_font\|stamp\|promo\|ad\|manpage\|home_button_text\|home_button_image\|cover_image\|footer\):\s"
syn match sisu_sub_header_notes "^\s\+:\(description\|abstract\|comment\|coverage\|relation\|source\|history\|type\|format\|prefix\|prefix_[ab]\|suffix\):\s"
+ syn match sisu_within_index_ignore "\S\+[:;]\(\s\+\|$\)"
+ syn match sisu_within_index "[:|;]\|+\d\+"
"% "semantic markers: (ignore)
syn match sisu_sem_marker ";{\|};[a-z._]*[a-z]"
@@ -142,7 +144,7 @@ syn region sisu_normal contains=sisu_strikeout,sisu_identifier,sisu_content_endn
"% "Font Face Curly Brackets:
"syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_sem start="\S\+:{" end="}:[^<>,.!?:; ]\+" oneline
" book index:
-syn region sisu_index matchgroup=sisu_index_block start="^={" end="}"
+syn region sisu_index contains=sisu_within_index_ignore,sisu_within_index matchgroup=sisu_index_block start="^={" end="}"
" emphasis:
syn region sisu_bold contains=sisu_strikeout,sisu_number,sisu_bold,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="\*{" end="}\*"
" bold:
@@ -250,6 +252,8 @@ hi def link sisu_index SpecialKey
hi def link sisu_index_block Visual
hi def link sisu_content_endnote Special
hi def link sisu_control Delimiter
+hi def link sisu_within_index Delimiter
+hi def link sisu_within_index_ignore SpecialKey
hi def link sisu_ocn Include
hi def link sisu_number Number
hi def link sisu_identifier Function
--
cgit v1.2.3
From 6fd685918309318549009821d73d87d85c558017 Mon Sep 17 00:00:00 2001
From: Ralph Amissah
Date: Thu, 5 Sep 2013 23:45:58 -0400
Subject: v5: dal, objects, store book index as hash (simplify downstream
processing)
---
data/doc/sisu/CHANGELOG_v5 | 2 +
lib/sisu/v5/dal_doc_str.rb | 53 +++++++++++++++++++++++-
lib/sisu/v5/dal_idx.rb | 101 ++++++++++++++-------------------------------
3 files changed, 84 insertions(+), 72 deletions(-)
diff --git a/data/doc/sisu/CHANGELOG_v5 b/data/doc/sisu/CHANGELOG_v5
index 466513b2..9ca1e163 100644
--- a/data/doc/sisu/CHANGELOG_v5
+++ b/data/doc/sisu/CHANGELOG_v5
@@ -30,6 +30,8 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_5.0.15.orig.tar.xz
sisu_5.0.15.orig.tar.xz
sisu_5.0.15-1.dsc
+* dal, objects, store book index as hash (simplify downstream processing)
+
* dal, book index markup, allow spaces on both sides of delimiters, or a space
before and newline following a delimiter \s+[:|;](\s+|\n)
[else parses as before no spaces]
diff --git a/lib/sisu/v5/dal_doc_str.rb b/lib/sisu/v5/dal_doc_str.rb
index 83493c48..5b6c03bf 100644
--- a/lib/sisu/v5/dal_doc_str.rb
+++ b/lib/sisu/v5/dal_doc_str.rb
@@ -168,6 +168,54 @@ module SiSU_DAL_DocumentStructureExtract
end
[str,tags]
end
+ def rgx_idx_ocn_seg
+ @rgx_idx_ocn_seg=/(.+?)\s*[+](\d+)/
+ end
+ def construct_idx_array_and_hash(idxraw)
+ idx_array_raw=idxraw.scan(/[^;]+/)
+ idx_hash,idx_array,idx_lst={},[],[]
+ idx_array_raw.each do |idx|
+ idx_lst=case idx
+ when /\S+?\s*:/
+ idx_couplet_tmp=[]
+ idx_couplet=idx.scan(/\s*[^:]+\s*/)
+ if idx_couplet[1] =~/[|]/
+ idx_couplet_tmp << idx_couplet[0] << idx_couplet[1].scan(/\s*[^|]+\s*/)
+ else
+ idx_couplet_tmp << idx_couplet[0] << [idx_couplet[1]]
+ end
+ idx_couplet=idx_couplet_tmp
+ else [idx]
+ end
+ term_nodes=[]
+ idx_lst.each do |term_node|
+ case term_node
+ when String
+ term_node=term_node[0].chr.capitalize + term_node[1,term_node.length]
+ term_node=(term_node =~/.+?[+]\d+/) \
+ ? term_node
+ : (term_node + '+0')
+ term_nodes << term_node
+ @use,plus=rgx_idx_ocn_seg.match(term_node)[1,2]
+ idx_hash[@use]={ sub: [], plus: plus } unless idx_hash[@use] and defined? idx_hash[@use]
+ when Array
+ subterm_nodes=[]
+ term_node.each do |subterm_node|
+ subterm_node=(subterm_node =~/.+?[+]\d+/) \
+ ? subterm_node
+ : (subterm_node + '+0')
+ subterm_nodes << subterm_node
+ sub,sub_plus=rgx_idx_ocn_seg.match(subterm_node)[1,2]
+ idx_hash[@use]={ sub: [], plus: 0 } unless idx_hash[@use] and defined? idx_hash[@use]
+ idx_hash[@use][:sub] << {sub.strip => { plus: sub_plus }}
+ end
+ term_nodes << subterm_nodes
+ end
+ end
+ idx_array << term_nodes
+ end
+ { hash: idx_hash, array: idx_array }
+ end
def identify_parts
tuned_file=[]
@tuned_block,@tuned_code=[],[]
@@ -205,9 +253,10 @@ module SiSU_DAL_DocumentStructureExtract
idx=if t_o=~/^=\{(.+)\}\s*$\Z/m; m=$1
m=m.split(/\n/).join(' ').
gsub(/\s+([|:;])\s+/,'\1').
- gsub(/\s+([+])\s+/,'\1')
+ gsub(/\s+([+]\d+)\s+/,'\1')
t_o=t_o.gsub(/\n=\{.+\}\s*$\Z/m,'')
- m
+ idx_array_and_hash=construct_idx_array_and_hash(m)
+ idx_array_and_hash[:hash]
else nil
end
end
diff --git a/lib/sisu/v5/dal_idx.rb b/lib/sisu/v5/dal_idx.rb
index b87797bc..86ef06f8 100644
--- a/lib/sisu/v5/dal_idx.rb
+++ b/lib/sisu/v5/dal_idx.rb
@@ -84,13 +84,11 @@ module SiSU_DAL_BookIndex
@seg=dob.name
end
if defined? dob.idx \
- and dob.idx.is_a?(String) \
- and not dob.idx.empty?
- idx_array << "#{dob.idx}~#{dob.ocn}~#{@seg}"
+ and dob.idx.is_a?(Hash)
+ idx_array << {idx: dob.idx, ocn: dob.ocn, seg: @seg }
end
tuned_file << dob if dob
end
- idx_array=construct_idx_array(idx_array) if idx_array.length > 0
if idx_array.length > 0
the_idx=construct_book_index(idx_array)
sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx,xhtml_idx=nil,nil,nil,nil
@@ -101,61 +99,28 @@ module SiSU_DAL_BookIndex
end
[tuned_file,sisu_markup_idx_rel,sisu_markup_idx_rel_html_seg,html_idx,xhtml_idx]
end
- def construct_idx_array(idx_array)
- idx_lst=[]
- idx_array.each do |idx|
- idx_list,ocn,seg=@rgx_idx_ocn_seg.match(idx)[1..3]
- idx_lst <<=if idx_list =~/;/
- g=idx_list.scan(/[^;]+/)
- idxl=[]
- g.each do |i|
- i=i.strip
- idxl << { rough_idx: i, ocn: ocn, seg: seg }
- end
- idxl
- else { rough_idx: idx_list, ocn: ocn, seg: seg }
- end
- end
- idx_lst=idx_lst.flatten
- end
def construct_book_index(idx_array)
the_idx={}
idx_array.each do |idx|
- if idx[:rough_idx] =~/[|]/ \
- && idx[:rough_idx] !~/[:]/
- if @md.opt.cmd =~/[MVv]/
- p 'book index error? --> ' + idx[:rough_idx]
- end
- else
- idx_lst=idx[:rough_idx].scan(/[^|:]+/)
- idx_lst[0]=idx_lst[0].strip
- if idx_lst[0] =~/.+?\+\d+/
- use=/(.+?)\+(?:\d+)/.match(idx_lst[0])[1]
- else use=idx_lst[0]
- end
- use=use[0].chr.capitalize + use[1,use.length]
- the_idx[use]={} unless the_idx[use] and defined? the_idx[use]
- idx_lst.each do |i|
- i=i.strip
- i,r=/(.+?)\+(\d+)/.match(i)[1,2] if i =~/.+?\+\d+/
- x=if idx_lst.length==1 or idx_lst[0].gsub(/\+\d+/,'')==i
- the_idx[use]['term_node_lev1']=[] unless the_idx[use]['term_node_lev1'] and defined? the_idx[use]['term_node_lev1']
- x=if r
- the_idx[use]['term_node_lev1'] << { ocn: idx[:ocn], range: "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", seg: idx[:seg] }
- "#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}"
- else
- the_idx[use]['term_node_lev1'] << { ocn: idx[:ocn], seg: idx[:seg] }
- "#{i} #{idx[:ocn]}"
- end
- else
- the_idx[use]['term_node_lev2']={} unless the_idx[use]['term_node_lev2'] and defined? the_idx[use]['term_node_lev2']
- the_idx[use]['term_node_lev2'][i]=[] unless the_idx[use]['term_node_lev2'][i] and defined? the_idx[use]['term_node_lev2'][i]
- x=if r
- the_idx[use]['term_node_lev2'][i] << { ocn: idx[:ocn], range: "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", seg: idx[:seg] }
- "#{idx_lst[0]}:#{i} #{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}"
- else
- the_idx[use]['term_node_lev2'][i] << { ocn: idx[:ocn], seg: idx[:seg] }
- "#{idx_lst[0]}:#{i} #{idx[:ocn]}"
+ idx[:idx].each_pair do |term,term_info|
+ location=(term_info[:plus].to_i > 0) \
+ ? (%{#{idx[:ocn]}-#{idx[:ocn].to_i + term_info[:plus].to_i}})
+ : idx[:ocn].to_s
+ the_idx[term]={} unless the_idx[term] and defined? the_idx[term]
+ the_idx[term]['node_0_terms']=[] unless the_idx[term]['node_0_terms'] and defined? the_idx[term]['node_0_terms']
+ the_idx[term]['node_0_terms'] << { ocn: idx[:ocn], range: location, seg: idx[:seg] }
+ if term_info[:sub].is_a?(Array) \
+ and term_info[:sub].length > 0
+ term_info[:sub].each do |y|
+ y.each_pair do |subterm,subterm_info|
+ location=(subterm_info[:plus].to_i > 0) \
+ ? (%{#{idx[:ocn]}-#{idx[:ocn].to_i + subterm_info[:plus].to_i}})
+ : idx[:ocn].to_s
+ the_idx[term]={} unless the_idx[term] and defined? the_idx[term]
+ the_idx[term]['node_0_terms']=[] unless the_idx[term]['node_0_terms'] and defined? the_idx[term]['node_0_terms']
+ the_idx[term]['node_1_subterms']={} unless the_idx[term]['node_1_subterms'] and defined? the_idx[term]['node_1_subterms']
+ the_idx[term]['node_1_subterms'][subterm]=[] unless the_idx[term]['node_1_subterms'][subterm] and defined? the_idx[term]['node_1_subterms'][subterm]
+ the_idx[term]['node_1_subterms'][subterm] << { ocn: idx[:ocn], range: location, seg: idx[:seg] }
end
end
end
@@ -230,8 +195,8 @@ module SiSU_DAL_BookIndex
p 'array error? -->'
print x
elsif x.is_a?(Hash)
- if x['term_node_lev1'].is_a?(Array)
- x['term_node_lev1'].each do |a|
+ if x['node_0_terms'].is_a?(Array)
+ x['node_0_terms'].each do |a|
if a[:range]
idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}/#{a[:seg]}.html##{a[:ocn]}#{Mx[:rel_c]}, }
idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{Mx[:lnk_o]}#{a[:range]}#{Mx[:lnk_c]}#{Mx[:rel_o]}#{a[:ocn]}#{Mx[:rel_c]}, }
@@ -250,11 +215,9 @@ module SiSU_DAL_BookIndex
idx[:html][@q]=idx[:html][@q] + '
'
idx[:xhtml][@r]=idx[:xhtml][@r] + ''
end
- if x['term_node_lev2']
- m=x['term_node_lev2']
- m=m.sort
- m.each do |k,y|
- if k !~/term_node_lev1/
+ if x['node_1_subterms']
+ x['node_1_subterms'].sort.each do |k,y|
+ if k !~/node_0_terms/
idx[:sst_rel_html_seg][@o]=idx[:sst_rel_html_seg][@o] + %{#{k}, }
idx[:sst_rel][@t]=idx[:sst_rel][@t] + %{#{k}, }
idx[:html][@q]=idx[:html][@q] + %{\n#{k}, }
@@ -298,8 +261,8 @@ module SiSU_DAL_BookIndex
p 'array error? -->'
print x
elsif x.is_a?(Hash)
- if x['term_node_lev1'].is_a?(Array)
- x['term_node_lev1'].each do |a|
+ if x['node_0_terms'].is_a?(Array)
+ x['node_0_terms'].each do |a|
if a[:range]
print a[:range] + ', '
elsif a[:ocn]
@@ -308,11 +271,9 @@ module SiSU_DAL_BookIndex
end
end
end
- if x['term_node_lev2']
- m=x['term_node_lev2']
- m=m.sort
- m.each do |k,y|
- if k !~/term_node_lev1/
+ if x['node_1_subterms']
+ x['node_1_subterms'].sort.each do |k,y|
+ if k !~/node_0_terms/
print "\n\t" + k + ', '
y.each do |z|
if z[:range]
--
cgit v1.2.3