diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sisu/v3/dal_doc_objects.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v3/epub.rb | 48 | ||||
-rw-r--r-- | lib/sisu/v3/epub_format.rb | 154 | ||||
-rw-r--r-- | lib/sisu/v3/epub_tune.rb | 87 | ||||
-rw-r--r-- | lib/sisu/v3/html_tune.rb | 87 | ||||
-rw-r--r-- | lib/sisu/v3/param.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v3/texpdf_format.rb | 75 | ||||
-rw-r--r-- | lib/sisu/v4/dal_doc_objects.rb | 6 | ||||
-rw-r--r-- | lib/sisu/v4/epub.rb | 95 | ||||
-rw-r--r-- | lib/sisu/v4/epub_format.rb | 197 | ||||
-rw-r--r-- | lib/sisu/v4/epub_tune.rb | 87 | ||||
-rw-r--r-- | lib/sisu/v4/html_tune.rb | 87 | ||||
-rw-r--r-- | lib/sisu/v4/param.rb | 2 | ||||
-rw-r--r-- | lib/sisu/v4/sysenv.rb | 3 | ||||
-rw-r--r-- | lib/sisu/v4/texpdf_format.rb | 75 |
15 files changed, 451 insertions, 560 deletions
diff --git a/lib/sisu/v3/dal_doc_objects.rb b/lib/sisu/v3/dal_doc_objects.rb index 70a4913d..37dfdcd3 100644 --- a/lib/sisu/v3/dal_doc_objects.rb +++ b/lib/sisu/v3/dal_doc_objects.rb @@ -128,9 +128,11 @@ module SiSU_DAL_DocumentStructure end end def heading(h,o=nil) - if not h[:ln] and (h[:lv] and h[:lv]=~/[1-6A-C]/) + if not h[:ln] \ + and (h[:lv] and h[:lv]=~/[1-6A-C]/) h[:ln]=heading_ln(h[:lv]) - elsif not h[:lv] and (h[:ln] and h[:ln].to_s=~/[1-9]/) + elsif not h[:lv] \ + and (h[:ln] and h[:ln].to_s=~/[1-9]/) h[:lv]=heading_lv(h[:ln]) end of= @of #String, classification - group diff --git a/lib/sisu/v3/epub.rb b/lib/sisu/v3/epub.rb index c51a7656..fdb1398f 100644 --- a/lib/sisu/v3/epub.rb +++ b/lib/sisu/v3/epub.rb @@ -199,7 +199,7 @@ module SiSU_EPUB @@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=0,0,0 + @s_a_no,@s_b_no,@s_c_no,@lv5_no,@lv6_no=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 @@ -228,11 +228,13 @@ module SiSU_EPUB name_s_a='section_a' + @s_a_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] @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[1] - @ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4]=true,false,false,false + @ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=true,false,false,false,false,false @epub.sections(dob_toc,name_s_a) @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_s_a) if dob_toc if @level_a_first_occurrence \ @@ -250,10 +252,12 @@ module SiSU_EPUB name_s_b='section_b' + @s_b_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]=true,false,false + @ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=true,false,false,false,false @epub.sections(dob_toc,name_s_b) @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_s_b) if dob_toc md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_b) @@ -265,9 +269,11 @@ module SiSU_EPUB name_s_c='section_c' + @s_c_no.to_s @nav_no+=1 @nav_no3=@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] - @ncxo[3],@ncxo[4]=true,false + @ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=true,false,false,false @epub.sections(dob_toc,name_s_c) @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_s_c) if dob_toc md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_c) @@ -277,15 +283,39 @@ module SiSU_EPUB when 4 @ncx_cls=[] @nav_no+=1 + @dob_name=dob.name + @@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] - @ncxo[4]=true + @ncxo[4],@ncxo[5],@ncxo[6]=true,false,false @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no) if dob_toc md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc) md_opf_a_spine << @epub.metadata_opf.spine(dob_toc) md_opf_a_guide << @epub.metadata_opf.guide(dob_toc) SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_4 - when 5; SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_5 - when 6; SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_6 + when 5 + @ncx_cls=[] + name_lv5=@dob_name + '.xhtml' + '#o' + dob_toc.ocn.to_s + @nav_no+=1 + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6] + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[5] + @ncxo[5],@ncxo[6]=true,false + @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_lv5) if dob_toc + md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_lv5) + md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_lv5) + md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_lv5) + SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_5 + when 6 + @ncx_cls=[] + name_lv6=@dob_name + '.xhtml' + '#o' + dob_toc.ocn.to_s + @nav_no+=1 + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6] + @ncxo[6]=true + @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_lv6) if dob_toc + md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_lv6) + md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_lv6) + md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_lv6) + SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_6 else nil end toc.each do |k,d| @@ -308,10 +338,12 @@ module SiSU_EPUB end end end + @@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[1],@ncxo[2],@ncxo[3],@ncxo[4]=false,false,false,false + @ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=false,false,false,false,false,false md_opf_a_content << @epub.metadata_opf.manifest_images(@md.ec[:image]) @@toc[:seg] << "</div>\n</div>" @@toc[:scr] << "</div>\n</div>" diff --git a/lib/sisu/v3/epub_format.rb b/lib/sisu/v3/epub_format.rb index 3b0412ba..38717359 100644 --- a/lib/sisu/v3/epub_format.rb +++ b/lib/sisu/v3/epub_format.rb @@ -92,7 +92,7 @@ module SiSU_EPUB_Format end class CSS def css_epub_xhtml -<<WOK + <<-WOK /* SiSU epub css default stylesheet */ body { color: black; @@ -1214,7 +1214,7 @@ module SiSU_EPUB_Format margin-bottom: 20px; margin-right: 15mm; } -WOK + WOK end end class HeadInformation @@ -1232,17 +1232,17 @@ WOK @tocband_scroll,@tocband_segtoc=nil,nil end def doc_type_xhtml -<<WOK + <<-WOK <?xml version='1.0' encoding='utf-8'?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> -WOK + WOK end =begin ~/epub |-- META-INF - | `-- container.xml #✓ simple, make sure full-path of rootfile points to metadata.opf + | `-- container.xml # simple, make sure full-path of rootfile points to metadata.opf |-- content | |-- 1.xhtml | |-- 2.xhtml @@ -1262,21 +1262,21 @@ WOK | |-- metadata.xhtml | `-- toc.xhtml |-- metadata.opf #(i) metadata dc; (ii) manifest (contents); (iii) spine (mimetypes) - |-- mimetype #✓ application/epub+zip - `-- toc.ncx #✓ (i) head (ii) doc title (iii) navmap, list of navigation points (like chapters) + |-- mimetype # application/epub+zip + `-- toc.ncx #(i) head (ii) doc title (iii) navmap, list of navigation points (like chapters) =end def doc_type doc_type_xhtml end def mimetype - <<WOK + <<-WOK application/epub+zip -WOK + WOK end def metainf_container #container.xml file in META-INF directory #simple, make sure full-path of rootfile points to metadata.opf #epub_metadata.opf content.opf - <<WOK + <<-WOK <?xml version='1.0' encoding='utf-8'?> <container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> @@ -1285,7 +1285,7 @@ WOK media-type="application/oebps-package+xml" /> </rootfiles> </container> -WOK + WOK end def sections(dob,name) filename="#{name}#{Sfx[:epub_xhtml]}" @@ -1303,11 +1303,12 @@ WOK </head> #{@vz.color_body} <div class="content"> -<div class="substance"> - <label class="ocn"><a href="#o8" class="lnkocn">8</a></label> - <h1 class="norm" id="o8"> - #{dob.obj} - </h1> + <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} + </h1> + </div> </div> </body> </html>} @@ -1327,26 +1328,26 @@ output_epub_cont_seg.close close end def open - <<WOK + <<-WOK <?xml version="1.0"?> <!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN" "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd"> <ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1"> -WOK + WOK end def close - <<WOK + <<-WOK </ncx> -WOK + WOK end def head_open - <<WOK + <<-WOK <head> -WOK + WOK end def head depth=@md.lvs[1] + @md.lvs[2] + @md.lvs[3] + @md.lvs[4] - <<WOK + <<-WOK <!-- four required metadata items (for all NCX documents, (including the relaxed constraints of OPS 2.0) --> <title>#{@md.title.full} by #{@md.author}</title> @@ -1356,67 +1357,68 @@ WOK <meta name="dtb:depth" content="#{depth}" /> <meta name="dtb:totalPageCount" content="0" /> <meta name="dtb:maxPageNumber" content="0" /> -WOK + WOK end def head_close - <<WOK + <<-WOK </head> -WOK + WOK end def doc_title - <<WOK + <<-WOK <docTitle> <text>#{@md.title.full}</text> </docTitle> -WOK + WOK end def doc_author - <<WOK + <<-WOK <docAuthor> <text>#{@md.author}</text> </docAuthor> -WOK + WOK end def navmap_open - <<WOK + <<-WOK <navMap> -WOK + WOK end def navmap_sisu_toc(no) id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ ? '' : "-#{no}" - <<WOK + <<-WOK <navPoint id="navpoint#{id_u}" playOrder="#{no}"> <navLabel> <text>Table of Contents</text> </navLabel> <content src="index#{Sfx[:epub_xhtml]}" /> </navPoint> -WOK + WOK end def navpoint(dob,no,name=nil) name=name ? name : dob.name + cont_name=(name =~/#{Sfx[:epub_xhtml]}/) ? name : (name + Sfx[:epub_xhtml]) id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ ? '' : "-#{no}" - <<WOK + <<-WOK <navPoint id="navpoint#{id_u}" playOrder="#{no}"> <navLabel> <text>#{dob.obj}</text> </navLabel> - <content src="#{name}#{Sfx[:epub_xhtml]}" /> -WOK + <content src="#{cont_name}" /> + WOK end def navpoint_close - <<WOK + <<-WOK </navPoint> -WOK + WOK end def navmap_close - <<WOK + <<-WOK </navMap> -WOK + WOK end self end @@ -1434,15 +1436,15 @@ WOK package_close end def package_open - <<WOK + <<-WOK <?xml version='1.0' encoding='utf-8'?> <package xmlns="http://www.idpf.org/2007/opf" unique-identifier="EPB-UUID" version="2.0"> -WOK + WOK end def package_close - <<WOK + <<-WOK </package> -WOK + WOK end def metadata #metadata dc author=if defined? @md.creator.author \ @@ -1562,7 +1564,7 @@ WOK else '' end f=SiSU_Env::FileOp.new(@md) - <<WOK + <<-WOK <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf" unique-identifier="urn:uuid:#{@md.dgst[1]}" version="2.0"> @@ -1572,89 +1574,91 @@ WOK <dc:identifier id="bookid">urn:uuid:#{@md.dgst[1]}</dc:identifier> <!-- <dc:identifier id="EPB-UUID">urn:uuid:#{@md.dgst[1]}</dc:identifier> --> </metadata> -WOK + WOK end def manifest_open - <<WOK + <<-WOK <manifest> <!-- NCX --> <item id="ncx" href="#{Ep[:f_ncx]}" media-type="application/x-dtbncx+xml" /> <!-- CSS Style Sheets --> <item id="main-css" href="css/xhtml.css" media-type="text/css" /> <!-- Content Documents --> -WOK + WOK end def manifest_content_sisu_toc - <<WOK + <<-WOK <item id="index" href="index.xhtml" media-type="application/xhtml+xml" /> -WOK + WOK end def manifest_content(dob,name=nil) name=name ? name : dob.name - <<WOK - <item id="#{name}" href="#{name}#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" /> -WOK + href_name=(name =~/#{Sfx[:epub_xhtml]}/) ? name : (name + Sfx[:epub_xhtml]) + <<-WOK + <item id="#{name}" href="#{href_name}" media-type="application/xhtml+xml" /> + WOK end def manifest_images(imgs) imgs=imgs + ['arrow_next_red.png','arrow_prev_red.png','arrow_up_red.png','bullet_09.png'] images=[" <!-- Images -->\n"] imgs.each do |i| image,type=/(\S+?)\.(png|jpg|gif)/.match(i)[1,2] - images<<<<WOK + images<<<<-WOK <item id="#{image}" href="image/#{image}.#{type}" media-type="image/#{type}" /> -WOK + WOK end images=images.join('') images end def manifest_close - <<WOK + <<-WOK </manifest> -WOK + WOK end def spine_open #spine: reading order of XHTML files from manifest, idref attribute refers back to id in manifest (exclude images, CSS etc.). - <<WOK + <<-WOK <spine toc="ncx"> -WOK + WOK end def spine_sisu_toc - <<WOK + <<-WOK <itemref idref="index" linear="yes" /> -WOK + WOK end def spine(dob,name=nil) name=name ? name : dob.name - <<WOK + <<-WOK <itemref idref="#{name}" linear="yes" /> -WOK + WOK end def spine_close - <<WOK + <<-WOK </spine> -WOK + WOK end def guide_open #guide: presentation order of XHTML files by reader). - <<WOK + <<-WOK <guide> -WOK + WOK end def guide_sisu_toc - <<WOK + <<-WOK <reference type="index" href="index#{Sfx[:epub_xhtml]}" /> -WOK + WOK end def guide(dob,name=nil) name=name ? name : dob.name - <<WOK - <reference type="text" href="#{name}#{Sfx[:epub_xhtml]}" /> -WOK + guide_name=(name =~/#{Sfx[:epub_xhtml]}/) ? name : (name + Sfx[:epub_xhtml]) + <<-WOK + <reference type="text" href="#{guide_name}" /> + WOK end def guide_close - <<WOK + <<-WOK </guide> -WOK + WOK end self end diff --git a/lib/sisu/v3/epub_tune.rb b/lib/sisu/v3/epub_tune.rb index 89e30150..7bcfe03e 100644 --- a/lib/sisu/v3/epub_tune.rb +++ b/lib/sisu/v3/epub_tune.rb @@ -102,93 +102,6 @@ module SiSU_EPUB_Tune end str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;'). gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;'). - gsub(/\*/u,'*'). # * - gsub(/\+/u,'+'). # + - gsub(/¢/u,'¢'). # ¢ - gsub(/£/u,'£'). # £ - gsub(/¥/u,'¥'). # ¥ - gsub(/§/u,'§'). # § - gsub(/©/u,'©'). # © - gsub(/ª/u,'ª'). # ª - gsub(/«/u,'«'). # « - gsub(/®/u,'®'). # ® - gsub(/°/u,'°'). # ° - gsub(/±/u,'±'). # ± - gsub(/²/u,'²'). # ² - gsub(/³/u,'³'). # ³ - gsub(/µ/u,'µ'). # µ - gsub(/¶/u,'¶'). # ¶ - gsub(/¹/u,'¹'). # ¹ - gsub(/º/u,'º'). # º - gsub(/»/u,'»'). # » - gsub(/¼/u,'¼'). # ¼ - gsub(/½/u,'½'). # ½ - gsub(/¾/u,'¾'). # ¾ - gsub(/×/u,'×'). # × - gsub(/÷/u,'÷'). # ÷ - gsub(/¿/u,'¿'). # ¿ - gsub(/À/u,'À'). # À - gsub(/Á/u,'Á'). # Á - gsub(/Â/u,'Â'). # Â - gsub(/Ã/u,'Ã'). # Ã - gsub(/Ä/u,'Ä'). # Ä - gsub(/Å/u,'Å'). # Å - gsub(/Æ/u,'Æ'). # Æ - gsub(/Ç/u,'Ç'). # Ç - gsub(/È/u,'È'). # È - gsub(/É/u,'É'). # É - gsub(/Ê/u,'Ê'). # Ê - gsub(/Ë/u,'Ë'). # Ë - gsub(/Ì/u,'Ì'). # Ì - gsub(/Í/u,'Í'). # Í - gsub(/Î/u,'Î'). # Î - gsub(/Ï/u,'Ï'). # Ï - gsub(/Ð/u,'Ð'). # Ð - gsub(/Ñ/u,'Ñ'). # Ñ - gsub(/Ò/u,'Ò'). # Ò - gsub(/Ó/u,'Ó'). # Ó - gsub(/Ô/u,'Ô'). # Ô - gsub(/Õ/u,'Õ'). # Õ - gsub(/Ö/u,'Ö'). # Ö - gsub(/Ø/u,'Ø'). # Ø - gsub(/Ù/u,'Ù'). # Ù - gsub(/Ú/u,'Ú'). # Ú - gsub(/Û/u,'Û'). # Û - gsub(/Ü/u,'Ü'). # Ü - gsub(/Ý/u,'Ý'). # Ý - gsub(/Þ/u,'Þ'). # Þ - gsub(/ß/u,'ß'). # ß - gsub(/à/u,'à'). # à - gsub(/á/u,'á'). # á - gsub(/â/u,'â'). # â - gsub(/ã/u,'ã'). # ã - gsub(/ä/u,'ä'). # ä - gsub(/å/u,'å'). # å - gsub(/æ/u,'æ'). # æ - gsub(/ç/u,'ç'). # ç - gsub(/è/u,'è'). # è - gsub(/é/u,'é'). # é - gsub(/ê/u,'ê'). # ê - gsub(/ë/u,'ë'). # ë - gsub(/ì/u,'ì'). # ì - gsub(/í/u,'í'). # í - gsub(/î/u,'î'). # î - gsub(/ï/u,'ï'). # ï - gsub(/ð/u,'ð'). # ð - gsub(/ñ/u,'ñ'). # ñ - gsub(/ò/u,'ò'). # ò - gsub(/ó/u,'ó'). # ó - gsub(/ô/u,'ô'). # ô - gsub(/õ/u,'õ'). # õ - gsub(/ö/u,'ö'). # ö - gsub(/ø/u,'ø'). # ø - gsub(/ù/u,'ù'). # ú - gsub(/ú/u,'ú'). # û - gsub(/û/u,'û'). # ü - gsub(/ü/u,'ü'). # ý - gsub(/þ/u,'þ'). # þ - gsub(/ÿ/u,'ÿ'). # ÿ - gsub(/ý/u,'ý'). gsub(/<br>/u,'<br />'). gsub(/#{Mx[:nbsp]}/u,' ') end diff --git a/lib/sisu/v3/html_tune.rb b/lib/sisu/v3/html_tune.rb index 41c6e24d..81969961 100644 --- a/lib/sisu/v3/html_tune.rb +++ b/lib/sisu/v3/html_tune.rb @@ -106,92 +106,7 @@ module SiSU_HTML_Tune else html.obj end str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;'). - gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;'). - gsub(/¢/u,'¢'). # ¢ - gsub(/£/u,'£'). # £ - gsub(/¥/u,'¥'). # ¥ - gsub(/§/u,'§'). # § - gsub(/©/u,'©'). # © - gsub(/ª/u,'ª'). # ª - gsub(/«/u,'«'). # « - gsub(/®/u,'®'). # ® - gsub(/°/u,'°'). # ° - gsub(/±/u,'±'). # ± - gsub(/²/u,'²'). # ² - gsub(/³/u,'³'). # ³ - gsub(/µ/u,'µ'). # µ - gsub(/¶/u,'¶'). # ¶ - gsub(/¹/u,'¹'). # ¹ - gsub(/º/u,'º'). # º - gsub(/»/u,'»'). # » - gsub(/¼/u,'¼'). # ¼ - gsub(/½/u,'½'). # ½ - gsub(/¾/u,'¾'). # ¾ - gsub(/×/u,'×'). # × - gsub(/÷/u,'÷'). # ÷ - gsub(/¿/u,'¿'). # ¿ - gsub(/À/u,'À'). # À - gsub(/Á/u,'Á'). # Á - gsub(/Â/u,'Â'). # Â - gsub(/Ã/u,'Ã'). # Ã - gsub(/Ä/u,'Ä'). # Ä - gsub(/Å/u,'Å'). # Å - gsub(/Æ/u,'Æ'). # Æ - gsub(/Ç/u,'Ç'). # Ç - gsub(/È/u,'È'). # È - gsub(/É/u,'É'). # É - gsub(/Ê/u,'Ê'). # Ê - gsub(/Ë/u,'Ë'). # Ë - gsub(/Ì/u,'Ì'). # Ì - gsub(/Í/u,'Í'). # Í - gsub(/Î/u,'Î'). # Î - gsub(/Ï/u,'Ï'). # Ï - gsub(/Ð/u,'Ð'). # Ð - gsub(/Ñ/u,'Ñ'). # Ñ - gsub(/Ò/u,'Ò'). # Ò - gsub(/Ó/u,'Ó'). # Ó - gsub(/Ô/u,'Ô'). # Ô - gsub(/Õ/u,'Õ'). # Õ - gsub(/Ö/u,'Ö'). # Ö - gsub(/Ø/u,'Ø'). # Ø - gsub(/Ù/u,'Ù'). # Ù - gsub(/Ú/u,'Ú'). # Ú - gsub(/Û/u,'Û'). # Û - gsub(/Ü/u,'Ü'). # Ü - gsub(/Ý/u,'Ý'). # Ý - gsub(/Þ/u,'Þ'). # Þ - gsub(/ß/u,'ß'). # ß - gsub(/à/u,'à'). # à - gsub(/á/u,'á'). # á - gsub(/â/u,'â'). # â - gsub(/ã/u,'ã'). # ã - gsub(/ä/u,'ä'). # ä - gsub(/å/u,'å'). # å - gsub(/æ/u,'æ'). # æ - gsub(/ç/u,'ç'). # ç - gsub(/è/u,'è'). # è - gsub(/é/u,'é'). # é - gsub(/ê/u,'ê'). # ê - gsub(/ë/u,'ë'). # ë - gsub(/ì/u,'ì'). # ì - gsub(/í/u,'í'). # í - gsub(/î/u,'î'). # î - gsub(/ï/u,'ï'). # ï - gsub(/ð/u,'ð'). # ð - gsub(/ñ/u,'ñ'). # ñ - gsub(/ò/u,'ò'). # ò - gsub(/ó/u,'ó'). # ó - gsub(/ô/u,'ô'). # ô - gsub(/õ/u,'õ'). # õ - gsub(/ö/u,'ö'). # ö - gsub(/ø/u,'ø'). # ø - gsub(/ù/u,'ù'). # ú - gsub(/ú/u,'ú'). # û - gsub(/û/u,'û'). # ü - gsub(/ü/u,'ü'). # ý - gsub(/þ/u,'þ'). # þ - gsub(/ÿ/u,'ÿ'). # ÿ - gsub(/ý/u,'ý') + gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;') end end class Tune diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb index c4befa26..0212c500 100644 --- a/lib/sisu/v3/param.rb +++ b/lib/sisu/v3/param.rb @@ -1169,7 +1169,7 @@ module SiSU_Param sm_a,sm_b,sm_c=fns_array[0].match(/^(?:%\s+)?(?:SiSU\s+(?:master\s+)?|sisu-)([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?$/)[1..3] sm_c ||=0 sv=(@opt.cmd =~/[VMv]/) ? ("SiSU version (#{@sisu_version[:version]})") : '' - s_a,s_b,s_c=@sisu_version[:version].match(/^([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?(?:\-\S+)?$/)[1..3] + s_a,s_b,s_c=@sisu_version[:version].match(/^([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?(?:[~-]\S+)?$/)[1..3] tell=(@markup_version_declared.to_f==@markup_version.determined) \ ? SiSU_Screen::Ansi.new(@opt.cmd,"Markup version (#{@markup_version.series} version #{@markup_version.determined})",sv) : SiSU_Screen::Ansi.new(@opt.cmd,"Markup version declared (#{@markup_version_declared}), determined (#{@markup_version.series} version #{@markup_version.determined})",sv) diff --git a/lib/sisu/v3/texpdf_format.rb b/lib/sisu/v3/texpdf_format.rb index 9d896f34..e1915d92 100644 --- a/lib/sisu/v3/texpdf_format.rb +++ b/lib/sisu/v3/texpdf_format.rb @@ -1577,3 +1577,78 @@ WOK end end __END__ +#ack usepackage texpdf* +#ack usepackage texpdf* |ack '\{.+?\}' +#see sisu_texpdf_usepackage.rb + alltt.sty + amssymb.sty + babel.sty + boites.sty + color.sty + endnotes.sty + fancyhdr.sty + fontspec.sty + footmisc.sty + graphicx.sty + inputenc.sty + listings.sty + longtable.sty + manyfoot.sty + multicol.sty + parskip.sty + polyglossia.sty + soul.sty + textcomp.sty + thumbpdf.sty + titlepic.sty + ucs.sty + ulem.sty + url.sty + xetex.sty + xltxtra.sty + xunicode.sty +--- +texlive-latex-base +texlive-base +texlive-latex-extra +texlive-latex-recommended +texlive-xetex +texlive-generic-recommended +--- +texlive-latex-base: + /usr/share/texlive/texmf-dist/tex/generic/babel/babel.sty + /usr/share/texlive/texmf-dist/tex/latex/base/alltt.sty + /usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty + /usr/share/texlive/texmf-dist/tex/latex/base/textcomp.sty + /usr/share/texlive/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty + /usr/share/texlive/texmf-dist/tex/latex/graphics/color.sty + /usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty + /usr/share/texlive/texmf-dist/tex/latex/tools/longtable.sty + /usr/share/texlive/texmf-dist/tex/latex/tools/multicol.sty +--- +texlive-base: + /usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty +--- +texlive-latex-extra: + /usr/share/texlive/texmf-dist/tex/latex/boites/boites.sty + /usr/share/texlive/texmf-dist/tex/latex/endnotes/endnotes.sty + /usr/share/texlive/texmf-dist/tex/latex/footmisc/footmisc.sty + /usr/share/texlive/texmf-dist/tex/latex/ncctools/manyfoot.sty + /usr/share/texlive/texmf-dist/tex/latex/soul/soul.sty + /usr/share/texlive/texmf-dist/tex/latex/titlepic/titlepic.sty + /usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty +--- +texlive-latex-recommended: + /usr/share/texlive/texmf-dist/tex/generic/thumbpdf/thumbpdf.sty + /usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.sty + /usr/share/texlive/texmf-dist/tex/latex/listings/listings.sty + /usr/share/texlive/texmf-dist/tex/latex/parskip/parskip.sty + /usr/share/texlive/texmf-dist/tex/latex/url/url.sty +--- +texlive-xetex: + /usr/share/texlive/texmf-dist/tex/latex/xltxtra/xltxtra.sty + /usr/share/texlive/texmf-dist/tex/xelatex/polyglossia/polyglossia.sty + /usr/share/texlive/texmf-dist/tex/xelatex/xunicode/xunicode.sty +--- +texlive-generic-recommended: + /usr/share/texlive/texmf-dist/tex/generic/ulem/ulem.sty diff --git a/lib/sisu/v4/dal_doc_objects.rb b/lib/sisu/v4/dal_doc_objects.rb index 70a4913d..37dfdcd3 100644 --- a/lib/sisu/v4/dal_doc_objects.rb +++ b/lib/sisu/v4/dal_doc_objects.rb @@ -128,9 +128,11 @@ module SiSU_DAL_DocumentStructure end end def heading(h,o=nil) - if not h[:ln] and (h[:lv] and h[:lv]=~/[1-6A-C]/) + if not h[:ln] \ + and (h[:lv] and h[:lv]=~/[1-6A-C]/) h[:ln]=heading_ln(h[:lv]) - elsif not h[:lv] and (h[:ln] and h[:ln].to_s=~/[1-9]/) + elsif not h[:lv] \ + and (h[:ln] and h[:ln].to_s=~/[1-9]/) h[:lv]=heading_lv(h[:ln]) end of= @of #String, classification - group diff --git a/lib/sisu/v4/epub.rb b/lib/sisu/v4/epub.rb index d2d5cc6c..1af5ec49 100644 --- a/lib/sisu/v4/epub.rb +++ b/lib/sisu/v4/epub.rb @@ -197,7 +197,7 @@ module SiSU_EPUB @@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=0,0,0 + @s_a_no,@s_b_no,@s_c_no,@lv5_no,@lv6_no=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 @@ -230,67 +230,100 @@ module SiSU_EPUB toc=case dob_toc.ln when 1 @s_a_no +=1 - name_s_a='section_a' + @s_a_no.to_s + lv_name='section_a' + @s_a_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] @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[1] - @ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4]=true,false,false,false - @epub.sections(dob_toc,name_s_a) - @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_s_a) if dob_toc + @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 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 @level_a_first_occurrence=false end - md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_a) - md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_s_a) - md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_s_a) + 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_EPUB::Source::Toc.new(@md,dob_toc).level_1 when 2 @s_b_no +=1 - name_s_b='section_b' + @s_b_no.to_s + lv_name='section_b' + @s_b_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]=true,false,false - @epub.sections(dob_toc,name_s_b) - @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_s_b) if dob_toc - md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_b) - md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_s_b) - md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_s_b) + @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 + 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_EPUB::Source::Toc.new(@md,dob_toc).level_2 when 3 @s_c_no +=1 - name_s_c='section_c' + @s_c_no.to_s + lv_name='section_c' + @s_c_no.to_s @nav_no+=1 @nav_no3=@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] - @ncxo[3],@ncxo[4]=true,false - @epub.sections(dob_toc,name_s_c) - @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,name_s_c) if dob_toc - md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,name_s_c) - md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,name_s_c) - md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,name_s_c) + @ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=true,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_EPUB::Source::Toc.new(@md,dob_toc).level_3 when 4 @ncx_cls=[] + lv_name=dob_toc.name @nav_no+=1 + @dob_name=dob.name + @@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] - @ncxo[4]=true - @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no) if dob_toc - md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc) - md_opf_a_spine << @epub.metadata_opf.spine(dob_toc) - md_opf_a_guide << @epub.metadata_opf.guide(dob_toc) + @ncxo[4],@ncxo[5],@ncxo[6]=true,false,false + @@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_EPUB::Source::Toc.new(@md,dob_toc).level_4 - when 5; SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_5 - when 6; SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_6 + when 5 + @ncx_cls=[] + hashtag='#o' + dob_toc.ocn.to_s + lv_name=@dob_name + @nav_no+=1 + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6] + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[5] + @ncxo[5],@ncxo[6]=true,false + @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name,hashtag) if dob_toc + md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name,hashtag) + md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name,hashtag) + md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name,hashtag) + SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_5 + when 6 + @ncx_cls=[] + hashtag='#o' + dob_toc.ocn.to_s + lv_name=@dob_name + @nav_no+=1 + @@toc[:ncx] << @epub.toc_ncx.navpoint_close if @ncxo[6] + @ncxo[6]=true + @@toc[:ncx] << @epub.toc_ncx.navpoint(dob_toc,@nav_no,lv_name,hashtag) if dob_toc + md_opf_a_content << @epub.metadata_opf.manifest_content(dob_toc,lv_name,hashtag) + md_opf_a_spine << @epub.metadata_opf.spine(dob_toc,lv_name,hashtag) + md_opf_a_guide << @epub.metadata_opf.guide(dob_toc,lv_name,hashtag) + SiSU_EPUB::Source::Toc.new(@md,dob_toc).level_6 else nil end toc.each do |k,d| @@ -313,10 +346,12 @@ module SiSU_EPUB end end end + @@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[1],@ncxo[2],@ncxo[3],@ncxo[4]=false,false,false,false + @ncxo[1],@ncxo[2],@ncxo[3],@ncxo[4],@ncxo[5],@ncxo[6]=false,false,false,false,false,false md_opf_a_content << @epub.metadata_opf.manifest_images(@md.ec[:image]) @@toc[:seg] << "</div>\n</div>" @@toc[:scr] << "</div>\n</div>" diff --git a/lib/sisu/v4/epub_format.rb b/lib/sisu/v4/epub_format.rb index 5a63a6ec..84d32000 100644 --- a/lib/sisu/v4/epub_format.rb +++ b/lib/sisu/v4/epub_format.rb @@ -92,7 +92,7 @@ module SiSU_EPUB_Format end class CSS def css_epub_xhtml -<<WOK + <<-WOK /* SiSU epub css default stylesheet */ body { color: black; @@ -1214,7 +1214,7 @@ module SiSU_EPUB_Format margin-bottom: 20px; margin-right: 15mm; } -WOK + WOK end end class HeadInformation @@ -1232,17 +1232,17 @@ WOK @tocband_scroll,@tocband_segtoc=nil,nil end def doc_type_xhtml -<<WOK + <<-WOK <?xml version='1.0' encoding='utf-8'?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> -WOK + WOK end =begin ~/epub |-- META-INF - | `-- container.xml #✓ simple, make sure full-path of rootfile points to metadata.opf + | `-- container.xml # simple, make sure full-path of rootfile points to metadata.opf |-- content | |-- 1.xhtml | |-- 2.xhtml @@ -1262,21 +1262,21 @@ WOK | |-- metadata.xhtml | `-- toc.xhtml |-- metadata.opf #(i) metadata dc; (ii) manifest (contents); (iii) spine (mimetypes) - |-- mimetype #✓ application/epub+zip - `-- toc.ncx #✓ (i) head (ii) doc title (iii) navmap, list of navigation points (like chapters) + |-- mimetype # application/epub+zip + `-- toc.ncx #(i) head (ii) doc title (iii) navmap, list of navigation points (like chapters) =end def doc_type doc_type_xhtml end def mimetype - <<WOK + <<-WOK application/epub+zip -WOK + WOK end def metainf_container #container.xml file in META-INF directory #simple, make sure full-path of rootfile points to metadata.opf #epub_metadata.opf content.opf - <<WOK + <<-WOK <?xml version='1.0' encoding='utf-8'?> <container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> @@ -1285,12 +1285,12 @@ WOK media-type="application/oebps-package+xml" /> </rootfiles> </container> -WOK + WOK end - def sections(dob,name) - filename="#{name}#{Sfx[:epub_xhtml]}" - dir_epub_cont="#{@md.env.processing_path.epub}/#{Ep[:d_oebps]}" - segfilename="#{dir_epub_cont}/#{filename}" + def sections(dob,fn_base) + name=fn_base + Sfx[:epub_xhtml] + dir_epub_cont=@md.env.processing_path.epub + '/' + Ep[:d_oebps] + segfilename=dir_epub_cont + '/' + name output_epub_cont_seg=File.new(segfilename,'w') output_epub_cont_seg << %{#{doc_type} <head> @@ -1303,11 +1303,12 @@ WOK </head> #{@vz.color_body} <div class="content"> -<div class="substance"> - <label class="ocn"><a href="#o8" class="lnkocn">8</a></label> - <h1 class="norm" id="o8"> - #{dob.obj} - </h1> + <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} + </h1> + </div> </div> </body> </html>} @@ -1327,26 +1328,26 @@ output_epub_cont_seg.close close end def open - <<WOK + <<-WOK <?xml version="1.0"?> <!DOCTYPE ncx PUBLIC "-//NISO//DTD ncx 2005-1//EN" "http://www.daisy.org/z3986/2005/ncx-2005-1.dtd"> <ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1"> -WOK + WOK end def close - <<WOK + <<-WOK </ncx> -WOK + WOK end def head_open - <<WOK + <<-WOK <head> -WOK + WOK end def head depth=@md.lvs[1] + @md.lvs[2] + @md.lvs[3] + @md.lvs[4] - <<WOK + <<-WOK <!-- four required metadata items (for all NCX documents, (including the relaxed constraints of OPS 2.0) --> <title>#{@md.title.full} by #{@md.author}</title> @@ -1356,67 +1357,68 @@ WOK <meta name="dtb:depth" content="#{depth}" /> <meta name="dtb:totalPageCount" content="0" /> <meta name="dtb:maxPageNumber" content="0" /> -WOK + WOK end def head_close - <<WOK + <<-WOK </head> -WOK + WOK end def doc_title - <<WOK + <<-WOK <docTitle> <text>#{@md.title.full}</text> </docTitle> -WOK + WOK end def doc_author - <<WOK + <<-WOK <docAuthor> <text>#{@md.author}</text> </docAuthor> -WOK + WOK end def navmap_open - <<WOK + <<-WOK <navMap> -WOK + WOK end def navmap_sisu_toc(no) id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ ? '' : "-#{no}" - <<WOK + <<-WOK <navPoint id="navpoint#{id_u}" playOrder="#{no}"> <navLabel> <text>Table of Contents</text> </navLabel> <content src="index#{Sfx[:epub_xhtml]}" /> </navPoint> -WOK + WOK end - def navpoint(dob,no,name=nil) - name=name ? name : dob.name + def navpoint(dob,no,fn_base,hashtag=nil) + fn=fn_base + Sfx[:epub_xhtml] + name=hashtag ? fn + hashtag : fn id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ ? '' : "-#{no}" - <<WOK + <<-WOK <navPoint id="navpoint#{id_u}" playOrder="#{no}"> <navLabel> <text>#{dob.obj}</text> </navLabel> - <content src="#{name}#{Sfx[:epub_xhtml]}" /> -WOK + <content src="#{name}" /> + WOK end def navpoint_close - <<WOK + <<-WOK </navPoint> -WOK + WOK end def navmap_close - <<WOK + <<-WOK </navMap> -WOK + WOK end self end @@ -1434,15 +1436,15 @@ WOK package_close end def package_open - <<WOK + <<-WOK <?xml version='1.0' encoding='utf-8'?> <package xmlns="http://www.idpf.org/2007/opf" unique-identifier="EPB-UUID" version="2.0"> -WOK + WOK end def package_close - <<WOK + <<-WOK </package> -WOK + WOK end def metadata #metadata dc cover_image=if defined? @md.make.cover_image \ @@ -1568,7 +1570,7 @@ WOK else '' end f=SiSU_Env::FileOp.new(@md) - <<WOK + <<-WOK <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf" unique-identifier="urn:uuid:#{@md.dgst[1]}" version="2.0"> @@ -1578,38 +1580,39 @@ WOK <dc:identifier id="bookid">urn:uuid:#{@md.dgst[1]}</dc:identifier> <!-- <dc:identifier id="EPB-UUID">urn:uuid:#{@md.dgst[1]}</dc:identifier> --> </metadata> -WOK + WOK end def manifest_open - <<WOK + <<-WOK <manifest> <!-- NCX --> <item id="ncx" href="#{Ep[:f_ncx]}" media-type="application/x-dtbncx+xml" /> <!-- CSS Style Sheets --> <item id="main-css" href="css/xhtml.css" media-type="text/css" /> <!-- Content Documents --> -WOK + WOK end def manifest_content_sisu_toc - <<WOK - <item id="index" href="index.xhtml" media-type="application/xhtml+xml" /> -WOK + <<-WOK + <item id="index#{Sfx[:epub_xhtml]}" href="index#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" /> + WOK end def manifest_cover_image_information(md) cover_image=if defined? md.make.cover_image \ and @md.make.cover_image.is_a?(Hash) \ and md.make.cover_image[:cover] =~/\S+/ - <<WOK + <<-WOK <item id="cover_image_file" href="cover_image#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" /> -WOK + WOK else '' end end - def manifest_content(dob,name=nil) - name=name ? name : dob.name - <<WOK - <item id="#{name}" href="#{name}#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" /> -WOK + def manifest_content(dob,fn_base,hashtag=nil) + fn=fn_base + Sfx[:epub_xhtml] + name=hashtag ? fn + hashtag : fn + <<-WOK + <item id="#{name}" href="#{name}" media-type="application/xhtml+xml" /> + WOK end def manifest_images(imgs) imgs=imgs + ['arrow_next_red.png','arrow_prev_red.png','arrow_up_red.png','bullet_09.png'] @@ -1617,71 +1620,75 @@ WOK imgs.each do |i| image,type=/(\S+?)\.(png|jpg|gif)/.match(i)[1,2] type=type.sub(/jpg/,'jpeg') - images<<<<WOK + images<<<<-WOK <item id="#{image}" href="image/#{image}.#{type}" media-type="image/#{type}" /> -WOK + WOK end images=images.join('') images end def manifest_close - <<WOK + <<-WOK </manifest> -WOK + WOK end def spine_open #spine: reading order of XHTML files from manifest, idref attribute refers back to id in manifest (exclude images, CSS etc.). - <<WOK + <<-WOK <spine toc="ncx"> -WOK + WOK end def spine_cover_image - <<WOK + <<-WOK <itemref idref="cover_image_file" /> -WOK + WOK end def spine_sisu_toc - <<WOK - <itemref idref="index" linear="yes" /> -WOK + <<-WOK + <itemref idref="index#{Sfx[:epub_xhtml]}" linear="yes" /> + WOK end - def spine(dob,name=nil) - name=name ? name : dob.name - <<WOK + def spine(dob,fn_base,hashtag=nil) + fn=fn_base + Sfx[:epub_xhtml] + name=hashtag ? fn + hashtag : fn + <<-WOK <itemref idref="#{name}" linear="yes" /> -WOK + WOK end def spine_close - <<WOK + <<-WOK </spine> -WOK + WOK end def guide_open #guide: presentation order of XHTML files by reader). - <<WOK + <<-WOK <guide> -WOK + WOK end def guide_cover_image - <<WOK + <<-WOK <reference type="cover" title="Cover of [book title]" href="cover_image#{Sfx[:epub_xhtml]}" /> -WOK + WOK end def guide_sisu_toc - <<WOK - <reference type="index" href="index#{Sfx[:epub_xhtml]}" /> -WOK + <<-WOK + <reference type="index#{Sfx[:epub_xhtml]}" href="index#{Sfx[:epub_xhtml]}" /> + WOK end - def guide(dob,name=nil) + def guide(dob,fn_base,hashtag=nil) + fn=fn_base + Sfx[:epub_xhtml] + name=hashtag ? fn + hashtag : fn name=name ? name : dob.name - <<WOK - <reference type="text" href="#{name}#{Sfx[:epub_xhtml]}" /> -WOK + guide_name=(name =~/#{Sfx[:epub_xhtml]}/) ? name : (name + Sfx[:epub_xhtml]) + <<-WOK + <reference type="text" href="#{guide_name}" /> + WOK end def guide_close - <<WOK + <<-WOK </guide> -WOK + WOK end self end diff --git a/lib/sisu/v4/epub_tune.rb b/lib/sisu/v4/epub_tune.rb index 85bf7a64..b64fd675 100644 --- a/lib/sisu/v4/epub_tune.rb +++ b/lib/sisu/v4/epub_tune.rb @@ -102,93 +102,6 @@ module SiSU_EPUB_Tune end str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;'). gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;'). - gsub(/\*/u,'*'). # * - gsub(/\+/u,'+'). # + - gsub(/¢/u,'¢'). # ¢ - gsub(/£/u,'£'). # £ - gsub(/¥/u,'¥'). # ¥ - gsub(/§/u,'§'). # § - gsub(/©/u,'©'). # © - gsub(/ª/u,'ª'). # ª - gsub(/«/u,'«'). # « - gsub(/®/u,'®'). # ® - gsub(/°/u,'°'). # ° - gsub(/±/u,'±'). # ± - gsub(/²/u,'²'). # ² - gsub(/³/u,'³'). # ³ - gsub(/µ/u,'µ'). # µ - gsub(/¶/u,'¶'). # ¶ - gsub(/¹/u,'¹'). # ¹ - gsub(/º/u,'º'). # º - gsub(/»/u,'»'). # » - gsub(/¼/u,'¼'). # ¼ - gsub(/½/u,'½'). # ½ - gsub(/¾/u,'¾'). # ¾ - gsub(/×/u,'×'). # × - gsub(/÷/u,'÷'). # ÷ - gsub(/¿/u,'¿'). # ¿ - gsub(/À/u,'À'). # À - gsub(/Á/u,'Á'). # Á - gsub(/Â/u,'Â'). # Â - gsub(/Ã/u,'Ã'). # Ã - gsub(/Ä/u,'Ä'). # Ä - gsub(/Å/u,'Å'). # Å - gsub(/Æ/u,'Æ'). # Æ - gsub(/Ç/u,'Ç'). # Ç - gsub(/È/u,'È'). # È - gsub(/É/u,'É'). # É - gsub(/Ê/u,'Ê'). # Ê - gsub(/Ë/u,'Ë'). # Ë - gsub(/Ì/u,'Ì'). # Ì - gsub(/Í/u,'Í'). # Í - gsub(/Î/u,'Î'). # Î - gsub(/Ï/u,'Ï'). # Ï - gsub(/Ð/u,'Ð'). # Ð - gsub(/Ñ/u,'Ñ'). # Ñ - gsub(/Ò/u,'Ò'). # Ò - gsub(/Ó/u,'Ó'). # Ó - gsub(/Ô/u,'Ô'). # Ô - gsub(/Õ/u,'Õ'). # Õ - gsub(/Ö/u,'Ö'). # Ö - gsub(/Ø/u,'Ø'). # Ø - gsub(/Ù/u,'Ù'). # Ù - gsub(/Ú/u,'Ú'). # Ú - gsub(/Û/u,'Û'). # Û - gsub(/Ü/u,'Ü'). # Ü - gsub(/Ý/u,'Ý'). # Ý - gsub(/Þ/u,'Þ'). # Þ - gsub(/ß/u,'ß'). # ß - gsub(/à/u,'à'). # à - gsub(/á/u,'á'). # á - gsub(/â/u,'â'). # â - gsub(/ã/u,'ã'). # ã - gsub(/ä/u,'ä'). # ä - gsub(/å/u,'å'). # å - gsub(/æ/u,'æ'). # æ - gsub(/ç/u,'ç'). # ç - gsub(/è/u,'è'). # è - gsub(/é/u,'é'). # é - gsub(/ê/u,'ê'). # ê - gsub(/ë/u,'ë'). # ë - gsub(/ì/u,'ì'). # ì - gsub(/í/u,'í'). # í - gsub(/î/u,'î'). # î - gsub(/ï/u,'ï'). # ï - gsub(/ð/u,'ð'). # ð - gsub(/ñ/u,'ñ'). # ñ - gsub(/ò/u,'ò'). # ò - gsub(/ó/u,'ó'). # ó - gsub(/ô/u,'ô'). # ô - gsub(/õ/u,'õ'). # õ - gsub(/ö/u,'ö'). # ö - gsub(/ø/u,'ø'). # ø - gsub(/ù/u,'ù'). # ú - gsub(/ú/u,'ú'). # û - gsub(/û/u,'û'). # ü - gsub(/ü/u,'ü'). # ý - gsub(/þ/u,'þ'). # þ - gsub(/ÿ/u,'ÿ'). # ÿ - gsub(/ý/u,'ý'). gsub(/<br>/u,'<br />'). gsub(/#{Mx[:nbsp]}/u,' ') end diff --git a/lib/sisu/v4/html_tune.rb b/lib/sisu/v4/html_tune.rb index 5196f046..92caec94 100644 --- a/lib/sisu/v4/html_tune.rb +++ b/lib/sisu/v4/html_tune.rb @@ -106,92 +106,7 @@ module SiSU_HTML_Tune else html.obj end str=str.gsub(/#{Mx[:gl_o]}(#[0-9]{3})#{Mx[:gl_c]}/u,'&\1;'). - gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;'). - gsub(/¢/u,'¢'). # ¢ - gsub(/£/u,'£'). # £ - gsub(/¥/u,'¥'). # ¥ - gsub(/§/u,'§'). # § - gsub(/©/u,'©'). # © - gsub(/ª/u,'ª'). # ª - gsub(/«/u,'«'). # « - gsub(/®/u,'®'). # ® - gsub(/°/u,'°'). # ° - gsub(/±/u,'±'). # ± - gsub(/²/u,'²'). # ² - gsub(/³/u,'³'). # ³ - gsub(/µ/u,'µ'). # µ - gsub(/¶/u,'¶'). # ¶ - gsub(/¹/u,'¹'). # ¹ - gsub(/º/u,'º'). # º - gsub(/»/u,'»'). # » - gsub(/¼/u,'¼'). # ¼ - gsub(/½/u,'½'). # ½ - gsub(/¾/u,'¾'). # ¾ - gsub(/×/u,'×'). # × - gsub(/÷/u,'÷'). # ÷ - gsub(/¿/u,'¿'). # ¿ - gsub(/À/u,'À'). # À - gsub(/Á/u,'Á'). # Á - gsub(/Â/u,'Â'). # Â - gsub(/Ã/u,'Ã'). # Ã - gsub(/Ä/u,'Ä'). # Ä - gsub(/Å/u,'Å'). # Å - gsub(/Æ/u,'Æ'). # Æ - gsub(/Ç/u,'Ç'). # Ç - gsub(/È/u,'È'). # È - gsub(/É/u,'É'). # É - gsub(/Ê/u,'Ê'). # Ê - gsub(/Ë/u,'Ë'). # Ë - gsub(/Ì/u,'Ì'). # Ì - gsub(/Í/u,'Í'). # Í - gsub(/Î/u,'Î'). # Î - gsub(/Ï/u,'Ï'). # Ï - gsub(/Ð/u,'Ð'). # Ð - gsub(/Ñ/u,'Ñ'). # Ñ - gsub(/Ò/u,'Ò'). # Ò - gsub(/Ó/u,'Ó'). # Ó - gsub(/Ô/u,'Ô'). # Ô - gsub(/Õ/u,'Õ'). # Õ - gsub(/Ö/u,'Ö'). # Ö - gsub(/Ø/u,'Ø'). # Ø - gsub(/Ù/u,'Ù'). # Ù - gsub(/Ú/u,'Ú'). # Ú - gsub(/Û/u,'Û'). # Û - gsub(/Ü/u,'Ü'). # Ü - gsub(/Ý/u,'Ý'). # Ý - gsub(/Þ/u,'Þ'). # Þ - gsub(/ß/u,'ß'). # ß - gsub(/à/u,'à'). # à - gsub(/á/u,'á'). # á - gsub(/â/u,'â'). # â - gsub(/ã/u,'ã'). # ã - gsub(/ä/u,'ä'). # ä - gsub(/å/u,'å'). # å - gsub(/æ/u,'æ'). # æ - gsub(/ç/u,'ç'). # ç - gsub(/è/u,'è'). # è - gsub(/é/u,'é'). # é - gsub(/ê/u,'ê'). # ê - gsub(/ë/u,'ë'). # ë - gsub(/ì/u,'ì'). # ì - gsub(/í/u,'í'). # í - gsub(/î/u,'î'). # î - gsub(/ï/u,'ï'). # ï - gsub(/ð/u,'ð'). # ð - gsub(/ñ/u,'ñ'). # ñ - gsub(/ò/u,'ò'). # ò - gsub(/ó/u,'ó'). # ó - gsub(/ô/u,'ô'). # ô - gsub(/õ/u,'õ'). # õ - gsub(/ö/u,'ö'). # ö - gsub(/ø/u,'ø'). # ø - gsub(/ù/u,'ù'). # ú - gsub(/ú/u,'ú'). # û - gsub(/û/u,'û'). # ü - gsub(/ü/u,'ü'). # ý - gsub(/þ/u,'þ'). # þ - gsub(/ÿ/u,'ÿ'). # ÿ - gsub(/ý/u,'ý') + gsub(/#{Mx[:gl_o]}#([a-z]{2,4})#{Mx[:gl_c]}/u,'&\1;') end end class Tune diff --git a/lib/sisu/v4/param.rb b/lib/sisu/v4/param.rb index 916d89c1..bcbf9ce3 100644 --- a/lib/sisu/v4/param.rb +++ b/lib/sisu/v4/param.rb @@ -968,7 +968,7 @@ module SiSU_Param sm_a,sm_b,sm_c=fns_array[0].match(/^(?:%\s+)?(?:SiSU\s+(?:master\s+)?|sisu-)([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?$/)[1..3] sm_c ||=0 sv=(@opt.cmd =~/[VMv]/) ? ("SiSU version (#{@sisu_version[:version]})") : '' - s_a,s_b,s_c=@sisu_version[:version].match(/^([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?(?:\-\S+)?$/)[1..3] + s_a,s_b,s_c=@sisu_version[:version].match(/^([0-9]+)?(?:\.([0-9]+))?(?:\.([0-9]+))?(?:[~-]\S+)?$/)[1..3] tell=(@markup_version_declared.to_f==@markup_version.determined) \ ? SiSU_Screen::Ansi.new(@opt.cmd,"Markup version (#{@markup_version.series} version #{@markup_version.determined})",sv) : SiSU_Screen::Ansi.new(@opt.cmd,"Markup version declared (#{@markup_version_declared}), determined (#{@markup_version.series} version #{@markup_version.determined})",sv) diff --git a/lib/sisu/v4/sysenv.rb b/lib/sisu/v4/sysenv.rb index f54b3f26..2b36a222 100644 --- a/lib/sisu/v4/sysenv.rb +++ b/lib/sisu/v4/sysenv.rb @@ -1066,6 +1066,9 @@ module SiSU_Env pt.split[-1].to_s elsif output_dir_structure.by_filename? '' + else + puts SiSU_Debug::Mark.new(__LINE__,__FILE__).set(:fuschia) + puts 'set output type, by: language, filetype or filename' end @stub_set_manifest=stub + '/manifest' end diff --git a/lib/sisu/v4/texpdf_format.rb b/lib/sisu/v4/texpdf_format.rb index fb569fca..e1dbcb18 100644 --- a/lib/sisu/v4/texpdf_format.rb +++ b/lib/sisu/v4/texpdf_format.rb @@ -1571,3 +1571,78 @@ WOK end end __END__ +#ack usepackage texpdf* +#ack usepackage texpdf* |ack '\{.+?\}' +#see sisu_texpdf_usepackage.rb + alltt.sty + amssymb.sty + babel.sty + boites.sty + color.sty + endnotes.sty + fancyhdr.sty + fontspec.sty + footmisc.sty + graphicx.sty + inputenc.sty + listings.sty + longtable.sty + manyfoot.sty + multicol.sty + parskip.sty + polyglossia.sty + soul.sty + textcomp.sty + thumbpdf.sty + titlepic.sty + ucs.sty + ulem.sty + url.sty + xetex.sty + xltxtra.sty + xunicode.sty +--- +texlive-latex-base +texlive-base +texlive-latex-extra +texlive-latex-recommended +texlive-xetex +texlive-generic-recommended +--- +texlive-latex-base: + /usr/share/texlive/texmf-dist/tex/generic/babel/babel.sty + /usr/share/texlive/texmf-dist/tex/latex/base/alltt.sty + /usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty + /usr/share/texlive/texmf-dist/tex/latex/base/textcomp.sty + /usr/share/texlive/texmf-dist/tex/latex/fancyhdr/fancyhdr.sty + /usr/share/texlive/texmf-dist/tex/latex/graphics/color.sty + /usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty + /usr/share/texlive/texmf-dist/tex/latex/tools/longtable.sty + /usr/share/texlive/texmf-dist/tex/latex/tools/multicol.sty +--- +texlive-base: + /usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty +--- +texlive-latex-extra: + /usr/share/texlive/texmf-dist/tex/latex/boites/boites.sty + /usr/share/texlive/texmf-dist/tex/latex/endnotes/endnotes.sty + /usr/share/texlive/texmf-dist/tex/latex/footmisc/footmisc.sty + /usr/share/texlive/texmf-dist/tex/latex/ncctools/manyfoot.sty + /usr/share/texlive/texmf-dist/tex/latex/soul/soul.sty + /usr/share/texlive/texmf-dist/tex/latex/titlepic/titlepic.sty + /usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty +--- +texlive-latex-recommended: + /usr/share/texlive/texmf-dist/tex/generic/thumbpdf/thumbpdf.sty + /usr/share/texlive/texmf-dist/tex/latex/fontspec/fontspec.sty + /usr/share/texlive/texmf-dist/tex/latex/listings/listings.sty + /usr/share/texlive/texmf-dist/tex/latex/parskip/parskip.sty + /usr/share/texlive/texmf-dist/tex/latex/url/url.sty +--- +texlive-xetex: + /usr/share/texlive/texmf-dist/tex/latex/xltxtra/xltxtra.sty + /usr/share/texlive/texmf-dist/tex/xelatex/polyglossia/polyglossia.sty + /usr/share/texlive/texmf-dist/tex/xelatex/xunicode/xunicode.sty +--- +texlive-generic-recommended: + /usr/share/texlive/texmf-dist/tex/generic/ulem/ulem.sty |