From 5fb49b575a548313b827fd66fd7ecce514fe0e45 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Mon, 6 Jan 2014 23:02:50 -0500 Subject: v5: heading recalibration, code (downstream) changes * here no doubt remains breakage (test, fix & test again) --- lib/sisu/v5/ao_syntax.rb | 2 +- lib/sisu/v5/db_create.rb | 7 ++- lib/sisu/v5/db_drop.rb | 1 + lib/sisu/v5/db_import.rb | 71 +++++++++++++++++++++++++---- lib/sisu/v5/db_indexes.rb | 1 + lib/sisu/v5/db_load_tuple.rb | 32 ++++++------- lib/sisu/v5/html.rb | 32 ++++++++++--- lib/sisu/v5/html_format.rb | 20 ++++++--- lib/sisu/v5/html_minitoc.rb | 15 ++++++- lib/sisu/v5/html_scroll.rb | 15 ++++--- lib/sisu/v5/html_segments.rb | 56 +++++++++++++---------- lib/sisu/v5/param.rb | 9 ++-- lib/sisu/v5/param_make.rb | 13 +++--- lib/sisu/v5/txt_asciidoc.rb | 24 +++++----- lib/sisu/v5/txt_markdown.rb | 12 ++--- lib/sisu/v5/txt_plain.rb | 6 ++- lib/sisu/v5/txt_rst.rb | 12 ++--- lib/sisu/v5/txt_textile.rb | 12 ++--- lib/sisu/v5/xhtml.rb | 1 + lib/sisu/v5/xhtml_epub2.rb | 82 +++++++++++++++++++++++++++------- lib/sisu/v5/xhtml_epub2_concordance.rb | 12 +++-- lib/sisu/v5/xhtml_epub2_format.rb | 15 +++++-- lib/sisu/v5/xhtml_epub2_segments.rb | 64 +++++++++++++------------- lib/sisu/v5/xml_docbook5.rb | 60 ++++++++++++++----------- lib/sisu/v5/xml_dom.rb | 14 +++--- lib/sisu/v5/xml_fictionbook2.rb | 15 +++++-- lib/sisu/v5/xml_format.rb | 19 +++++--- 27 files changed, 415 insertions(+), 207 deletions(-) (limited to 'lib') diff --git a/lib/sisu/v5/ao_syntax.rb b/lib/sisu/v5/ao_syntax.rb index fe9f3aec..cdcb3883 100644 --- a/lib/sisu/v5/ao_syntax.rb +++ b/lib/sisu/v5/ao_syntax.rb @@ -412,7 +412,7 @@ module SiSU_AO_Syntax gsub(/~\[([^*+].+?)\]~/m,Mx[:en_b_o] + '* \1' + Mx[:en_b_c]). #default if markup does not specify gsub(/~\[(.+?)\]~/m,Mx[:en_b_o] + '\1' + Mx[:en_b_c]) if dob.is ==:heading \ - and dob.ln ==1 + and dob.ln ==0 dob.obj=dob.obj.gsub(/\s*@title\b/," #{@md.title.full}") dob.obj=if defined? @md.creator.author \ and @md.creator.author diff --git a/lib/sisu/v5/db_create.rb b/lib/sisu/v5/db_create.rb index 834b55cc..4de362c5 100644 --- a/lib/sisu/v5/db_create.rb +++ b/lib/sisu/v5/db_create.rb @@ -236,6 +236,7 @@ module SiSU_DbCreate seg VARCHAR(256) NULL, lev_an VARCHAR(1), lev SMALLINT NULL, + lev0 SMALLINT, lev1 SMALLINT, lev2 SMALLINT, lev3 SMALLINT, @@ -484,9 +485,9 @@ module SiSU_DbCreate %{COMMENT ON COLUMN doc_objects.metadata_tid IS 'tie to title in metadata_and_text';}, %{COMMENT ON COLUMN doc_objects.lev_an - IS 'doc level A-C 1-6';}, + IS 'doc level A-D 1-6';}, %{COMMENT ON COLUMN doc_objects.lev - IS 'doc level 1-6 \d\~';}, + IS 'doc level 0-6 \d\~';}, %{COMMENT ON COLUMN doc_objects.seg IS 'segment name from level number 4 (lv 1)';}, %{COMMENT ON COLUMN doc_objects.ocn @@ -511,6 +512,8 @@ module SiSU_DbCreate IS 'text object - substantive text: light html markup';}, %{COMMENT ON COLUMN doc_objects.book_idx IS 'book index creation information for paragraph, if provided';}, + %{COMMENT ON COLUMN doc_objects.lev0 + IS 'document structure, level number 0';}, %{COMMENT ON COLUMN doc_objects.lev1 IS 'document structure, level number 1';}, %{COMMENT ON COLUMN doc_objects.lev2 diff --git a/lib/sisu/v5/db_drop.rb b/lib/sisu/v5/db_drop.rb index 2e4c28ba..b1ff634e 100644 --- a/lib/sisu/v5/db_drop.rb +++ b/lib/sisu/v5/db_drop.rb @@ -159,6 +159,7 @@ module SiSU_DbDrop %{DROP INDEX idx_ocn;}, %{DROP INDEX idx_digest_clean;}, %{DROP INDEX idx_digest_all;}, + %{DROP INDEX idx_lev0;}, %{DROP INDEX idx_lev1;}, %{DROP INDEX idx_lev2;}, %{DROP INDEX idx_lev3;}, diff --git a/lib/sisu/v5/db_import.rb b/lib/sisu/v5/db_import.rb index 2289613d..8d9fc229 100644 --- a/lib/sisu/v5/db_import.rb +++ b/lib/sisu/v5/db_import.rb @@ -116,7 +116,7 @@ module SiSU_DbImport puts "#{__FILE__}:#{__LINE__}" if @opt.act[:maintenance][:set]==:on end @id_n =0 if @col[:lid].nil? or @col[:lid].to_s.empty? - @col[:lv1]=@col[:lv2]=@col[:lv3]=@col[:lv4]=@col[:lv5]=@col[:lv6]=0 + @col[:lv0]=@col[:lv1]=@col[:lv2]=@col[:lv3]=@col[:lv4]=@col[:lv5]=@col[:lv6]=0 @db=SiSU_Env::InfoDb.new @pdf_fn=SiSU_Env::FileOp.new(@md).base_filename @@dl ||=SiSU_Env::InfoEnv.new.digest.length @@ -152,7 +152,7 @@ module SiSU_DbImport puts @conn.driver_name if defined? @conn.driver_name puts @conn.driver if defined? @conn.driver end - begin + begin #% sql if @sql_type=~/sqlite/ @conn.transaction do |conn| t_d.each do |sql| @@ -310,8 +310,23 @@ module SiSU_DbImport notedata=data.obj.dup #% :headings if data.is==:heading \ - && (data.ln.inspect=~/[123]/) - @col[:lev],txt,@col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=data.ln,data.obj,data.ocn,data.lv,data.odv,data.osp,data.of,data.is,data.node,data.parent,'','' + && (data.ln.inspect=~/[0-3]/) + ( + @col[:lev], + txt,@col[:ocn], + @col[:lev_an], + @col[:ocnd],@col[:ocns], + @col[:t_of],@col[:t_is], + @col[:node],@col[:parent], + @col[:digest_clean],@col[:digest_all]= + data.ln, + data.obj,data.ocn, + data.lv, + data.odv,data.osp, + data.of,data.is, + data.node,data.parent, + '','' + ) @col[:lid]+=1 txt=endnotes(txt).extract_any body=SiSU_FormatShared::CSS_Format.new(@md,data).lev4_minus @@ -330,6 +345,7 @@ module SiSU_DbImport t=SiSU_DbTuple::LoadDocuments.new(@conn,@col,@opt,@file_maint) @tuple_array << t.tuple case @col[:lev] + when /0/ then @col[:lv0]+=1 when /1/ then @col[:lv1]+=1 when /2/ then @col[:lv2]+=1 when /3/ then @col[:lv3]+=1 @@ -337,7 +353,20 @@ module SiSU_DbImport @col[:lev]=@col[:plaintext]=@col[:body]='' elsif data.is==:heading \ && data.ln==4 - @@seg,txt,@col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=data.name,data.obj,data.ocn,data.lv,data.odv,data.osp,data.of,data.is,data.node,data.parent,'','' + ( + @@seg,txt, + @col[:ocn],@col[:lev_an], + @col[:ocnd],@col[:ocns], + @col[:t_of],@col[:t_is], + @col[:node],@col[:parent], + @col[:digest_clean],@col[:digest_all]= + data.name,data.obj, + data.ocn,data.lv, + data.odv,data.osp, + data.of,data.is, + data.node,data.parent, + '','' + ) @col[:seg]=@@seg @col[:lv4]+=1 @col[:lid]+=1 @@ -365,7 +394,20 @@ module SiSU_DbImport @col[:lev]=@col[:plaintext]=@col[:body]='' elsif data.is==:heading \ && data.ln==5 - txt,@col[:ocn],@col[:lev_an],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=data.obj,data.ocn,data.lv,data.odv,data.osp,data.of,data.is,data.node,data.parent,'','' + ( + txt, + @col[:ocn],@col[:lev_an], + @col[:ocnd],@col[:ocns], + @col[:t_of],@col[:t_is], + @col[:node],@col[:parent], + @col[:digest_clean],@col[:digest_all]= + data.obj, + data.ocn,data.lv, + data.odv,data.osp, + data.of,data.is, + data.node,data.parent, + '','' + ) @@seg_full=data.name if data.is==:heading \ && data.ln==5 \ && data.name #check data.name @@ -433,8 +475,21 @@ module SiSU_DbImport #% : else #% regular text @col[:lid]+=1 - txt='' - txt,@col[:ocn],@col[:ocnd],@col[:ocns],@col[:t_of],@col[:t_is],@col[:node],@col[:parent],@col[:digest_clean],@col[:digest_all]=data.obj,data.ocn,data.odv,data.osp,data.of,data.is,'',data.parent,'','' + ( + txt='' + txt,@col[:ocn], + @col[:ocnd],@col[:ocns], + @col[:t_of],@col[:t_is], + @col[:node],@col[:parent], + @col[:digest_clean],@col[:digest_all], + @col[:lev]= + data.obj,data.ocn, + data.odv,data.osp, + data.of,data.is, + '',data.parent, + '','', + 9 + ) @hname=if @col[:seg] \ and not @col[:seg].to_s.empty? @@hname=@col[:seg].to_s diff --git a/lib/sisu/v5/db_indexes.rb b/lib/sisu/v5/db_indexes.rb index 0e260f76..0fa51b3f 100644 --- a/lib/sisu/v5/db_indexes.rb +++ b/lib/sisu/v5/db_indexes.rb @@ -83,6 +83,7 @@ module SiSU_DbIndex %{CREATE INDEX idx_ocn ON doc_objects(ocn);}, %{CREATE INDEX idx_digest_clean ON doc_objects(digest_clean);}, %{CREATE INDEX idx_digest_all ON doc_objects(digest_all);}, + %{CREATE INDEX idx_lev0 ON doc_objects(lev0);}, %{CREATE INDEX idx_lev1 ON doc_objects(lev1);}, %{CREATE INDEX idx_lev2 ON doc_objects(lev2);}, %{CREATE INDEX idx_lev3 ON doc_objects(lev3);}, diff --git a/lib/sisu/v5/db_load_tuple.rb b/lib/sisu/v5/db_load_tuple.rb index 9bad5757..750a47f0 100644 --- a/lib/sisu/v5/db_load_tuple.rb +++ b/lib/sisu/v5/db_load_tuple.rb @@ -69,25 +69,20 @@ module SiSU_DbTuple def initialize(conn,col,opt,file_maint) @conn,@col,@opt,@file_maint=conn,col,opt,file_maint @col[:lev]=@col[:lev].to_i - unless @col[:lev]=~/^[1-6]/ \ - or @col[:lev]==1 \ - or @col[:lev]==2 \ - or @col[:lev]==3 \ - or @col[:lev]==4 \ - or @col[:lev]==5 \ - or @col[:lev]==6 #changed from \d+ ?? - @col[:lev]=0 + unless @col[:lev].inspect=~/^[0-6]/ \ + or @col[:lev]==0..6 + @col[:lev]=9 end @col[:ocn]=0 unless @col[:ocn].inspect=~/\d+/ @cX=SiSU_Screen::Ansi.new(@opt.act[:color_state][:set]).cX end def tuple #% import line sql_entry=if @col[:en_a] - "INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, book_idx, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, en_a, en_z, t_of, t_is, node, parent, digest_clean, digest_all) " + - "VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:lev_an]}', '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:book_idx]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:en_a]}', '#{@col[:en_z]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');" + "INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, book_idx, ocn, ocnd, ocns, seg, lev0, lev1, lev2, lev3, lev4, lev5, lev6, en_a, en_z, t_of, t_is, node, parent, digest_clean, digest_all) " + + "VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:lev_an]}', '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:book_idx]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv0]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:en_a]}', '#{@col[:en_z]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');" else - "INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, book_idx, ocn, ocnd, ocns, seg, lev1, lev2, lev3, lev4, lev5, lev6, t_of, t_is, node, parent, digest_clean, digest_all) " + - "VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:lev_an]}', '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:book_idx]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');" + "INSERT INTO doc_objects (lid, metadata_tid, lev, lev_an, clean, body, book_idx, ocn, ocnd, ocns, seg, lev0, lev1, lev2, lev3, lev4, lev5, lev6, t_of, t_is, node, parent, digest_clean, digest_all) " + + "VALUES (#{@col[:lid]}, #{@col[:tid]}, #{@col[:lev]}, '#{@col[:lev_an]}', '#{@col[:plaintext]}', '#{@col[:body]}', '#{@col[:book_idx]}', '#{@col[:ocn]}', '#{@col[:ocnd]}', '#{@col[:ocns]}', '#{@col[:seg]}', '#{@col[:lv0]}', '#{@col[:lv1]}', '#{@col[:lv2]}', '#{@col[:lv3]}', '#{@col[:lv4]}', '#{@col[:lv5]}', '#{@col[:lv6]}', '#{@col[:t_of]}', '#{@col[:t_is]}', '#{@col[:node]}', '#{@col[:parent]}', '#{@col[:digest_clean]}', '#{@col[:digest_all]}');" end if @opt.act[:verbose_plus][:set]==:on if @opt.act[:maintenance][:set]==:on @@ -102,17 +97,18 @@ module SiSU_DbTuple end end if @opt.act[:verbose][:set]==:on - if @col[:lev].inspect =~/[12356789]/ + if @col[:lev].inspect =~/[0-356]/ lev=case @col[:lev].inspect - when /1/ then ':A' - when /2/ then ':B' - when /3/ then ':C' + when /0/ then ':A' + when /1/ then ':B' + when /2/ then ':C' + when /3/ then ':D' when /5/ then ' 2' when /6/ then ' 3' end - puts %{#{lev}>\t#{@col[:lv1]}\t#{@col[:lv2]}\t#{@col[:lv3]}\t#{@col[:lv4]}\t#{@col[:lv5]}\t#{@col[:lv6]}\t#{@col[:ocn]}\t#{@col[:node]}\t#{@col[:ocns]}} + puts %{#{lev}>\t#{@col[:lv0]}\t#{@col[:lv1]}\t#{@col[:lv2]}\t#{@col[:lv3]}\t#{@col[:lv4]}\t#{@col[:lv5]}\t#{@col[:lv6]}\t#{@col[:ocn]}\t#{@col[:node]}\t#{@col[:ocns]}} elsif @col[:lev].inspect =~/[4]/ - puts %{ #{@cX.green}1>#{@cX.off}\t#{@col[:lv1]}\t#{@col[:lv2]}\t#{@col[:lv3]}\t#{@col[:lv4]}\t#{@col[:lv5]}\t#{@col[:lv6]}\t#{@col[:ocn]}\t#{@col[:node]}\t#{@col[:ocns]}\t#{@col[:seg]}} + puts %{ #{@cX.green}1>#{@cX.off}\t#{@col[:lv0]}\t#{@col[:lv1]}\t#{@col[:lv2]}\t#{@col[:lv3]}\t#{@col[:lv4]}\t#{@col[:lv5]}\t#{@col[:lv6]}\t#{@col[:ocn]}\t#{@col[:node]}\t#{@col[:ocns]}\t#{@col[:seg]}} end end sql_entry diff --git a/lib/sisu/v5/html.rb b/lib/sisu/v5/html.rb index 4ff58c43..f473f1b7 100644 --- a/lib/sisu/v5/html.rb +++ b/lib/sisu/v5/html.rb @@ -259,6 +259,7 @@ module SiSU_HTML toc=if dob_toc.is ==:heading \ || dob.is==:heading_insert toc=case dob_toc.ln + when 0 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_0 when 1 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_1 when 2 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_2 when 3 then SiSU_HTML::Source::Toc.new(@md,dob_toc).level_3 @@ -335,6 +336,29 @@ WOK @@toc[:seg_mini] << format_head_toc.mini_concordance end # <-- not used + def level_0 + dob=@data + linkname,link=dob.obj.strip,dob.ocn + if link \ + and link !~/#/ #% keep eye on link + SiSU_HTML_Format::ParagraphNumber.new(@md,link) + end + title=linkname + toc={} + txt_obj={ txt: title } + format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) + toc[:seg]=format_toc.lev0 + toc[:seg_mini]=format_toc.mini_lev0 + title=if dob.ocn ==0 then linkname + else + @@toc[:scr] << '
' + %{#{linkname}} + end + txt_obj={ txt: title } + format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) + toc[:scr]=format_toc.lev0 + toc + end def level_1 dob=@data linkname,link=dob.obj.strip,dob.ocn @@ -567,9 +591,8 @@ WOK format_head_toc=SiSU_HTML_Format::HeadToc.new(@md) dochead=format_head_toc.head dochead=dochead.gsub(/toc\.(html)/,'doc.\1') #kludge - ads=SiSU_HTML_Promo::Ad.new(@md) - toc_shared << dochead << ads.div.major - @segtoc << format_head_toc.head << ads.div.major + toc_shared << dochead + @segtoc << format_head_toc.head if @make.build.html_top_band? toc_shared << format_head_toc.scroll_head_navigation_band end @@ -632,8 +655,7 @@ WOK #Segtoc tail added here @segtoc << "

