diff options
Diffstat (limited to 'lib/sisu/v3/epub_segments.rb')
-rw-r--r-- | lib/sisu/v3/epub_segments.rb | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/lib/sisu/v3/epub_segments.rb b/lib/sisu/v3/epub_segments.rb index ed8c8d39..b9b75b9c 100644 --- a/lib/sisu/v3/epub_segments.rb +++ b/lib/sisu/v3/epub_segments.rb @@ -360,8 +360,11 @@ WOK @p_num=SiSU_EPUB_Format::Paragraph_number.new(@md,dob.ocn) end sto=SiSU_EPUB_Format::Format_text_object.new(@md,dob) - dob_xhtml=if dob.is=='heading' or dob.is=='heading_insert' or dob.is=='para' - dob_xhtml=if dob.is=='heading' or dob.is=='heading_insert' + dob_xhtml=if dob.is=='heading' \ + or dob.is=='heading_insert' \ + or dob.is=='para' + dob_xhtml=if dob.is=='heading' \ + or dob.is=='heading_insert' if dob.ln==4 sto.seg_heading4 # work on see Split_text_object elsif dob.ln==5 @@ -369,16 +372,23 @@ WOK elsif dob.ln==6; sto.seg_heading6 end elsif dob.is=='para' - if dob.indent and dob.indent =~/[1-9]/ + if dob.indent \ + and dob.hang \ + and dob.indent =~/[0-9]/ \ + and dob.hang =~/[0-9]/ if dob.bullet_ - sto.format('li',"i#{dob.indent}") - else sto.format('p',"i#{dob.indent}") - end - else - if dob.bullet_ - sto.format('li','bullet') + if dob.indent =~/[1-9]/ + sto.format('li',"i#{dob.indent}") + else + sto.format('li','bullet') + end + elsif dob.indent == dob.hang + sto.format('p',"i#{dob.indent}") + elsif dob.indent != dob.hang + sto.format('p',"h#{dob.hang}i#{dob.indent}") else sto.para end + else sto.para end end elsif dob.is =~/^(?:block|group|alt)$/ @@ -395,7 +405,8 @@ WOK if @md.flag_separate_endnotes # may need to revisit, check dob.obj.gsub!(/"\s+href="#note_ref(\d+)">/,%{" href=\"endnotes#{Sfx[:epub_xhtml]}#note_ref\\1">}) #endnote- twice #removed file type end - if dob.is =~/heading|para/ and (not dob.ocn or dob.ocn.to_s.empty?) + if dob.is =~/heading|para/ \ + and (not dob.ocn or dob.ocn.to_s.empty?) format_seg=SiSU_EPUB_Format::Format_seg.new(@md,dob) end if (dob.is=='heading' or dob.is=='heading_insert' or dob.is=='para') \ @@ -414,7 +425,8 @@ WOK end def tail format_head_seg=SiSU_EPUB_Format::Head_seg.new(@md) - if @md.flag_auto_endnotes and @@seg_endnotes[@@get_hash_fn] + if @md.flag_auto_endnotes \ + and @@seg_endnotes[@@get_hash_fn] @@seg[:tail] << %{\n<div class="content">\n<div class="endnote">\n} if @@seg_endnotes[@@get_hash_fn].flatten.length > 0 @@seg[:tail] << format_head_seg.endnote_mark |