From 37f81bc4aa6579f269021dfdb3ab84b51f531634 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 8 Oct 2007 12:23:05 +0100 Subject: dal, shortcut for available outputs, present as grouped text object this makes more sense for search results - matches all available versions of a document [affects document objects and numbering where used, hence version number bump] --- lib/sisu/v0/dal.rb | 90 ++++++++++++++++++++++++++------------------ lib/sisu/v0/html.rb | 24 ++++-------- lib/sisu/v0/html_segments.rb | 31 ++++++++------- lib/sisu/v0/odf.rb | 8 +++- lib/sisu/v0/param.rb | 8 ++-- lib/sisu/v0/shared_xml.rb | 3 ++ lib/sisu/v0/texpdf.rb | 27 +++++++------ lib/sisu/v0/xml.rb | 6 ++- 8 files changed, 109 insertions(+), 88 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v0/dal.rb b/lib/sisu/v0/dal.rb index 15d1c55c..95208e2f 100644 --- a/lib/sisu/v0/dal.rb +++ b/lib/sisu/v0/dal.rb @@ -188,6 +188,7 @@ module SiSU_DAL @metafile="#{@env.path.dal}/#{@md.fns}.meta" my_make_source_file=SiSU_Env::Create_file.new(@md.cmd,@md.fns) data=data.join.split("\n\n") + data=expand_insertions?(data) data=SiSU_document_structure::Code.new(@md,data).code data_new=[] data.each do |x| @@ -354,41 +355,30 @@ module SiSU_DAL end file_type_names=file_type_names.flatten end - def substitutions_and_insertions?(data) - tuned_file=[] - if data[0] =~ /^#!\s*(?:\/usr\/bin\/env sisu|\/usr\/bin\/sisu)/ # remove bang from top #! (however file is stripped, so will be removed provided no content preceeds it) - data[0].gsub!(/^#!\s*\/usr\/bin\/sisu/,'') - data[0].gsub!(/^#!\s*\/usr\/bin\/env sisu/,'') - end - if data[0] =~ /^(SiSU\s+[\d.]*|sisu-[\d.]+)$/ # SiSU identifier - data[0].gsub!(/^(SiSU\s*[\d.]*)$/,'% \1') - data[0].gsub!(/^(sisu-[\d.]+)$/,'% \1') - end + def expand_insertions?(data) + tuned_file,tuned_file_tmp=[],[] data.each do |para| - para=if @md.markup_version.to_f >= 0.38 - SiSU_document_structure::Structure.new(@md,para).structure_markup_normalize - else para - end - #para.gsub!(//,'\1') #consider, would permit use of text hyperlinks if desired, dal_syntax more appropriate? - para.gsub!(/^((?:[1-9]|:?[A-C])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12 - if para =~/^@\S+?:/ - para.gsub!(/^@(\S+?):\s+/,'0~\1 ') - para.gsub!(/^@(\S+?):([+-])\s+/,'0~\1\2 ') - end if para !~/^%+\s/ and - para =~/^(?:_\*\s+)?\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.(?:sst|ssm)\b)(?:\s+~\{.+?\}~)?(?:\s+\*~\S+)*\s*$/ + para =~/\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.(?:sst|ssm)\b)(?:\s+~\{.+?\}~)?(?:\s+\*~\S+)*\s*$/ + #para =~/^(?:_\*\s+)?\{(?:~\^\s+)?(.+?)\s\[(?:\d(?:[sS]*))\]\}(?:\.\.\/\S+?\/|\S+?\.(?:sst|ssm)\b)(?:\s+~\{.+?\}~)?(?:\s+\*~\S+)*\s*$/ txt,cmd,source,url_dir,note,manifest=nil,nil,nil,nil,nil,nil url_and_stub=SiSU_Env::Info_env.new.url if defined? url_and_stub.remote @output_url="#{url_and_stub.remote}" - if para =~/\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm])(\s+~\{.+?\}~)?/ + if para =~/(.+?)\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm])(\s+~\{.+?\}~)?/m + #syntax e.g.: { "Sphinx or Robot", Leena Krohn [3sS]}sphinx_or_robot.leena_krohn.1996.sst + pre,txt,cmd,source,url_dir,note="#{$1.strip} ",$2,$3,$4,$5,$6 + elsif para =~/(.+?)\{(.+?)\s\[(\d[sS]*)\]\}\.\.\/(\S+?)\/(\s+~\{.+?\}~)?/m + #syntax e.g.: { "Sphinx or Robot", Leena Krohn [3sS]}../sphinx_or_robot.leena_krohn.1996/ + pre,txt,cmd,url_dir,note="#{$1.strip} ",$2,$3,$4,$5 + elsif para =~/\{(.+?)\s\[(\d[sS]*)\]\}((\S+?)\.ss[tm])(\s+~\{.+?\}~)?/ #syntax e.g.: { "Sphinx or Robot", Leena Krohn [3sS]}sphinx_or_robot.leena_krohn.1996.sst - txt,cmd,source,url_dir,note=$1,$2,$3,$4,$5 + pre,txt,cmd,source,url_dir,note='',$1,$2,$3,$4,$5 elsif para =~/\{(.+?)\s\[(\d[sS]*)\]\}\.\.\/(\S+?)\/(\s+~\{.+?\}~)?/ #syntax e.g.: { "Sphinx or Robot", Leena Krohn [3sS]}../sphinx_or_robot.leena_krohn.1996/ - txt,cmd,url_dir,note=$1,$2,$3,$4 + pre,txt,cmd,url_dir,note='',$1,$2,$3,$4 end - manifest="{#{txt} }#@output_url/#{url_dir}/toc.html#{note}\n\n" + manifest="#{pre}{#{txt} }#@output_url/#{url_dir}/toc.html#{note}\n\n" else puts "error, does currently support relative paths (reltive paths were removed, as had problems for citation, and was not suited to all output types should possibly reconsider) #{__FILE__} #{__LINE__}" if para =~/\{(?:~\^\s+)?(.+?)\s\[(\d[sS]*)\]\}\.\.\/(\S+?)\/(\s+~\{.+?\}~)?/ @@ -396,7 +386,7 @@ module SiSU_DAL manifest="{ #{txt} }../#{url_dir}/toc.html#{note}\n\n" end end - tuned_file << manifest + tuned_file_tmp << manifest output_filetypes_in_cmd(cmd,source).each do |o_f| describe = case o_f when /sisu_manifest.html/; '~^ document manifest' @@ -419,13 +409,41 @@ module SiSU_DAL end if describe if @output_url - tuned_file << "_1 {#{describe} }#@output_url/#{url_dir}/#{o_f}\n\n" if describe + tuned_file_tmp << "<:br>     {#{describe} }#@output_url/#{url_dir}/#{o_f}\n\n" if describe else - tuned_file << "_1 { #{describe} }../#{url_dir}/#{o_f}\n\n" + tuned_file_tmp << "<:br>     { #{describe} }../#{url_dir}/#{o_f}\n\n" end end end - elsif para =~/<:insert\d+!?>/ and para !~/^%\s+/ + tuned_file << 'group{' << tuned_file_tmp.join("\n").strip << '}group' + tuned_file_tmp=[] + else tuned_file << para + end + end + tuned_file + end + def substitutions_and_insertions?(data) + tuned_file=[] + if data[0] =~ /^#!\s*(?:\/usr\/bin\/env sisu|\/usr\/bin\/sisu)/ # remove bang from top #! (however file is stripped, so will be removed provided no content preceeds it) + data[0].gsub!(/^#!\s*\/usr\/bin\/sisu/,'') + data[0].gsub!(/^#!\s*\/usr\/bin\/env sisu/,'') + end + if data[0] =~ /^(SiSU\s+[\d.]*|sisu-[\d.]+)$/ # SiSU identifier + data[0].gsub!(/^(SiSU\s*[\d.]*)$/,'% \1') + data[0].gsub!(/^(sisu-[\d.]+)$/,'% \1') + end + data.each do |para| + para=if @md.markup_version.to_f >= 0.38 + SiSU_document_structure::Structure.new(@md,para).structure_markup_normalize + else para + end + #para.gsub!(//,'\1') #consider, would permit use of text hyperlinks if desired, dal_syntax more appropriate? + para.gsub!(/^((?:[1-9]|:?[A-C])~\S*)\s*$/,'\1~ [Note: heading marker::required title missing]~#') #conditional header for incorporated document 2004w12 + if para =~/^@\S+?:/ + para.gsub!(/^@(\S+?):\s+/,'0~\1 ') + para.gsub!(/^@(\S+?):([+-])\s+/,'0~\1\2 ') + end + if para =~/<:insert\d+!?>/ and para !~/^%\s+/ @skin.select ins=SiSU_Viz::Inserts.new case para @@ -781,13 +799,13 @@ module SiSU_DAL # auto-numbered endnotes --> when /~\{\s+.+?\}~|~\[[*+]\s+.+?\]~/ para.gsub!(/\s*(\}~|\]~)/,' \1') # required 2003w31 - word_mode=para.scan(/\S+/) + word_mode=para.scan(/<:group>\n|\n<:group-end>|\S+/m) word_mode=endnote_call_number(word_mode) para=word_mode.join(' ') endnote_ref+=1 when /~\^(?:\s|$)|<:e>/ #%Note inserts endnotes previously gathered from /^(|[-~]\{{3})/ (in earlier loop) - word_mode=para.scan(/\S+/) + word_mode=para.scan(/<:group>\n|\n<:group-end>|\S+/m) word_mode=endnote_call_number(word_mode) para=word_mode.join(' ') endnote_ref+=1 @@ -985,12 +1003,12 @@ module SiSU_DAL digest_strip=hash_class.hexdigest(stripped) unless para =~/<:code>/ case para - when /~\{[\d*+]+\s+.+?\}~|~\[[*+]\d+\s+.+?\]~/ + when /~\{[\d*+]+\s+.+?\}~|~\[[*+]\d+\s+.+?\]~/m en_and_para,en_and_para_digest=[],[] - para.gsub!(/\s*(\}~|\]~)/,' \1') #watch - para_plus_en=para.scan(/.*?~\{.+?\}~|.*?~\[.+?\]~/) - para_tail=if para =~/(?:.*?~\{.+?\}~|.*?~\[.+?\]~)+([\s\S]+)/ - /(?:.*?~\{.+?\}~|.*?~\[.+?\]~)+(.+?<~\d+;(?:\w|[0-6]:)\d+;\w\d+>)/.match(para)[1] + para.gsub!(/\s*(\}~|\]~)/m,' \1') #watch + para_plus_en=para.scan(/.*?~\{.+?\}~|.*?~\[.+?\]~/m) + para_tail=if para =~/(?:.*?~\{.+?\}~|.*?~\[.+?\]~)+([\s\S]+)/m + /(?:.*?~\{.+?\}~|.*?~\[.+?\]~)+(.+?<~\d+;(?:\w|[0-6]:)\d+;\w\d+>)/m.match(para)[1] else '' end para_plus_en << para_tail diff --git a/lib/sisu/v0/html.rb b/lib/sisu/v0/html.rb index d0f0e210..3fc58ce5 100644 --- a/lib/sisu/v0/html.rb +++ b/lib/sisu/v0/html.rb @@ -93,17 +93,11 @@ module SiSU_HTML SiSU_Screen::Ansi.new(@opt.cmd,@opt.fns,"#{@env.path.output_tell}/#@fnb/#{@md.fn[:index]}").flow if @opt.cmd =~/[MV]/ SiSU_Env::Info_skin.new(@md).select data=nil - unless @md.markup =~/url_png/ - my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns,@md) #Beware #FIX opt and md, both not necessary - SiSU_Env::SiSU_file.new(@md).mkdir - @tuned_file_array=SiSU_HTML::Source::Html_environment.new(@md).tuned_file_instructions - data=@tuned_file_array - else - data=@env.read_source_file(@opt.fns) - SiSU_HTML_nav_tune::Tune.new(data,@md).songsheet - @tuned_file_array=data #watch may not be what you want - end - scr_endnotes=SiSU_HTML::Source::Endnotes.new(data,@md).scroll unless @md.markup =~/url_png/ + my_make=SiSU_Env::Create_file.new(@opt.cmd,@opt.fns,@md) #Beware #FIX opt and md, both not necessary + SiSU_Env::SiSU_file.new(@md).mkdir + @tuned_file_array=SiSU_HTML::Source::Html_environment.new(@md).tuned_file_instructions + data=@tuned_file_array + scr_endnotes=SiSU_HTML::Source::Endnotes.new(data,@md).scroll #unless @md.markup =~/url_png/ toc=SiSU_HTML::Source::Toc.new(data,@md).songsheet links_guide=SiSU_HTML::Source::Links_guide.new(data,@md).toc data=@tuned_file_array @@ -175,12 +169,8 @@ module SiSU_HTML my_make_source_file=SiSU_Env::Create_file.new(@md.cmd,@md.fns) @fnm=my_make_source_file.marshal_meta @tune_verse_marshal=my_make_source_file.marshal_tune - if @md.markup !~/url_png/ and @md.cmd =~/[hozn]/ - dal_array=SiSU_DAL::Source.new(@md).get # dal file drawn here - @tuned_file_array=SiSU_Tune::Tune.new(dal_array,@md).songsheet - else - SiSU_HTML_nav_tune::Tune.new(@file_array,@md).songsheet #no doc passed originally... 2004w35, revist changes in conditional 2006 - end + dal_array=SiSU_DAL::Source.new(@md).get # dal file drawn here + @tuned_file_array=SiSU_Tune::Tune.new(dal_array,@md).songsheet require "#{SiSU_lib}/param" @tuned_file_array end diff --git a/lib/sisu/v0/html_segments.rb b/lib/sisu/v0/html_segments.rb index 18ed11ec..de96dd7d 100644 --- a/lib/sisu/v0/html_segments.rb +++ b/lib/sisu/v0/html_segments.rb @@ -68,7 +68,7 @@ module SiSU_HTML_seg @@seg[:tocband],@@seg[:title],@@seg[:headers],@@seg[:main],@@seg[:tail],@@seg[:credits],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(9){[]} @@seg[:header_endnotes]='' @@tablehead,@@number_of_cols=0,0 - @@flag_group=false + @@flag_alt=false @@dp,@@segtocband=nil,nil @@fns_previous='' attr_reader :seg_name_html,:seg_name_html_tracker @@ -168,7 +168,7 @@ module SiSU_HTML_seg end m=para[/.+?.*/]; @@get_hash_to=$1 if m # changed 2002w42, again w44 ! & again 2003w16 m=para[/^4~(\S+)/]; @@get_hash_fn=$1 if m - para=if para =~//; para.split(/\n/) + para=if para =~//m; para.split(/\n/) else para end if para.class == String @@ -178,10 +178,8 @@ module SiSU_HTML_seg markup(pg) end end - #Seg.new(para,@md).txt if testforartnum[tracking-1] =~/endnote/ if printed_endnote_seg == 'n' - #Seg.new(para,@md).endnote printed_endnote_seg='y' end end @@ -262,20 +260,21 @@ module SiSU_HTML_seg paranum=m[1].to_s @p_num=SiSU_HTML_Format_type::Paragraph_number.new(@md,paranum) end - if para =~/<:(?:code|alt|verse|group)>/ or @@flag_group==true - if para =~/<:(?:code|alt|verse|group)>/ + if para =~/<:(?:code|alt|verse|group)>/m or @@flag_alt==true + if para =~/<:(?:code|alt|verse|group)>/m @group_collect=[] #unless @group_collect.class == Array - @group_collect << @vz.margin_txt_0 + para - @@flag_group=true - elsif @@flag_group==true - unless para =~/<:(?:code|alt|verse|group)-end>/ # neither ideal nor necessary sort later - @group_collect << para - else @group_collect << para.gsub(/<:(?:code|alt|verse|group)-end>/,'') + @group_collect << @vz.margin_txt_0 + para.gsub(/<:(?:code|alt|verse|group)-end>/m,'') #watch ! + @@flag_alt=true + elsif @@flag_alt==true + @group_collect << if para !~/<:(?:code|alt|verse|group)-end>/m # neither ideal nor necessary sort later + para + else + para.gsub(/<:(?:code|alt|verse|group)-end>/m,'') end end - if para =~/<:(?:code|alt|verse|group)-end>/ + if para =~/<:(?:code|alt|verse|group)-end>/m para=@group_collect.flatten.join - @@flag_group=false + @@flag_alt=false @group_collect=[] end end @@ -300,7 +299,7 @@ module SiSU_HTML_seg when /^i([1-9])$/ #indent levels 1-9 format_txt_obj.gsub_body para=@sto.seg_lev_para_ocn.format('p',"i#{$1}") - when /^(?:verse|group|alt)$/ + when /^(?:verse|group|alt)$/m @sto.seg_lev_para_ocn.para when /^code$/ @sto.seg_lev_para_ocn.code @@ -340,7 +339,7 @@ module SiSU_HTML_seg @@seg[:main] << @@seg_subtoc[@@get_hash_fn] #% insertion of sub-toc else para.gsub!(/<:[-_\w\d]?(-.+?-)?>|4~!.+/,'') - @@seg[:main] << para unless @@flag_group==true + @@seg[:main] << para unless @@flag_alt==true end end end diff --git a/lib/sisu/v0/odf.rb b/lib/sisu/v0/odf.rb index 981bedeb..610a51aa 100644 --- a/lib/sisu/v0/odf.rb +++ b/lib/sisu/v0/odf.rb @@ -367,6 +367,12 @@ module SiSU_ODF parray=[] para.split(/<:?br(?: \/)?>/).each do |parablock| parablock=group_clean(parablock) + parablock.gsub!(/<text:a xlink:type="simple" xlink:href="(.+?)">/m,'') + parablock.gsub!(/<(\/text:a)>/,'<\1>') + parablock.gsub!(/<(text:note text:id=.+?)>/,'<\1>') + parablock.gsub!(/<(text:p text:style-name="Footnote")>/,'<\1>') + parablock.gsub!(/<(\/?text:(?:note-citation|note-body|note|p))>/,'<\1>') + parablock=footnote(parablock) parray << %{#{parablock}} if parablock =~/\S+/ end para=parray.join + '' @@ -397,8 +403,6 @@ module SiSU_ODF n=lv - 1 n3=lv + 2 lv=nil if lv == 0 - #extract_endnotes(para) - #para=fontface(para) para=unless para=~/^<:code>/ para=if para =~/\{\s*\S+?\.(?:png|jpg|gif)\s.+?\}(?:(?:https?|file|ftp):\S+|image)/; image(para) elsif para =~/\{.+?\}(?:(?:https?|file|ftp):\S+|image)/; text_link(para) diff --git a/lib/sisu/v0/param.rb b/lib/sisu/v0/param.rb index 8a652fa0..5adbf7f3 100644 --- a/lib/sisu/v0/param.rb +++ b/lib/sisu/v0/param.rb @@ -549,16 +549,16 @@ module SiSU_Param end unless @code_flag case para - when /~\{\s+.+?\}~/ #% processing - en=para.scan(/~\{.+?\}~/) + when /~\{\s+.+?\}~/m #% processing + en=para.scan(/~\{.+?\}~/m) en.each { |e| @en[:sum] +=1 } - when /~\^(?:\s|$)/ #% processing + when /~\^(?:\s|$)/m #% processing mk=para.scan(/~\^(?:\s|$)/) mk.each { |e| @en[:mark] +=1 } when /^\^~\s+\S/; @en[:note] +=1 #% processing end end - if para =~/~\{|\^~ |~\^|<:ee>/; @flag_auto_endnotes,@flag_endnotes=true,true + if para =~/~\{|\^~ |~\^|<:ee>|\{.+?\[[1-6]\]\}\S+?\.ss[tm]/m; @flag_auto_endnotes,@flag_endnotes=true,true end unless @flag_auto_endnotes if para =~/^(4~endnotes\b|<:ee>)/ diff --git a/lib/sisu/v0/shared_xml.rb b/lib/sisu/v0/shared_xml.rb index 4b9ccb12..da1891e5 100644 --- a/lib/sisu/v0/shared_xml.rb +++ b/lib/sisu/v0/shared_xml.rb @@ -391,6 +391,9 @@ module SiSU_XML_munge def markup_group(para='') para.gsub!(//,'>') para.gsub!(/<:?br(?:\s+\/)?>/,'
') + para.gsub!(/<(link xmlns:xlink=".+?)">/,'<"\1">') + para.gsub!(/<(\/link)>/,'<\1>') + para.gsub!(/<(\/?en)>/,'<\1>') para end end diff --git a/lib/sisu/v0/texpdf.rb b/lib/sisu/v0/texpdf.rb index c2a6b14f..989899cf 100644 --- a/lib/sisu/v0/texpdf.rb +++ b/lib/sisu/v0/texpdf.rb @@ -236,7 +236,7 @@ module SiSU_TeX @@tex_backslash ||="\\\\" @@tilde='\\\\\\~' #?? debug crazy @@tex_head_portrait,@@tex_head_landscape=nil,nil - @@flag_group,@@flag_code=false,false + @@flag_alt,@@flag_group,@@flag_code=false,false,false @@dp,@@prefix_b=nil,nil def initialize(data,md,orientation) @data,@md,@orientation=data,md,orientation @@ -428,7 +428,7 @@ WOK @group_collect=[] data.each do |para| #% case follows with levels 1-6 indents & graphics mono=SiSU_TeX_Pdf::Format_text_object.new(@md,para) - if para =~/<:(code|alt|verse|group)>/ or @@flag_group==true + if para =~/<:(code|alt|verse|group)>/ or @@flag_alt if para =~/<:(code|alt|verse|group)>/ @lineone=case para when /<:(alt|verse|group)>/; para @@ -440,16 +440,22 @@ WOK do_mono=SiSU_TeX_Pdf::Format_text_object.new(@md,para) para=do_mono.special_characters_curly(para) end - regx=/<:((?:code|alt|verse|group)(?:-end)?)>/ + regx=/<:((?:code|alt|verse|group)(?:-end)?)>/m x=regx.match(para)[1] if para =~regx x=$1 para.gsub!(/\n<:(?:code|alt|verse|group)>\n/m,'') para=enclose(para,'code') unless para =~/^$/ - if x =~/(?:alt|verse|group)/; @@flag_group=true - elsif x =~/code/; @@flag_group,@@flag_code=true,true - elsif @@flag_group==true; @group_collect << para #<< "\n\n" + if x =~/(?:alt|verse|group)/; @@flag_alt=true + if x =~/group/; @@flag_group=true + end + elsif x =~/code/; @@flag_alt,@@flag_code=true,true + elsif @@flag_alt; + if para =~ /\}(?:https?|file|ftp)/m + para=mono.http(@orientation) + end + @group_collect << para #<< "\n\n" end - if x =~/(?:code|alt|verse|group)-end/ + if x =~/(?:code|alt|verse|group)-end/m regx=/(\\+marginpar\{\\+begin\{tiny\}\d+\\+end\{tiny\}\})/ y=if para =~regx regx.match(para)[1] @@ -470,14 +476,11 @@ WOK #@group_collect.each{ |x| x.gsub!(/(.#{@@tilde}\S*\s*|<:\S+>||)/,' ') } #@lineone.gsub!(/(.#{@@tilde}\S*\s*|<:\S+>||)/,' ') insert=[] - if para =~/<:code-end>/ + if para =~/<:code-end>/m insert << y + @lineone << @group_collect << ' \end{scriptsize}' << " #{@tex.paraskip_normal}" - #insert << y + @lineone << @group_collect << ' \end{footnotesize}' << " #{@tex.paraskip_normal}" - #insert << y + @lineone << @group_collect << ' \end{texttt}' << " #{@tex.paraskip_normal}" - #insert << y + @lineone << @group_collect << ' \end{ttfamily} \end{small}' << " #{@tex.paraskip_normal}" else insert << y + @lineone << @group_collect end - @@flag_group,@@flag_code=false,false + @@flag_alt,@@flag_group,@@flag_code=false,false,false @group_collect=[] para.gsub!(/(<:\S+>||)/,' ') #para.gsub!(/(.#{@@tilde}\S*\s*|<:\S+>||)/,' ') diff --git a/lib/sisu/v0/xml.rb b/lib/sisu/v0/xml.rb index b230ec9f..d6db3ca7 100644 --- a/lib/sisu/v0/xml.rb +++ b/lib/sisu/v0/xml.rb @@ -233,13 +233,15 @@ WOK @@xml[:body] << if lv; %{#{@tab*1}\n#{@tab*2}#{wrapped}\n#{@tab*1}\n} << "\n" else %{#{@tab*1}\n#{@tab*2}#{wrapped}\n#{@tab*1}\n} # main text, contents, body KEEP end - @@xml[:body] << @endnotes if @endnotes # main text, endnotes KEEP + @@xml[:body] << @endnotes if @endnotes ##@@xml[:body] << "#{@tab*1}#{para[@regx,2]}\n" if para[@regx,2] # old unwrapped main text, contents, body KEEP @@xml[:body] << "#{@tab*0}" << "\n" if para[@regx] @endnotes=[] end def group_structure(para='',ocn='') para.gsub!(/<:group(?:-end)?>/,'') + extract_endnotes(para) + para.gsub!(/~[{\[]([\d*+]+)\s+(?:.+?)\s*<#@dp>[}\]]~/,'\1') #footnote/endnote clean para=@trans.markup_group(para) para.strip! @@xml[:body] << %{#{@tab*0}} << "\n" @@ -248,6 +250,8 @@ WOK @@xml[:body] << %{#{@tab*2}#{para}#{@tab*1}\n} @@xml[:body] << %{#{@tab*1}\n} @@xml[:body] << "#{@tab*0}" << "\n" + @@xml[:body] << @endnotes if @endnotes + @endnotes=[] end def poem_structure(para='',ocn='') para.gsub!(/<:verse(?:-end)?>/,'') -- cgit v1.2.3