\n" #bugfix sort later DEBUGNOW @segtoc << @seg_toc_band_bottom - ads=SiSU_HTML_Promo::Ad.new(@md) - @segtoc << format_head_toc.seg_navigation_tail << ads.div.close << ads.display << format_head_toc.html_close + @segtoc << format_head_toc.seg_navigation_tail << format_head_toc.html_close @segtoc=@segtoc.flatten.compact #watch if @md.opt.act[:html_seg][:set]==:on SiSU_HTML::Source::Output.new(@segtoc,@md).segtoc diff --git a/lib/sisu/v5/html_format.rb b/lib/sisu/v5/html_format.rb index 5617193f..3b15502f 100644 --- a/lib/sisu/v5/html_format.rb +++ b/lib/sisu/v5/html_format.rb @@ -1030,7 +1030,7 @@ WOK para_form_css(tag,attrib) end def heading_normal(tag,attrib) - section_break=(tag=~/h[1-4]/) \ + section_break=(tag=~/h[1-5]/) \ ? '


' : '' %{#{section_break} @@ -1045,6 +1045,9 @@ WOK def heading_body heading_normal('p','norm') end + def heading_body0 + heading_normal('h1','norm') + end def heading_body1 heading_normal('h1','norm') end @@ -1075,6 +1078,9 @@ WOK } end + def title_heading0 + title_heading('h1','tiny') + end def title_heading1 title_heading('h1','tiny') end @@ -1332,6 +1338,9 @@ WOK else '' end end + def lev0 #docinfo + lev('h1','toc') + end def lev1 lev('h1','toc') end @@ -1350,13 +1359,14 @@ WOK def lev6 lev('h6','toc') end - def lev0 #docinfo - lev('h0','toc') - end def strip_endnotes(txt) txt=txt.gsub(/(?:#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]})\s*/m,' ') txt end + def mini_lev0 + @txt=strip_endnotes(@txt) + lev('h1','minitoc') + end def mini_lev1 @txt=strip_endnotes(@txt) lev('h1','minitoc') @@ -1382,7 +1392,7 @@ WOK lev('h6','minitoc') end def mini_lev0 #docinfo - lev('h0','minitoc') + lev('h1','minitoc') end def mini_tail %{ diff --git a/lib/sisu/v5/html_minitoc.rb b/lib/sisu/v5/html_minitoc.rb index 65cfe91a..dae74c46 100644 --- a/lib/sisu/v5/html_minitoc.rb +++ b/lib/sisu/v5/html_minitoc.rb @@ -89,6 +89,7 @@ gsub(@pat_strip_heading_name,'\1') #gsub(/(.*?)<\/a>(.*)/,'\1') #2002w42 altered gsub - problematic? - suspect toc=case txt.ln + when 0 then SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_0 when 1 then SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_1 when 2 then SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_2 when 3 then SiSU_HTML_MiniToc::TocMini.new(@md,txt).level_3 @@ -115,6 +116,18 @@ format_head_toc=SiSU_HTML_Format::HeadToc.new(@d0c) @@seg_mini << format_head_toc.mini_concordance end + def level_0 + txt=@data + if (txt.is ==:heading \ + || txt.is ==:heading_insert) \ + && txt.ocn !=0 + txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1') + end + txt_obj={ txt: txt.obj } + format_toc=SiSU_HTML_Format::FormatToc.new(@md,txt_obj) + toc_mini=format_toc.mini_lev0 + toc_mini + end def level_1 txt=@data if (txt.is ==:heading \ @@ -122,7 +135,7 @@ && txt.ocn !=0 txt.obj=txt.obj.gsub(@pat_strip_heading_name,'\1') end - title=unless txt.obj =~/Document Information/; txt.obj + title=unless txt.obj =~/Document Information/ then txt.obj else link='metadata' %{#{txt.obj}} diff --git a/lib/sisu/v5/html_scroll.rb b/lib/sisu/v5/html_scroll.rb index 5af5b133..01fe2940 100644 --- a/lib/sisu/v5/html_scroll.rb +++ b/lib/sisu/v5/html_scroll.rb @@ -96,7 +96,7 @@ module SiSU_HTML_Scroll end if dob.obj =~/^Metadata$/ \ and dob.lv =='B' - dob.obj=dob.obj.gsub(/Metadata/,'') + dob.obj=dob.obj.gsub(/Metadata/,'') #dob.obj='' end if defined? dob.name \ and dob.name =~/^metadata/ \ @@ -115,7 +115,9 @@ module SiSU_HTML_Scroll end sto=SiSU_HTML_Format::FormatTextObject.new(@md,dob) para_html=if dob.is==:heading - x=if dob.ln==1 + x=if dob.ln==0 + sto.heading_body0 + elsif dob.ln==1 sto.heading_body1 elsif dob.ln==2 sto.heading_body2 @@ -132,7 +134,11 @@ module SiSU_HTML_Scroll and dob.from==:markup '


' elsif dob.is==:heading_insert - x=if dob.ln==1 + x=if dob.ln==0 + unless dob.obj.empty? + sto.heading_body0 + end + elsif dob.ln==1 unless dob.obj.empty? sto.heading_body1 end @@ -216,8 +222,7 @@ module SiSU_HTML_Scroll def tails scr_tail=[] format_head_scroll=SiSU_HTML_Format::HeadToc.new(@md) - ads=SiSU_HTML_Promo::Ad.new(@md) - scr_tail << format_head_scroll.scroll_tail << ads.div.close << ads.display << format_head_scroll.html_close + scr_tail << format_head_scroll.scroll_tail << format_head_scroll.html_close scr_tail end end diff --git a/lib/sisu/v5/html_segments.rb b/lib/sisu/v5/html_segments.rb index 94df2eba..b710db81 100644 --- a/lib/sisu/v5/html_segments.rb +++ b/lib/sisu/v5/html_segments.rb @@ -144,8 +144,8 @@ module SiSU_HTML_Seg @@seg_name,@@seg_name_html=[],[] @@seg_url=@@fn=@@get_hash_to=@@get_hash_fn='' @@loop_count=@@seg_total=@@tracker=0 - @@is4=@@is3=@@is2=@@is1=0 - @@heading1=@@heading2=@@heading3=@@heading4=0 + @@is4=@@is3=@@is2=@@is1=@@is0=0 + @@heading0=@@heading1=@@heading2=@@heading3=@@heading4=0 @@seg[:tocband_banner],@@seg[:tocband_bannerless],@@seg[:title],@@seg[:headings],@@seg[:main],@@seg[:idx],@@seg[:tail],@@seg[:credits],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(11){[]} @@seg[:heading_endnotes]='' @@tablehead,@@number_of_cols=0,0 @@ -187,7 +187,7 @@ module SiSU_HTML_Seg protected def articles(data) tracking,newfile=0,0 - @@is4=@@is3=@@is2=@@is1=0 + @@is4=@@is3=@@is2=@@is1=@@is0=0 printed_endnote_seg='n' idx_html=nil if @md.book_idx @@ -234,10 +234,7 @@ module SiSU_HTML_Seg if (dob.is==:heading \ || dob.is==:heading_insert) \ && dob.ln==4 - if dob.ocn==0 - @@heading4=dob.obj - else @@heading4=dob.obj - end + @@heading4=dob.obj @@is4=newfile=1 end if (dob.is==:heading \ @@ -258,10 +255,16 @@ module SiSU_HTML_Seg @@heading1=dob.obj @@is4,@@is3,@@is2,@@is1=0,0,0,1 end + if (dob.is==:heading \ + || dob.is==:heading_insert) \ + && dob.ln==0 + @@heading0=dob.obj + @@is4,@@is3,@@is2,@@is1,@@is0=0,0,0,0,1 + end if (@@is1 && !@@is2 && !@@is3 && !@@is4) if not (dob.is==:heading \ || dob.is==:heading_insert) \ - && dob.ln==1 + && dob.ln==0 $_ #; check end end @@ -284,9 +287,7 @@ module SiSU_HTML_Seg fn=@md.file.base_filename.html_seg(fnh) segfilename="#{@file.output_path.html_seg.dir}/#{fn}" output_seg_file=File.new(segfilename,'w') if @@seg_name_html[tracking-1] - minitoc=(@make.build.html_minitoc?) \ - ? @minitoc - : '' + minitoc=(@make.build.html_minitoc?) ? @minitoc : '' if dob.is==:heading \ || (@@seg_name_html[tracking-1] !~/endnotes|book_index|metadata/) SiSU_HTML_Seg::Output.new(@md,output_seg_file,@@seg,minitoc).output @@ -353,7 +354,7 @@ module SiSU_HTML_Seg && (@make.build.html_navigation_bar?) x=if (dob.is==:heading \ || dob.is==:heading_insert) \ - && (dob.ln.to_s =~/^[1-6]/) + && (dob.ln.to_s =~/^[0-6]/) x=if @@tracker < @@seg_total-1 format_head_seg.dot_control_pre_next else @@ -372,31 +373,38 @@ module SiSU_HTML_Seg if @make.build.html_navigation? if @@tracker < @@seg_total-1 @@segtocband=if @@tracker==0 - format_head_seg.toc_next2 #if format_head_seg.toc_next2 + format_head_seg.toc_next2 else - format_head_seg.toc_pre_next2 #if format_head_seg.toc_pre_next2 + format_head_seg.toc_pre_next2 end - else @@segtocband=format_head_seg.toc_pre2 #if format_head_seg.toc_pre2 + else @@segtocband=format_head_seg.toc_pre2 end else @@segtocband='' end @p_num ||= '' - if @@is1==1 + if @@is0==1 @author=%{#{@md.author}\n} if @md.author.to_s =~/\S/ @@seg[:tocband_banner] << format_head_seg.navigation_band(@@segtocband,@@seg[:dot_nav]) - conditional_div_close=if @@get_hash_fn =~/metadata/ #watch - '' - else '' - end - @@seg[:tocband_bannerless] << '
' << conditional_div_close << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) + @@seg[:tocband_bannerless] << '
' << format_head_seg.navigation_band_bottom(@@segtocband,@@seg[:dot_nav]) if @title_banner_ @@seg[:headings] << format_head_seg.title_banner(@md.title.main,@md.title.sub,@author).gsub(clean,'') end - ocn=(@@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ + ocn=(@@heading0[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ + ? $1 + : '' + @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) + txt_obj={ txt: @@heading0, ocn_display: @p_num.ocn_display } + format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj) + @@seg[:headings] << format_seg.title_heading0.gsub(clean,'') + @@heading0=@@heading0.gsub(/  [\d*+]+<\/sup> <\/a>/,'') + end + if @@is1==1 + heading1=@@heading1 + ocn=(heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ ? $1 : '' @p_num=SiSU_HTML_Format::ParagraphNumber.new(@md,ocn) - txt_obj={ txt: @@heading1, ocn_display: @p_num.ocn_display } + txt_obj={ txt: heading1, ocn_display: @p_num.ocn_display } format_seg=SiSU_HTML_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading1.gsub(clean,'') @@heading1=@@heading1.gsub(/  [\d*+]+<\/sup> <\/a>/,'') @@ -554,7 +562,7 @@ module SiSU_HTML_Seg if @md.flag_auto_endnotes if (dob.is==:heading \ || dob.is==:heading_insert) \ - && (dob.ln.to_s =~/^[1234]/) \ + && (dob.ln.to_s =~/^[0-4]/) \ and not @@fn.to_s.empty? @@seg_endnotes[@@fn]=[] @@seg_endnotes[@@fn] << @@seg_endnotes_array diff --git a/lib/sisu/v5/param.rb b/lib/sisu/v5/param.rb index 7288842d..e8eb3fc6 100644 --- a/lib/sisu/v5/param.rb +++ b/lib/sisu/v5/param.rb @@ -1090,11 +1090,12 @@ module SiSU_Param end end case para - when /^:?A~#{l_0}/ + #when /^:?A~/ + when /^:?B~#{l_0}/ @lvs[1]=1 - when /^:?B~#{l_1}/ + when /^:?C~#{l_1}/ @lvs[2]=1 - when /^:?C~#{l_2}/ + when /^:?D~#{l_2}/ @lvs[3]=1 when /^1~#{l_3}/ @lvs[4]=1 @@ -1103,7 +1104,7 @@ module SiSU_Param when /^3~#{l_5}/ @lvs[6]=1 end - if para =~ /^:A~/ #% processing + if para =~ /^:?A~/ #% processing if not defined? @title.full.nil? tf=para[/^:A~\S*(.+)$/m,1] tf="@title: #{tf}" diff --git a/lib/sisu/v5/param_make.rb b/lib/sisu/v5/param_make.rb index b83088d2..17d3b9a3 100644 --- a/lib/sisu/v5/param_make.rb +++ b/lib/sisu/v5/param_make.rb @@ -147,17 +147,18 @@ module SiSU_Param_Make x=@h['headings'] x=((x =~/;/) ? (x.split(/;\s*/)) : [ x ]) lv[0]=x - lv1=x[0] ||='1~ ' #some arbitrary changes made + lv0 ||='A~ ' #root level, single document apex, document title + lv1=x[0] ||='B~ ' lv[1]=/^#{lv1}/ - lv2=x[1] ||='2~ ' + lv2=x[1] ||='C~ ' lv[2]=/^#{lv2}/ - lv3=x[2] ||='3~ ' + lv3=x[2] ||='D~ ' lv[3]=/^#{lv3}/ - lv4=x[3] ||='4~ ' + lv4=x[3] ||='1~ ' lv[4]=/^#{lv4}/ - lv5=x[4] ||='5~ ' + lv5=x[4] ||='2~ ' lv[5]=/^#{lv5}/ - lv6=x[5] ||='6~ ' + lv6=x[5] ||='3~ ' lv[6]=/^#{lv6}/ lv end diff --git a/lib/sisu/v5/txt_asciidoc.rb b/lib/sisu/v5/txt_asciidoc.rb index 4e0e3d48..07b8832f 100644 --- a/lib/sisu/v5/txt_asciidoc.rb +++ b/lib/sisu/v5/txt_asciidoc.rb @@ -221,43 +221,43 @@ WOK def decorate def heading def inline - def l1 + def l0 '=' end - def l2 + def l1 '==' end - def l3 + def l2 '===' end - def l4 + def l3 '====' end - def l5 + def l4 '=====' end - def l6 + def l5 '' #'======' #logical end self end def underscore - def l1 + def l0 '=' end - def l2 + def l1 '-' end - def l3 + def l2 '~' end - def l4 + def l3 '^' end - def l5 + def l4 '+' end - def l6 + def l5 '' #'.' #proposed end self diff --git a/lib/sisu/v5/txt_markdown.rb b/lib/sisu/v5/txt_markdown.rb index 3a943876..96aca820 100644 --- a/lib/sisu/v5/txt_markdown.rb +++ b/lib/sisu/v5/txt_markdown.rb @@ -221,22 +221,22 @@ WOK def decorate def heading def inline #atx - def l1 + def l0 '#' end - def l2 + def l1 '##' end - def l3 + def l2 '###' end - def l4 + def l3 '####' end - def l5 + def l4 '#####' end - def l6 + def l5 '######' end self diff --git a/lib/sisu/v5/txt_plain.rb b/lib/sisu/v5/txt_plain.rb index 81fe7e3a..ca944a1f 100644 --- a/lib/sisu/v5/txt_plain.rb +++ b/lib/sisu/v5/txt_plain.rb @@ -221,11 +221,14 @@ WOK end def decorate def heading_underscore + def l0 + '=' + end def l1 '*' end def l2 - '=' + '+' end def l3 '~' @@ -377,6 +380,7 @@ WOK times=wrapped.length times=@wrap_width if times > @wrap_width @plaintext[:body] << case lv + when 0 then wrapped.upcase << break_line << decorate.heading_underscore.l0*times + p_num << break_line*2 when 1 then wrapped.upcase << break_line << decorate.heading_underscore.l1*times + p_num << break_line*2 when 2 then wrapped.upcase << break_line << decorate.heading_underscore.l2*times + p_num << break_line*2 when 3 then wrapped.upcase << break_line << decorate.heading_underscore.l3*times + p_num << break_line*2 diff --git a/lib/sisu/v5/txt_rst.rb b/lib/sisu/v5/txt_rst.rb index 8cf382d3..56a34de2 100644 --- a/lib/sisu/v5/txt_rst.rb +++ b/lib/sisu/v5/txt_rst.rb @@ -221,22 +221,22 @@ WOK def decorate def heading def underscore - def l1 + def l0 '=' end - def l2 + def l1 '-' end - def l3 + def l2 '`' end - def l4 + def l3 ':' end - def l5 + def l4 "'" end - def l6 + def l5 '"' end self diff --git a/lib/sisu/v5/txt_textile.rb b/lib/sisu/v5/txt_textile.rb index ddba6b6c..5645f490 100644 --- a/lib/sisu/v5/txt_textile.rb +++ b/lib/sisu/v5/txt_textile.rb @@ -221,22 +221,22 @@ WOK def decorate def heading def inline - def l1 + def l0 'h1. ' end - def l2 + def l1 'h2. ' end - def l3 + def l2 'h3. ' end - def l4 + def l3 'h4. ' end - def l5 + def l4 'h5. ' end - def l6 + def l5 'h6. ' end self diff --git a/lib/sisu/v5/xhtml.rb b/lib/sisu/v5/xhtml.rb index 932afd0b..0e0d7781 100644 --- a/lib/sisu/v5/xhtml.rb +++ b/lib/sisu/v5/xhtml.rb @@ -317,6 +317,7 @@ WOK if dob.is==:heading xml_structure(dob) dob.obj=case dob.ln + when 0 then x.heading_body0 when 1 then x.heading_body1 when 2 then x.heading_body2 when 3 then x.heading_body3 diff --git a/lib/sisu/v5/xhtml_epub2.rb b/lib/sisu/v5/xhtml_epub2.rb index 27496f99..33e3a529 100644 --- a/lib/sisu/v5/xhtml_epub2.rb +++ b/lib/sisu/v5/xhtml_epub2.rb @@ -209,7 +209,7 @@ module SiSU_XHTML_EPUB2 @@toc={ seg: [], seg_mini: [], scr: [], ncx: [], opf: [] } md_opf_a_content,md_opf_a_spine,md_opf_a_guide=[],[],[] @nav_no=0 - @s_a_no,@s_b_no,@s_c_no,@lv5_no,@lv6_no=0,0,0,0,0 + @s_a_no,@s_b_no,@s_c_no,@s_d_no,@lv5_no,@lv6_no=0,0,0,0,0,0 @@toc[:ncx] << @epub.toc_ncx.open #epub ncx navmap @@toc[:ncx] << @epub.toc_ncx.head_open << @epub.toc_ncx.head << @epub.toc_ncx.head_close @@toc[:ncx] << @epub.toc_ncx.doc_title << @epub.toc_ncx.doc_author @@ -231,7 +231,7 @@ module SiSU_XHTML_EPUB2 md_opf_a_spine << @epub.metadata_opf.spine_sisu_toc md_opf_a_guide << @epub.metadata_opf.guide_sisu_toc end - @ncxo=[nil,false,false,false,false,false,false] + @ncxo=[false,false,false,false,false,false,false] @dob_toc2,@dob_toc3=nil,nil @ncx_cls=[] @level_a_first_occurrence=true @@ -240,7 +240,7 @@ module SiSU_XHTML_EPUB2 || dob.is==:heading_insert dob_toc=dob.dup toc=case dob_toc.ln - when 1 + when 0 @s_a_no +=1 lv_name='section_a' + @s_a_no.to_s @nav_no+=1 @@ -251,20 +251,21 @@ module SiSU_XHTML_EPUB2 @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3] @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[2] @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[1] - @ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=true,false,false,false,false,false + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[0] + @ncxo[0],@ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=true,false,false,false,false,false,false @epub.sections(dob_toc,lv_name) - @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc if @level_a_first_occurrence \ && @make.build.toc? - @nav_no+=1 @@toc[:ncx] << @epub.toc_ncx.navmap_sisu_toc(@nav_no) #epub ncx navmap, toc + @nav_no+=1 @level_a_first_occurrence=false end + @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name) md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name) md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name) - SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_1 - when 2 + SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_0 + when 1 @s_b_no +=1 lv_name='section_b' + @s_b_no.to_s @nav_no+=1 @@ -274,6 +275,24 @@ module SiSU_XHTML_EPUB2 @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4] @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3] @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[2] + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[1] + @ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=true,false,false,false,false,false + @epub.sections(dob_toc,lv_name) + @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc + md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name) + md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name) + md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name) + SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_1 + when 2 + @s_c_no +=1 + lv_name='section_c' + @s_c_no.to_s + @nav_no+=1 + @nav_no2=@nav_no + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6] + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[5] + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[4] + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3] + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[2] @ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=true,false,false,false,false @epub.sections(dob_toc,lv_name) @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name) if dob_toc @@ -282,8 +301,8 @@ module SiSU_XHTML_EPUB2 md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name) SiSU_XHTML_EPUB2::Source::Toc.new(@md,dob_toc).level_2 when 3 - @s_c_no +=1 - lv_name='section_c' + @s_c_no.to_s + @s_d_no +=1 + lv_name='section_d' + @s_d_no.to_s @nav_no+=1 @nav_no3=@nav_no @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6] @@ -364,7 +383,8 @@ module SiSU_XHTML_EPUB2 @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[3] @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[2] @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[1] - @ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=false,false,false,false,false,false + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[0] + @ncxo[0],@ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=false,false,false,false,false,false,false md_opf_a_content << @epub.metadata_opf.manifest_images(@md.ec[:image]) @@toc[:seg] << "\n" @@toc[:scr] << "\n" @@ -381,9 +401,32 @@ module SiSU_XHTML_EPUB2 @@toc end protected + def level_0 + dob=@data + linkname=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'').strip + link=dob.ocn + title=linkname + toc={} + txt_obj={ txt: title } + format_toc=SiSU_XHTML_EPUB2_Format::FormatToc.new(@md,txt_obj) + toc[:seg]=format_toc.lev1 + title=if dob.ocn ==0 then linkname + else + @@toc[:scr] << '
' + link=(dob.ln) \ + ? dob.ln + : '' + %{
#{linkname}} + end + txt_obj={ txt: title } + format_toc=SiSU_XHTML_EPUB2_Format::FormatToc.new(@md,txt_obj) + toc[:scr]=format_toc.lev1 + toc + end def level_1 dob=@data - linkname,link=dob.obj.strip,dob.ocn + linkname=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'').strip + link=dob.ocn title=if dob.obj !~/Document Information/ linkname else @@ -422,7 +465,8 @@ module SiSU_XHTML_EPUB2 end def level_2 dob=@data - linkname,ocn=dob.obj.strip,dob.ocn + linkname=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'').strip + ocn=dob.ocn if ocn \ and ocn !~/#/ p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn) @@ -441,7 +485,8 @@ module SiSU_XHTML_EPUB2 end def level_3 dob=@data - linkname,ocn=dob.obj.strip,dob.ocn + linkname=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'').strip + ocn=dob.ocn if ocn \ and ocn !~/#/ p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn) @@ -460,7 +505,8 @@ module SiSU_XHTML_EPUB2 end def level_4 dob=@data - linkname,ocn=dob.obj.strip,dob.ocn + linkname=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'').strip + ocn=dob.ocn p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn) if ocn if dob.ln==4 seg_link=%{ @@ -485,7 +531,8 @@ module SiSU_XHTML_EPUB2 end def level_5 dob=@data - linkname,ocn=dob.obj.strip,dob.ocn + linkname=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'').strip + ocn=dob.ocn toc={} if ocn \ and ocn !~/#/ @@ -505,7 +552,8 @@ module SiSU_XHTML_EPUB2 end def level_6 dob=@data - linkname,ocn=dob.obj.strip,dob.ocn + linkname=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'').strip + ocn=dob.ocn toc={} if ocn \ and ocn !~/#/ diff --git a/lib/sisu/v5/xhtml_epub2_concordance.rb b/lib/sisu/v5/xhtml_epub2_concordance.rb index 6324a8cd..6d7c4758 100644 --- a/lib/sisu/v5/xhtml_epub2_concordance.rb +++ b/lib/sisu/v5/xhtml_epub2_concordance.rb @@ -160,11 +160,13 @@ WOK @env,@md,@ao_array=particulars.env,particulars.md,particulars.ao_array @path="#{@env.processing_path.epub}" @freq=Hash.new(0) - @rxp_lv1=/^#{Mx[:lv_o]}1:/ #fix Mx[:lv_o] - @rxp_lv2=/^#{Mx[:lv_o]}2:/ #fix Mx[:lv_o] - @rxp_lv3=/^#{Mx[:lv_o]}3:/ #fix Mx[:lv_o] + @rxp_lv0=/^#{Mx[:lv_o]}0:/ + @rxp_lv1=/^#{Mx[:lv_o]}1:/ + @rxp_lv2=/^#{Mx[:lv_o]}2:/ + @rxp_lv3=/^#{Mx[:lv_o]}3:/ @rxp_seg=/^#{Mx[:lv_o]}4:(\S+?)#{Mx[:lv_c]}/ @rxp_title=Regexp.new("^#{Mx[:meta_o]}title#{Mx[:meta_c]}\s*(.+?)\s*$") + @rxp_t0=Regexp.new('^T0') @rxp_t1=Regexp.new('^T1') @rxp_t2=Regexp.new('^T2') @rxp_t3=Regexp.new('^T3') @@ -271,12 +273,14 @@ WOK end @freq[word] +=1 @word_map[word] ||= [] - if line !~@rxp_lv1 \ + if line !~@rxp_lv0 \ + and line !~@rxp_lv1 \ and line !~@rxp_lv2 \ and line !~@rxp_lv3 @word_map[word] << location_seg("#{@seg}\##{toy}",toy) else @word_map[word] << case line + when @rxp_lv0 then location_seg('T0',toy) when @rxp_lv1 then location_seg('T1',toy) when @rxp_lv2 then location_seg('T2',toy) when @rxp_lv3 then location_seg('T3',toy) diff --git a/lib/sisu/v5/xhtml_epub2_format.rb b/lib/sisu/v5/xhtml_epub2_format.rb index b7b5f9a0..8dd8a88e 100644 --- a/lib/sisu/v5/xhtml_epub2_format.rb +++ b/lib/sisu/v5/xhtml_epub2_format.rb @@ -1306,6 +1306,7 @@ application/epub+zip dir_epub_cont=@md.env.processing_path.epub + '/' + Ep[:d_oebps] segfilename=dir_epub_cont + '/' + name output_epub_cont_seg=File.new(segfilename,'w') + txt=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'') output_epub_cont_seg << %{#{doc_type} @@ -1320,7 +1321,7 @@ application/epub+zip <div class="substance"> <label class="ocn"><a href="#o#{dob.ocn}" class="lnkocn">#{dob.ocn}</a></label> <h1 class="norm" id="o#{dob.ocn}"> - #{dob.obj} + #{txt} </h1> </div> </div> @@ -1413,15 +1414,16 @@ output_epub_cont_seg.close WOK end def navpoint(dob,no,fn_base,hashtag=nil) - fn=fn_base + Sfx[:epub_xhtml] - name=hashtag ? fn + hashtag : fn + fn=fn_base + Sfx[:epub_xhtml] + name=hashtag ? fn + hashtag : fn id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ ? '' : "-#{no}" + txt=dob.obj.gsub(/#{Mx[:en_a_o]}.+?#{Mx[:en_a_c]}|#{Mx[:en_b_o]}.+?#{Mx[:en_b_c]}/,'') <<-WOK <navPoint class="chapter" id="navpoint#{id_u}" playOrder="#{no}"> <navLabel> - <text>#{dob.obj}</text> + <text>#{txt}</text> </navLabel> <content src="#{name}" /> WOK @@ -1989,6 +1991,11 @@ output_epub_cont_seg.close </div> } end + def title_heading0 + DISABLE[:epub][:per_section_title] \ + ? '' + : title_heading('h1','tiny') + end def title_heading1 DISABLE[:epub][:per_section_title] \ ? '' diff --git a/lib/sisu/v5/xhtml_epub2_segments.rb b/lib/sisu/v5/xhtml_epub2_segments.rb index 07447020..764fcc17 100644 --- a/lib/sisu/v5/xhtml_epub2_segments.rb +++ b/lib/sisu/v5/xhtml_epub2_segments.rb @@ -124,8 +124,8 @@ WOK @@seg_name,@@seg_name_xhtml=[],[] @@seg_url=@@fn=@@get_hash_to=@@get_hash_fn='' @@loop_count=@@seg_total=@@tracker=0 - @@is4=@@is3=@@is2=@@is1=0 - @@heading1=@@heading2=@@heading3=@@heading4=0 + @@is4=@@is3=@@is2=@@is1=@@is0=0 + @@heading0=@@heading1=@@heading2=@@heading3=@@heading4=0 @@seg[:headings],@@seg[:main],@@seg[:idx],@@seg[:tail],@@seg_subtoc_array,@@seg_endnotes_array,@@seg[:endnote_all]=Array.new(7){[]} @@seg[:heading_endnotes]='' @@tablehead,@@number_of_cols=0,0 @@ -155,7 +155,7 @@ WOK protected def articles(data) tracking,newfile=0,0 - @@is4=@@is3=@@is2=@@is1=0 + @@is4=@@is3=@@is2=@@is1=@@is0=0 printed_endnote_seg='n' idx_xhtml=nil if @md.book_idx @@ -196,35 +196,38 @@ WOK #end if (dob.is==:heading \ || dob.is==:heading_insert) \ - and dob.ln==4 - if dob.ocn==0 - @@heading4=dob.obj - else @@heading4=dob.obj - end + && dob.ln==4 + @@heading4=dob.obj @@is4=newfile=1 end if (dob.is==:heading \ || dob.is==:heading_insert) \ - and dob.ln==3 + && dob.ln==3 @@heading3=dob.obj @@is4,@@is3=0,1 end if (dob.is==:heading \ || dob.is==:heading_insert) \ - and dob.ln==2 + && dob.ln==2 @@heading2=dob.obj @@is4,@@is3,@@is2=0,0,1 end if (dob.is==:heading \ || dob.is==:heading_insert) \ - and dob.ln==1 + && dob.ln==1 @@heading1=dob.obj @@is4,@@is3,@@is2,@@is1=0,0,0,1 end - if (@@is1 && !@@is2 && !@@is3 && !@@is4) + if (dob.is==:heading \ + || dob.is==:heading_insert) \ + && dob.ln==0 + @@heading0=dob.obj + @@is4,@@is3,@@is2,@@is1,@@is0=0,0,0,0,1 + end + if (@@is0 && !@@is1 && !@@is2 && !@@is3 && !@@is4) if not (dob.is==:heading \ || dob.is==:heading_insert) \ - and dob.ln==1 + && dob.ln==0 $_ #; check end end @@ -235,7 +238,7 @@ WOK newfile=0 if (dob.is==:heading \ || dob.is==:heading_insert) \ - and dob.ln==4 + && dob.ln==4 if tracking != 0 SiSU_XHTML_EPUB2_Seg::Seg.new(@md).tail segfilename="#{dir_epub_cont}/#{@@seg_name_xhtml[tracking-1]}#{Sfx[:epub_xhtml]}" @@ -275,8 +278,8 @@ WOK end if (dob.is==:heading \ || dob.is==:heading_insert) \ - and dob.ln==4 \ - and dob.name + && dob.ln==4 \ + && dob.name @@get_hash_to=dob.name @@get_hash_fn=dob.name end @@ -302,15 +305,19 @@ WOK def head(dob) clean=/<!.*?!>|<:.*?>$/ @p_num ||= '' - if @@is1==1 + if @@is0==1 if defined? @md.creator.author \ and @md.creator.author @author=%{<b>#{@md.creator.author}</b>\n} end - ocn=(@@heading1[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ - ? $1 - : '' - @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn) + @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,dob.ocn) + txt_obj={ txt: @@heading0, ocn_display: @p_num.ocn_display } + format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj) + @@seg[:headings] << format_seg.title_heading0.gsub(clean,'') + @@heading0=@@heading0.gsub(/#{$ep[:hsp]}<a name="-[\d*+]+" href="#_[\d*+]+">#{$ep[:hsp]}<sup>[\d*+]+<\/sup>#{$ep[:hsp]}<\/a>/,'') + end + if @@is1==1 + @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,dob.ocn) txt_obj={ txt: @@heading1, ocn_display: @p_num.ocn_display } format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading1.gsub(clean,'') @@ -318,10 +325,7 @@ WOK end if @@is2==1 heading2=@@heading2 - ocn=(heading2[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ - ? $1 - : '' - @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn) + @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,dob.ocn) txt_obj={ txt: heading2, ocn_display: @p_num.ocn_display } format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading2.gsub(clean,'') @@ -329,10 +333,7 @@ WOK end if @@is3==1 heading3=@@heading3 - ocn=(heading3[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ - ? $1 - : '' - @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn) + @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,dob.ocn) txt_obj={ txt: heading3, ocn_display: @p_num.ocn_display } format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading3.gsub(clean,'') @@ -340,10 +341,7 @@ WOK end if @@is4==1 heading4=@@heading4 - ocn=(heading4[/.+?#{Mx[:id_o]}~(\d+);(?:[oh]|[0-6]:)\d+;\w\d+#{Mx[:id_c]}#{Mx[:id_o]}#{@dp}:#{@dp}#{Mx[:id_c]}$/]) \ - ? $1 - : '' - @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,ocn) + @p_num=SiSU_XHTML_EPUB2_Format::ParagraphNumber.new(@md,dob.ocn) txt_obj={ txt: heading4, ocn_display: @p_num.ocn_display } format_seg=SiSU_XHTML_EPUB2_Format::FormatSeg.new(@md,txt_obj) @@seg[:headings] << format_seg.title_heading4.gsub(clean,'') diff --git a/lib/sisu/v5/xml_docbook5.rb b/lib/sisu/v5/xml_docbook5.rb index dc5de48a..0dddf264 100644 --- a/lib/sisu/v5/xml_docbook5.rb +++ b/lib/sisu/v5/xml_docbook5.rb @@ -132,18 +132,20 @@ module SiSU_XML_Docbook_Book def tags # collapsed --> def collapsed - %w[ 0 1 2 3 4 5 6 ] + %w[ 0 1 2 3 4 5 ] end def docbook(lc,chlv='') case lc - when 1 + when 0 'book' + when 1 + lc==chlv ? 'chapter' : 'section' when 2 lc==chlv ? 'chapter' : 'section' when 3 lc==chlv ? 'chapter' : 'section' when 4 - lc==chlv ? 'chapter' : 'section' + 'section' when 5 'section' when 6 @@ -219,7 +221,7 @@ module SiSU_XML_Docbook_Book doc_position=:body_and_tail else filename_docbook.puts structure_build_tag_close(o.lc,h) - filename_docbook.puts %{#{space*(o.lc-1)}<#{tags.docbook(o.lc,chlv)}#{tag_id}> + filename_docbook.puts %{#{space*(o.lc)}<#{tags.docbook(o.lc,chlv)}#{tag_id}> #{space*o.lc}<title#{id}> } end @@ -238,33 +240,41 @@ module SiSU_XML_Docbook_Book def structure_build_tag_close(lc,h) x=[] case h + when 0 + x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0) when 1 - x << "#{space*0}</#{tags.docbook(1)}>" if (lc <= 1) + x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1) + x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0) when 2 - x << "#{space*1}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) - x << "#{space*0}</#{tags.docbook(1)}>" if (lc <= 1) + x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) + x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1) + x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0) when 3 - x << "#{space*2}</#{tags.docbook(3,@chlv)}>" if (lc <= 3) - x << "#{space*1}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) - x << "#{space*0}</#{tags.docbook(1)}>" if (lc <= 1) + x << "#{space*3}</#{tags.docbook(3,@chlv)}>" if (lc <= 3) + x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) + x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1) + x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0) when 4 - x << "#{space*3}</#{tags.docbook(4,@chlv)}>" if (lc <= 4) - x << "#{space*2}</#{tags.docbook(3,@chlv)}>" if (lc <= 3) - x << "#{space*1}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) - x << "#{space*0}</#{tags.docbook(1)}>" if (lc <= 1) + x << "#{space*4}</#{tags.docbook(4,@chlv)}>" if (lc <= 4) + x << "#{space*3}</#{tags.docbook(3,@chlv)}>" if (lc <= 3) + x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) + x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1) + x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0) when 5 - x << "#{space*4}</#{tags.docbook(5)}>" if (lc <= 5) - x << "#{space*3}</#{tags.docbook(4,@chlv)}>" if (lc <= 4) - x << "#{space*2}</#{tags.docbook(3,@chlv)}>" if (lc <= 3) - x << "#{space*1}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) - x << "#{space*0}</#{tags.docbook(1)}>" if (lc <= 1) + x << "#{space*5}</#{tags.docbook(5)}>" if (lc <= 5) + x << "#{space*4}</#{tags.docbook(4,@chlv)}>" if (lc <= 4) + x << "#{space*5}</#{tags.docbook(3,@chlv)}>" if (lc <= 3) + x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) + x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1) + x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0) when 6 - x << "#{space*5}</#{tags.docbook(6)}>" if (lc <= 6) - x << "#{space*4}</#{tags.docbook(5)}>" if (lc <= 5) - x << "#{space*3}</#{tags.docbook(4,@chlv)}>" if (lc <= 4) - x << "#{space*2}</#{tags.docbook(3,@chlv)}>" if (lc <= 3) - x << "#{space*1}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) - x << "#{space*0}</#{tags.docbook(1)}>" if (lc <= 1) + x << "#{space*6}</#{tags.docbook(6)}>" if (lc <= 6) + x << "#{space*5}</#{tags.docbook(5)}>" if (lc <= 5) + x << "#{space*4}</#{tags.docbook(4,@chlv)}>" if (lc <= 4) + x << "#{space*3}</#{tags.docbook(3,@chlv)}>" if (lc <= 3) + x << "#{space*2}</#{tags.docbook(2,@chlv)}>" if (lc <= 2) + x << "#{space*1}</#{tags.docbook(1,@chlv)}>" if (lc <= 1) + x << "#{space*0}</#{tags.docbook(0)}>" if (lc <= 0) end x.join("\n") end diff --git a/lib/sisu/v5/xml_dom.rb b/lib/sisu/v5/xml_dom.rb index 22c711d3..c8f3d881 100644 --- a/lib/sisu/v5/xml_dom.rb +++ b/lib/sisu/v5/xml_dom.rb @@ -191,11 +191,10 @@ WOK n=n1=n2=n3=0 if dob.is==:heading lv=dob.ln - n=dob.ln - 1 + n=dob.ln n1=dob.ln - n2=dob.ln + 1 - n3=dob.ln + 2 - dob.ln - 3 + n2=dob.ln + 2 + n3=dob.ln + 3 else lv=nil end tag=if defined? dob.name and dob.name=~/\S+/ @@ -374,7 +373,12 @@ WOK format_scroll=SiSU_XML_Format::FormatScroll.new(@md,dob) if dob.is==:para and dob.indent ##FIX x=SiSU_XML_Format::FormatSeg.new(@md,dob) if dob.is==:heading - if dob.ln==1 + if dob.ln==0 + type="heading_section_#{dob.ln.to_s}" + xml_markup(dob) + xml_structure(dob,type) + dob.obj=x.heading_body0 + elsif dob.ln==1 type="heading_section_#{dob.ln.to_s}" xml_markup(dob) xml_structure(dob,type) diff --git a/lib/sisu/v5/xml_fictionbook2.rb b/lib/sisu/v5/xml_fictionbook2.rb index aeb74ef3..6549fa12 100644 --- a/lib/sisu/v5/xml_fictionbook2.rb +++ b/lib/sisu/v5/xml_fictionbook2.rb @@ -132,10 +132,11 @@ module SiSU_XML_Fictionbook def tags # collapsed --> def collapsed - %w[ 0 1 2 3 4 5 6 ] + %w[ 0 1 2 3 4 5 ] end def fictionbook - [ 'section', + [ + 'section', 'section', 'section', 'section', @@ -313,7 +314,7 @@ module SiSU_XML_Fictionbook h=o.lc elsif o.is ==:heading_insert \ and o.obj =~/Endnotes/ \ - and o.ln == 2 + and o.ln == 1 break elsif (o.of ==:para or o.of ==:block) filename_fictionbook.puts SiSU_TextUtils::Wrap.new("<p>#{o.obj}#{ocn}</p>",80,6).line_wrap @@ -327,26 +328,33 @@ module SiSU_XML_Fictionbook def structure_build_tag_close(lc,h) x=[] case h + when 0 + x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0) when 1 x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1) + x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0) when 2 x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2) x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1) + x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0) when 3 x << "#{space*3}</#{tags.fictionbook[3]}>" if (lc <= 3) x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2) x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1) + x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0) when 4 x << "#{space*4}</#{tags.fictionbook[4]}>" if (lc <= 4) x << "#{space*3}</#{tags.fictionbook[3]}>" if (lc <= 3) x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2) x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1) + x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0) when 5 x << "#{space*5}</#{tags.fictionbook[5]}>" if (lc <= 5) x << "#{space*4}</#{tags.fictionbook[4]}>" if (lc <= 4) x << "#{space*3}</#{tags.fictionbook[3]}>" if (lc <= 3) x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2) x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1) + x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0) when 6 x << "#{space*6}</#{tags.fictionbook[6]}>" if (lc <= 6) x << "#{space*5}</#{tags.fictionbook[5]}>" if (lc <= 5) @@ -354,6 +362,7 @@ module SiSU_XML_Fictionbook x << "#{space*3}</#{tags.fictionbook[3]}>" if (lc <= 3) x << "#{space*2}</#{tags.fictionbook[2]}>" if (lc <= 2) x << "#{space*1}</#{tags.fictionbook[1]}>" if (lc <= 1) + x << "#{space*0}</#{tags.fictionbook[0]}>" if (lc <= 0) end x.join("\n") end diff --git a/lib/sisu/v5/xml_format.rb b/lib/sisu/v5/xml_format.rb index ada32a39..7694f56b 100644 --- a/lib/sisu/v5/xml_format.rb +++ b/lib/sisu/v5/xml_format.rb @@ -298,30 +298,34 @@ WOK %{<p class="norm">#{@p_num.name}#{@headname}#{@dob.obj} </p>} + %{<p class="paranum"><font size="1" color="#777777">  #{@dob.ocn}</font></p>\n} end - def heading_body1 + def heading_body0 %{<h1 class="norm">#{@p_num.name}#{@headname}#{@dob.obj}</h1>} + %{<p class="paranum"><font size="1" color="#777777">  #{@dob.ocn}</font></p>\n} end - def heading_body2 + def heading_body1 %{<h2 class="norm">#{@p_num.name}#{@headname}#{@dob.obj}</h2>} + %{<p class="paranum"><font size="1" color="#777777">  #{@dob.ocn}</font></p>\n} end - def heading_body3 + def heading_body2 %{<h3 class="norm">#{@p_num.name}#{@headname}#{@dob.obj}</h3>} + %{<p class="paranum"><font size="1" color="#777777">  #{@dob.ocn}</font></p>\n} end - def heading_body4 + def heading_body3 %{<h4 class="norm">#{@p_num.name}#{@headname}#{@dob.obj}</h4>} + %{<p class="paranum"><font size="1" color="#777777">  #{@dob.ocn}</font></p>\n} end - def heading_body5 + def heading_body4 %{<h5 class="norm">#{@p_num.name}#{@headname}#{@dob.obj}</h5>} + %{<p class="paranum"><font size="1" color="#777777">  #{@dob.ocn}</font></p>\n} end - def heading_body6 + def heading_body5 %{<h6 class="norm">#{@p_num.name}#{@headname}#{@dob.obj}</h6>} + %{<p class="paranum"><font size="1" color="#777777">  #{@dob.ocn}</font></p>\n} end + def heading_body6 + %{<h7 class="norm">#{@p_num.name}#{@headname}#{@dob.obj}</h7>} + + %{<p class="paranum"><font size="1" color="#777777">  #{@dob.ocn}</font></p>\n} + end end class ParagraphNumber def initialize(md,ocn) @@ -1090,6 +1094,9 @@ WOK def heading_body heading_normal('p','norm') end + def heading_body0 + heading_normal('h1','norm') + end def heading_body1 heading_normal('h1','norm') end -- cgit v1.2.3