From bb1e2142668528a5e584b6b493c00f23aa59c637 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Fri, 12 Sep 2008 01:46:25 -0400 Subject: dal_idx: strip before sort; fix bug where first lev is range --- .../conf/editor-syntax-etc/vim/syntax/sisu.vim | 4 +++- lib/sisu/v0/dal_idx.rb | 26 ++++++++++++---------- 2 files changed, 17 insertions(+), 13 deletions(-) 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 f29bc268..11e8a629 100644 --- a/data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim +++ b/data/sisu/conf/editor-syntax-etc/vim/syntax/sisu.vim @@ -81,6 +81,7 @@ syn region sisu_normal contains=sisu_strikeout,sisu_identifier,sisu_content_endn syn region sisu_comment matchgroup=sisu_comment start="^%\{1,2\} " end="$" "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 +syn region sisu_index matchgroup=sisu_index_block start="^={" end="}" syn region sisu_control contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="\*{" end="}\*" syn region sisu_control contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="!{" end="}!" syn region sisu_underline contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_fontface start="_{" end="}_" @@ -162,7 +163,6 @@ hi def link sisu_linked String hi def link sisu_fontface Include hi def link sisu_strikeout DiffDelete hi def link sisu_content_alt Special -hi def link sisu_sem_content String hi def link sisu_sem_content SpecialKey hi def link sisu_sem_block Special hi def link sisu_sem_marker Visual @@ -173,6 +173,8 @@ hi def link sisu_sem_ex_marker_block Folded hi def link sisu_sem_ex_content Comment "hi def link sisu_sem_ex_content SpecialKey hi def link sisu_sem_ex_block Comment +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 Define hi def link sisu_ocn Include diff --git a/lib/sisu/v0/dal_idx.rb b/lib/sisu/v0/dal_idx.rb index 74ec0d15..f8eb5e45 100644 --- a/lib/sisu/v0/dal_idx.rb +++ b/lib/sisu/v0/dal_idx.rb @@ -104,17 +104,6 @@ module SiSU_book_index end [tuned_file,sisu_markup_idx,html_idx] end - def output_html_idx(html_idx) - if @md.book_index - path="#{@env.path.output}/#{@md.fnb}" - Dir.mkdir(path) unless FileTest.directory?(path) - html_index_file=File.new("#{path}/#{@md.fn[:book_index]}",'w') - puts "#{path}/#{@md.fn[:book_index]}" - #html_file(the_idx) - html_idx.each {|x| html_index_file << x } - html_index_file.close - end - end def construct_idx_array(idx_array) idx_lst=[] idx_array.each do |idx| @@ -123,6 +112,7 @@ module SiSU_book_index g=idx_list.scan(/[^;]+/) idxl=[] g.each do |i| + i.strip! idxl << { :rough_idx => i, :ocn => ocn, :seg => seg } end idxl @@ -136,6 +126,7 @@ module SiSU_book_index @the_idx={} idx_array.each do |idx| idx_lst=idx[:rough_idx].scan(/[^|:]+/) + idx_lst[0].strip! if idx_lst[0] =~/.+?\+\d+/ use,plus=/(.+?)\+(\d+)/.match(idx_lst[0])[1,2] else use=idx_lst[0] @@ -144,7 +135,7 @@ module SiSU_book_index idx_lst.each do |i| i.strip! i,r=/(.+?)\+(\d+)/.match(i)[1,2] if i =~/.+?\+\d+/ - x=if idx_lst.length == 1 or idx_lst[0] == i + x=if idx_lst.length == 1 or idx_lst[0].gsub(/\+\d+/,'') == i @the_idx[use]['a1']=[] unless @the_idx[use]['a1'] and defined? @the_idx[use]['a1'] x=if r @the_idx[use]['a1'] << { :ocn => idx[:ocn], :range => "#{idx[:ocn]}-#{idx[:ocn].to_i+r.to_i}", :seg => idx[:seg] } @@ -278,6 +269,17 @@ module SiSU_book_index end end end + def output_html_idx(html_idx) + if @md.book_index + path="#{@env.path.output}/#{@md.fnb}" + Dir.mkdir(path) unless FileTest.directory?(path) + html_index_file=File.new("#{path}/#{@md.fn[:book_index]}",'w') + puts "#{path}/#{@md.fn[:book_index]}" + #html_file(the_idx) + html_idx.each {|x| html_index_file << x } + html_index_file.close + end + end def clean_and_insert_index(data,sisu_markup_idx) tuned_file=[] data.each do |para| -- cgit v1.2.3