Class: SiSU_XHTML_EPUB2_Format::HeadInformation
- Inherits:
-
Object
- Object
- SiSU_XHTML_EPUB2_Format::HeadInformation
- Defined in:
- lib/sisu/xhtml_epub2_format.rb
Instance Attribute Summary collapse
-
#md ⇒ Object
readonly
Returns the value of attribute md.
-
#rdf ⇒ Object
readonly
Returns the value of attribute rdf.
Instance Method Summary collapse
- #close ⇒ Object
- #doc_author ⇒ Object
- #doc_title ⇒ Object
-
#doc_type ⇒ Object
~/epub |– META-INF | ‘– container.xml # simple, make sure full-path of rootfile points to metadata.opf |– content | |– 1.xhtml | |– 2.xhtml | |– 3.xhtml | |– …
- #doc_type_xhtml ⇒ Object
- #guide(dob, fn_base, hashtag = nil) ⇒ Object
- #guide_close ⇒ Object
- #guide_cover_image ⇒ Object
- #guide_open ⇒ Object
- #guide_sisu_toc ⇒ Object
- #head ⇒ Object
- #head_close ⇒ Object
- #head_open ⇒ Object
-
#initialize(md) ⇒ HeadInformation
constructor
A new instance of HeadInformation.
- #manifest_close ⇒ Object
- #manifest_content(dob, fn_base, hashtag = nil) ⇒ Object
- #manifest_content_sisu_toc ⇒ Object
- #manifest_cover_image_information(md) ⇒ Object
- #manifest_images(imgs) ⇒ Object
- #manifest_open ⇒ Object
-
#metadata ⇒ Object
metadata dc.
-
#metadata_opf ⇒ Object
(i) metadata dc; (ii) manifest (contents); (iii) spine (mimetypes).
-
#metainf_container ⇒ Object
container.xml file in META-INF directory.
- #mimetype ⇒ Object
- #navmap_close ⇒ Object
- #navmap_open ⇒ Object
- #navmap_sisu_toc(no) ⇒ Object
- #navpoint(dob, no, fn_base, hashtag = nil) ⇒ Object
- #navpoint_close ⇒ Object
- #open ⇒ Object
- #package_close ⇒ Object
- #package_open ⇒ Object
- #sections(dob, fn_base) ⇒ Object
- #spine(dob, fn_base, hashtag = nil) ⇒ Object
- #spine_close ⇒ Object
- #spine_cover_image ⇒ Object
- #spine_open ⇒ Object
- #spine_sisu_toc ⇒ Object
- #structure ⇒ Object
- #table_close ⇒ Object
-
#toc_ncx ⇒ Object
list of navigation points (like chapters), table of contents, listing each navigation point (chapters and such) under the navigation map.
- #xhtml_close ⇒ Object
Constructor Details
#initialize(md) ⇒ HeadInformation
Returns a new instance of HeadInformation.
1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1250 def initialize(md) @md=md # DublinCore 1 - title @css=SiSU_Env::CSS_Stylesheet.new(md) @per=SiSU_XHTML_EPUB2_Persist::Persist.new @per.seg_name_x=SiSU_XHTML_EPUB2::Seg.new.seg_name_x @per.seg_name_x_tracker=SiSU_XHTML_EPUB2::Seg.new.seg_name_x_tracker @tocband_scroll,@tocband_segtoc=nil,nil @index,@metalink='index','#metadata' end |
Instance Attribute Details
#md ⇒ Object (readonly)
Returns the value of attribute md.
1249 1250 1251 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1249 def md @md end |
#rdf ⇒ Object (readonly)
Returns the value of attribute rdf.
1249 1250 1251 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1249 def rdf @rdf end |
Instance Method Details
#close ⇒ Object
1361 1362 1363 1364 1365 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1361 def close <<-WOK </ncx> WOK end |
#doc_author ⇒ Object
1401 1402 1403 1404 1405 1406 1407 1408 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1401 def txt=SanitizeXML.xml(@md.) <<-WOK <docAuthor> <text>#{txt}</text> </docAuthor> WOK end |
#doc_title ⇒ Object
1393 1394 1395 1396 1397 1398 1399 1400 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1393 def doc_title txt=SanitizeXML.xml(@md.title.full) <<-WOK <docTitle> <text>#{txt}</text> </docTitle> WOK end |
#doc_type ⇒ Object
~/epub
|-- META-INF
| `-- container.xml # simple, make sure full-path of rootfile points to metadata.opf
|-- content
| |-- 1.xhtml
| |-- 2.xhtml
| |-- 3.xhtml
| |-- ... .xhtml
| |-- concordance.xhtml
| |-- css
| | `-- xhtml.css
| |-- endnotes.xhtml
| |-- image
| | |-- arrow_next_red.png
| | |-- arrow_prev_red.png
| | |-- arrow_up_red.png
| | `-- bullet_09.png
| |-- index.xhtml
| |-- meta.xhtml
| |-- 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)
1292 1293 1294 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1292 def doc_type doc_type_xhtml end |
#doc_type_xhtml ⇒ Object
1260 1261 1262 1263 1264 1265 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1260 def doc_type_xhtml <<-WOK <?xml version='1.0' encoding='utf-8'?> <html xmlns="http://www.w3.org/1999/xhtml"> WOK end |
#guide(dob, fn_base, hashtag = nil) ⇒ Object
1703 1704 1705 1706 1707 1708 1709 1710 1711 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1703 def guide(dob,fn_base,hashtag=nil) fn=fn_base + Sfx[:epub_xhtml] name=hashtag ? fn + hashtag : fn name=name ? name : dob.name guide_name=(name =~/#{Sfx[:epub_xhtml]}/) ? name : (name + Sfx[:epub_xhtml]) <<-WOK <reference type="text" href="#{guide_name}" /> WOK end |
#guide_close ⇒ Object
1712 1713 1714 1715 1716 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1712 def guide_close <<-WOK </guide> WOK end |
#guide_cover_image ⇒ Object
1693 1694 1695 1696 1697 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1693 def guide_cover_image <<-WOK <reference type="cover" title="Cover of #{SanitizeXML.xml(@md.title.full)}" href="cover_image#{Sfx[:epub_xhtml]}" /> WOK end |
#guide_open ⇒ Object
1687 1688 1689 1690 1691 1692 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1687 def guide_open #guide: presentation order of XHTML files by reader). <<-WOK <guide> WOK end |
#guide_sisu_toc ⇒ Object
1698 1699 1700 1701 1702 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1698 def guide_sisu_toc <<-WOK <reference type="index#{Sfx[:epub_xhtml]}" href="index#{Sfx[:epub_xhtml]}" /> WOK end |
#head ⇒ Object
1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1371 def head depth=@md.lvs[1] + @md.lvs[2] + @md.lvs[3] + @md.lvs[4] title=SanitizeXML.xml(@md.title.full) =SanitizeXML.xml(@md.) dgst=(@md.dgst.is_a?(Array) and @md.dgst.length > 1) ? @md.dgst[1] : 'na' <<-WOK <!-- four required metadata items (for all NCX documents, (including the relaxed constraints of OPS 2.0) --> <title>#{title} by #{}</title> <link href="css/xhtml.css" rel="stylesheet" type="text/css" id="main-css" /> <meta name="dtb:uid" content="urn:uuid:#{dgst}" /> <!-- <meta name="epub-creator" content="#{@md.publisher}" /> --> <meta name="dtb:depth" content="#{depth}" /> <meta name="dtb:totalPageCount" content="0" /> <meta name="dtb:maxPageNumber" content="0" /> WOK end |
#head_close ⇒ Object
1388 1389 1390 1391 1392 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1388 def head_close <<-WOK </head> WOK end |
#head_open ⇒ Object
1366 1367 1368 1369 1370 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1366 def head_open <<-WOK <head> WOK end |
#manifest_close ⇒ Object
1654 1655 1656 1657 1658 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1654 def manifest_close <<-WOK </manifest> WOK end |
#manifest_content(dob, fn_base, hashtag = nil) ⇒ Object
1634 1635 1636 1637 1638 1639 1640 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1634 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 |
#manifest_content_sisu_toc ⇒ Object
1619 1620 1621 1622 1623 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1619 def manifest_content_sisu_toc <<-WOK <item id="index#{Sfx[:epub_xhtml]}" href="index#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" /> WOK end |
#manifest_cover_image_information(md) ⇒ Object
1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1624 def manifest_cover_image_information(md) if defined? md.make.cover_image \ and @md.make.cover_image.is_a?(Hash) \ and md.make.cover_image[:cover] =~/\S+/ <<-WOK <item id="cover_image#{Sfx[:epub_xhtml]}" href="cover_image#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" /> WOK else '' end end |
#manifest_images(imgs) ⇒ Object
1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1641 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] type=type.sub(/jpg/,'jpeg') images<<<<-WOK <item id="#{image}" href="image/#{image}.#{type}" media-type="image/#{type}" /> WOK end images=images.join('') images end |
#manifest_open ⇒ Object
1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1609 def manifest_open <<-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 end |
#metadata ⇒ Object
metadata dc
1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1478 def #metadata dc cover_image=if defined? @md.make.cover_image \ and @md.make.cover_image.is_a?(Hash) \ and @md.make.cover_image[:cover] =~/\S+/ %{\n <#{$ep[:o]}meta name="cover" content="cover_image" />} else '' end =if defined? @md.creator. \ and @md.creator. =~/\S+/ m='' @md.creator..each do |i| surname=i[:the] \ ? i[:the] : '' other_names=i[:others] \ ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m=SanitizeXML.xml(m) end x=@md.creator..dup x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="aut">#{x}</dc:creator>} else '' end editor=if defined? @md.creator.editor \ and @md.creator.editor =~/\S+/ m='' @md.creator.editor_detail.each do |i| surname=i[:the] \ ? i[:the] : '' other_names=i[:others] \ ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m=SanitizeXML.xml(m) end x=@md.creator.editor.dup x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="edt">#{x}</dc:creator>} else '' end translator=if defined? @md.creator.translator \ and @md.creator.translator =~/\S+/ m='' @md.creator.translator_detail.each do |i| surname=i[:the] \ ? i[:the] : '' other_names=i[:others] \ ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m=SanitizeXML.xml(m) end x=@md.creator.translator.dup x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="trl">#{x}</dc:creator>} else '' end illustrator=if defined? @md.creator.illustrator \ and @md.creator.illustrator =~/\S+/ m='' @md.creator.illustrator_detail.each do |i| surname=i[:the] \ ? i[:the] : '' other_names=i[:others] \ ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m=SanitizeXML.xml(m) end x=@md.creator.illustrator.dup x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="ill">#{x}</dc:creator>} else '' end date_published=if defined? @md.date.published \ and @md.date.published =~/\S+/ x=@md.date.published.dup x=SanitizeXML.xml(x) %{\n <dc:date opf:event="published">#{x}</dc:date>} else '' end subject=if defined? @md.classify.subject \ and @md.classify.subject =~/\S+/ x=@md.classify.subject.dup x=SanitizeXML.xml(x) %{\n <dc:subject>#{x}</dc:subject>} else '' end language=if defined? @md.opt.lng \ and @md.opt.lng =~/\S+/ language=@md.opt.lng.gsub(/<br>/,'<br />') %{\n <dc:language>#{language}</dc:language>} else '' end rights=if defined? @md.rights.all \ and @md.rights.all =~/\S+/ rights=SanitizeXML.xml(@md.rights.all) rights=rights.gsub(/<br\s*\/?>/,' ') %{\n <dc:rights>#{rights}</dc:rights>} else '' end f=SiSU_Env::FileOp.new(@md) dgst=(@md.dgst.is_a?(Array) and @md.dgst.length > 1) ? @md.dgst[1] : 'na' <<-WOK <#{$ep[:o]}metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:opf="http://www.idpf.org/2007/opf" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dc="http://purl.org/dc/elements/1.1/" unique-identifier="urn:uuid:#{dgst}" version="2.0"> <dc:title>#{@md.title.full}</dc:title> #{cover_image}#{}#{editor}#{translator}#{illustrator}#{language}#{date_published}#{subject}#{rights} <dc:identifier opf:scheme="URI">#{f.output_path.epub.url.gsub(/http:\/\//,'')}/#{f.base_filename.epub}</dc:identifier> <dc:identifier id="bookid">urn:uuid:#{dgst}</dc:identifier> <!-- <dc:identifier id="EPB-UUID">urn:uuid:#{dgst}</dc:identifier> --> </#{$ep[:o]}metadata> WOK end |
#metadata_opf ⇒ Object
(i) metadata dc; (ii) manifest (contents); (iii) spine (mimetypes)
1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1454 def #(i) metadata dc; (ii) manifest (contents); (iii) spine (mimetypes) def structure package_open manifest_open manifest_close spine_open spine_close guide_open guide_close package_close end def package_open <<-WOK <?xml version='1.0' encoding='utf-8'?> <package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="EPB-UUID"> WOK end def package_close <<-WOK </package> WOK end def #metadata dc cover_image=if defined? @md.make.cover_image \ and @md.make.cover_image.is_a?(Hash) \ and @md.make.cover_image[:cover] =~/\S+/ %{\n <#{$ep[:o]}meta name="cover" content="cover_image" />} else '' end =if defined? @md.creator. \ and @md.creator. =~/\S+/ m='' @md.creator..each do |i| surname=i[:the] \ ? i[:the] : '' other_names=i[:others] \ ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m=SanitizeXML.xml(m) end x=@md.creator..dup x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="aut">#{x}</dc:creator>} else '' end editor=if defined? @md.creator.editor \ and @md.creator.editor =~/\S+/ m='' @md.creator.editor_detail.each do |i| surname=i[:the] \ ? i[:the] : '' other_names=i[:others] \ ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m=SanitizeXML.xml(m) end x=@md.creator.editor.dup x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="edt">#{x}</dc:creator>} else '' end translator=if defined? @md.creator.translator \ and @md.creator.translator =~/\S+/ m='' @md.creator.translator_detail.each do |i| surname=i[:the] \ ? i[:the] : '' other_names=i[:others] \ ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m=SanitizeXML.xml(m) end x=@md.creator.translator.dup x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="trl">#{x}</dc:creator>} else '' end illustrator=if defined? @md.creator.illustrator \ and @md.creator.illustrator =~/\S+/ m='' @md.creator.illustrator_detail.each do |i| surname=i[:the] \ ? i[:the] : '' other_names=i[:others] \ ? ', ' + i[:others] : '' m=(m.empty?) \ ? (surname + other_names) : (m + '; ' + surname + ', ' + other_names) m=SanitizeXML.xml(m) end x=@md.creator.illustrator.dup x=SanitizeXML.xml(x) %{\n <dc:creator opf:file-as="#{m}" opf:role="ill">#{x}</dc:creator>} else '' end date_published=if defined? @md.date.published \ and @md.date.published =~/\S+/ x=@md.date.published.dup x=SanitizeXML.xml(x) %{\n <dc:date opf:event="published">#{x}</dc:date>} else '' end subject=if defined? @md.classify.subject \ and @md.classify.subject =~/\S+/ x=@md.classify.subject.dup x=SanitizeXML.xml(x) %{\n <dc:subject>#{x}</dc:subject>} else '' end language=if defined? @md.opt.lng \ and @md.opt.lng =~/\S+/ language=@md.opt.lng.gsub(/<br>/,'<br />') %{\n <dc:language>#{language}</dc:language>} else '' end rights=if defined? @md.rights.all \ and @md.rights.all =~/\S+/ rights=SanitizeXML.xml(@md.rights.all) rights=rights.gsub(/<br\s*\/?>/,' ') %{\n <dc:rights>#{rights}</dc:rights>} else '' end f=SiSU_Env::FileOp.new(@md) dgst=(@md.dgst.is_a?(Array) and @md.dgst.length > 1) ? @md.dgst[1] : 'na' <<-WOK <#{$ep[:o]}metadata xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:opf="http://www.idpf.org/2007/opf" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dc="http://purl.org/dc/elements/1.1/" unique-identifier="urn:uuid:#{dgst}" version="2.0"> <dc:title>#{@md.title.full}</dc:title> #{cover_image}#{}#{editor}#{translator}#{illustrator}#{language}#{date_published}#{subject}#{rights} <dc:identifier opf:scheme="URI">#{f.output_path.epub.url.gsub(/http:\/\//,'')}/#{f.base_filename.epub}</dc:identifier> <dc:identifier id="bookid">urn:uuid:#{dgst}</dc:identifier> <!-- <dc:identifier id="EPB-UUID">urn:uuid:#{dgst}</dc:identifier> --> </#{$ep[:o]}metadata> WOK end def manifest_open <<-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 end def manifest_content_sisu_toc <<-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) if defined? md.make.cover_image \ and @md.make.cover_image.is_a?(Hash) \ and md.make.cover_image[:cover] =~/\S+/ <<-WOK <item id="cover_image#{Sfx[:epub_xhtml]}" href="cover_image#{Sfx[:epub_xhtml]}" media-type="application/xhtml+xml" /> WOK else '' end end 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'] images=[" <!-- Images -->\n"] imgs.each do |i| image,type=/(\S+?)\.(png|jpg|gif)/.match(i)[1,2] type=type.sub(/jpg/,'jpeg') images<<<<-WOK <item id="#{image}" href="image/#{image}.#{type}" media-type="image/#{type}" /> WOK end images=images.join('') images end def manifest_close <<-WOK </manifest> 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 <spine toc="ncx"> WOK end def spine_cover_image <<-WOK <itemref idref="cover_image#{Sfx[:epub_xhtml]}" /> WOK end def spine_sisu_toc <<-WOK <itemref idref="index#{Sfx[:epub_xhtml]}" linear="yes" /> WOK end 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 end def spine_close <<-WOK </spine> WOK end def guide_open #guide: presentation order of XHTML files by reader). <<-WOK <guide> WOK end def guide_cover_image <<-WOK <reference type="cover" title="Cover of #{SanitizeXML.xml(@md.title.full)}" href="cover_image#{Sfx[:epub_xhtml]}" /> WOK end def guide_sisu_toc <<-WOK <reference type="index#{Sfx[:epub_xhtml]}" href="index#{Sfx[:epub_xhtml]}" /> WOK end def guide(dob,fn_base,hashtag=nil) fn=fn_base + Sfx[:epub_xhtml] name=hashtag ? fn + hashtag : fn name=name ? name : dob.name guide_name=(name =~/#{Sfx[:epub_xhtml]}/) ? name : (name + Sfx[:epub_xhtml]) <<-WOK <reference type="text" href="#{guide_name}" /> WOK end def guide_close <<-WOK </guide> WOK end self end |
#metainf_container ⇒ Object
container.xml file in META-INF directory
1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1300 def #container.xml file in META-INF directory #simple, make sure full-path of rootfile points to metadata.opf #epub_metadata.opf content.opf <<-WOK <?xml version='1.0' encoding='utf-8'?> <container version="1.0" xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> <rootfiles> <rootfile full-path="#{Ep[:d_oebps]}/#{Ep[:f_opf]}" media-type="application/oebps-package+xml" /> </rootfiles> </container> WOK end |
#mimetype ⇒ Object
1295 1296 1297 1298 1299 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1295 def mimetype <<-WOK application/epub+zip WOK end |
#navmap_close ⇒ Object
1447 1448 1449 1450 1451 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1447 def navmap_close <<-WOK </navMap> WOK end |
#navmap_open ⇒ Object
1409 1410 1411 1412 1413 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1409 def navmap_open <<-WOK <navMap> WOK end |
#navmap_sisu_toc(no) ⇒ Object
1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1414 def navmap_sisu_toc(no) id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ ? '' : "-#{no}" <<-WOK <navPoint id="navpoint#{id_u}" playOrder="#{no}"> <navLabel> <text>Table of Contents</text> </navLabel> <content src="index#{Sfx[:epub_xhtml]}" /> </navPoint> WOK end |
#navpoint(dob, no, fn_base, hashtag = nil) ⇒ Object
1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1427 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}" 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>#{txt}</text> </navLabel> <content src="#{name}" /> WOK end |
#navpoint_close ⇒ Object
1442 1443 1444 1445 1446 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1442 def navpoint_close <<-WOK </navPoint> WOK end |
#open ⇒ Object
1355 1356 1357 1358 1359 1360 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1355 def open <<-WOK <?xml version='1.0' encoding='utf-8'?> <ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1"> WOK end |
#package_close ⇒ Object
1473 1474 1475 1476 1477 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1473 def package_close <<-WOK </package> WOK end |
#package_open ⇒ Object
1467 1468 1469 1470 1471 1472 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1467 def package_open <<-WOK <?xml version='1.0' encoding='utf-8'?> <package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="EPB-UUID"> WOK end |
#sections(dob, fn_base) ⇒ Object
1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1314 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') 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} <head> <title> #{dob.obj} - #{@md.html_title} </title> <meta http-equiv='Content-Type' content='text/html; charset=utf-8' /> #{@css.xhtml_epub} </head> <body lang="#{@md.opt.lng}"> <div class="content"> <div class="substance"> <label class="ocn"><a href="#o#{dob.ocn}" class="lnkocn">#{dob.ocn}</a></label> <h1 class="norm" id="o#{dob.ocn}"> #{txt} </h1> </div> </div> </body> </html>} output_epub_cont_seg.close end |
#spine(dob, fn_base, hashtag = nil) ⇒ Object
1675 1676 1677 1678 1679 1680 1681 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1675 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 end |
#spine_close ⇒ Object
1682 1683 1684 1685 1686 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1682 def spine_close <<-WOK </spine> WOK end |
#spine_cover_image ⇒ Object
1665 1666 1667 1668 1669 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1665 def spine_cover_image <<-WOK <itemref idref="cover_image#{Sfx[:epub_xhtml]}" /> WOK end |
#spine_open ⇒ Object
1659 1660 1661 1662 1663 1664 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1659 def spine_open #spine: reading order of XHTML files from manifest, idref attribute refers back to id in manifest (exclude images, CSS etc.). <<-WOK <spine toc="ncx"> WOK end |
#spine_sisu_toc ⇒ Object
1670 1671 1672 1673 1674 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1670 def spine_sisu_toc <<-WOK <itemref idref="index#{Sfx[:epub_xhtml]}" linear="yes" /> WOK end |
#structure ⇒ Object
1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1343 def structure open head_open head head_close doc_title navmap_open #navmap ... navmap_close close end |
#table_close ⇒ Object
1719 1720 1721 1722 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1719 def table_close %{ </font> #{the_table_close}} end |
#toc_ncx ⇒ Object
list of navigation points (like chapters), table of contents, listing each navigation point (chapters and such) under the navigation map
1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1342 def toc_ncx #list of navigation points (like chapters), table of contents, listing each navigation point (chapters and such) under the navigation map def structure open head_open head head_close doc_title navmap_open #navmap ... navmap_close close end def open <<-WOK <?xml version='1.0' encoding='utf-8'?> <ncx xmlns="http://www.daisy.org/z3986/2005/ncx/" version="2005-1"> WOK end def close <<-WOK </ncx> WOK end def head_open <<-WOK <head> WOK end def head depth=@md.lvs[1] + @md.lvs[2] + @md.lvs[3] + @md.lvs[4] title=SanitizeXML.xml(@md.title.full) =SanitizeXML.xml(@md.) dgst=(@md.dgst.is_a?(Array) and @md.dgst.length > 1) ? @md.dgst[1] : 'na' <<-WOK <!-- four required metadata items (for all NCX documents, (including the relaxed constraints of OPS 2.0) --> <title>#{title} by #{}</title> <link href="css/xhtml.css" rel="stylesheet" type="text/css" id="main-css" /> <meta name="dtb:uid" content="urn:uuid:#{dgst}" /> <!-- <meta name="epub-creator" content="#{@md.publisher}" /> --> <meta name="dtb:depth" content="#{depth}" /> <meta name="dtb:totalPageCount" content="0" /> <meta name="dtb:maxPageNumber" content="0" /> WOK end def head_close <<-WOK </head> WOK end def doc_title txt=SanitizeXML.xml(@md.title.full) <<-WOK <docTitle> <text>#{txt}</text> </docTitle> WOK end def txt=SanitizeXML.xml(@md.) <<-WOK <docAuthor> <text>#{txt}</text> </docAuthor> WOK end def navmap_open <<-WOK <navMap> WOK end def navmap_sisu_toc(no) id_u=DISABLE[:epub][:ncx_navpoint_unique_id] \ ? '' : "-#{no}" <<-WOK <navPoint id="navpoint#{id_u}" playOrder="#{no}"> <navLabel> <text>Table of Contents</text> </navLabel> <content src="index#{Sfx[:epub_xhtml]}" /> </navPoint> WOK end 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}" 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>#{txt}</text> </navLabel> <content src="#{name}" /> WOK end def navpoint_close <<-WOK </navPoint> WOK end def navmap_close <<-WOK </navMap> WOK end self end |
#xhtml_close ⇒ Object
1723 1724 1725 1726 1727 |
# File 'lib/sisu/xhtml_epub2_format.rb', line 1723 def xhtml_close %{#{SiSU_Proj_XHTML::Bits.new.credits_sisu_epub} </body> </html>} end |