ref: 9b5b3b2ceb13f4d89041c21d7c645ed3b8b5081b
parent: 069cd7b7ff6a865a25074245fb200fb924edfdf0
author: sirjofri <[email protected]>
date: Thu Sep 9 02:39:24 EDT 2021
adds proper sample, mkfile. needs more fine tuning.
--- a/README
+++ b/README
@@ -3,3 +3,6 @@
* generating epub files
* generating troff files
* same source
+
+See the `sample` directory for an example. For testing, you might
+want to bind . to /bin.
--- /dev/null
+++ b/mkfile
@@ -1,0 +1,25 @@
+ebook:V: $ebook
+ echo built $ebook
+
+ms:V: $ms
+ echo built $ms
+
+$ebook:V: $textsource $ebooksource
+ rfork
+ ramfs
+ for (f in $textsource/*){
+ fname=`{basename $f | sed 's/\.[a-zA-Z0-9]*$//g'}
+ txt2ebook $EBOOKARGS <$f >/tmp/$fname.xhtml
+ }
+ bind -a $ebooksource /tmp
+ @{cd /tmp && zip .} >$target
+
+$ms:V: $textsource $mssource
+ rfork
+ ramfs
+ for (f in $textsource/*){
+ fname=`{basename $f}
+ txt2ms $MSARGS <$f >/tmp/$fname.ms
+ }
+ bind -a $mssource /tmp
+ cat /tmp/* >$target
--- /dev/null
+++ b/sample/ebooksrc/META-INF/container.xml
@@ -1,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<container
+ xmlns="urn:oasis:names:tc:opendocument:xmlns:container"
+ version="1.0">
+ <rootfiles>
+ <rootfile
+ full-path="content.opf"
+ media-type="application/oebps-package+xml"/>
+ </rootfiles>
+</container>
\ No newline at end of file
--- /dev/null
+++ b/sample/ebooksrc/content.ncx
@@ -1,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ncx
+ xmlns="http://www.daisy.org/z3986/2005/ncx/"
+ version="2005-1"
+ xml:lang="en">
+ <head>
+ <meta name="dtb:uid" content="abc"/>
+ </head>
+ <docTitle>
+ <text>Sample Document</text>
+ </docTitle>
+ <docAuthor>
+ <text>sirjofri</text>
+ </docAuthor>
+ <navMap>
+ <navPoint playOrder="1" id="id1">
+ <navLabel>
+ <text>Chapter 1</text>
+ </navLabel>
+ <content src="chap1.xhtml"/>
+ </navPoint>
+ <navPoint playOrder="2" id="id2">
+ <navLabel>
+ <text>Chapter 2</text>
+ </navLabel>
+ <content src="chap2.xhtml"/>
+ </navPoint>
+ </navMap>
+</ncx>
--- /dev/null
+++ b/sample/ebooksrc/content.opf
@@ -1,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package version="3.0"
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:opf="http://www.idpf.org/2007/opf"
+ xmlns="http://www.idpf.org/2007/opf"
+ unique-identifier="Id">
+ <metadata>
+ <dc:identifier id="Id">abc</dc:identifier>
+ <meta property="dcterms:modified">2021-08-27T10:00:00Z</meta>
+ <dc:language>en</dc:language>
+ <dc:title xml:lang="en">Hello World</dc:title>
+ <dc:description xml:lang="en">Bla</dc:description>
+ <dc:creator id="sirjofri" xml:lang="en">sirjofri</dc:creator>
+ </metadata>
+ <manifest>
+ <item id="ncx" href="content.ncx" media-type="application/x-dtbncx+xml"/>
+ <item id="nav" href="nav.xhtml" media-type="application/xhtml+xml" properties="nav"/>
+ <item id="chap1" href="chap1.xhtml" media-type="application/xhtml+xml"/>
+ <item id="chap2" href="chap2.xhtml" media-type="application/xhtml+xml"/>
+ </manifest>
+ <spine toc="ncx">
+ <itemref idref="nav"/>
+ <itemref idref="chap1"/>
+ <itemref idref="chap2"/>
+ </spine>
+</package>
--- /dev/null
+++ b/sample/ebooksrc/mimetype
@@ -1,0 +1,1 @@
+application/epub+zip
\ No newline at end of file
--- /dev/null
+++ b/sample/ebooksrc/nav.xhtml
@@ -1,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ops="http://www.idpf.org/2007/ops"
+ xml:lang="en">
+ <head>
+ <title>Table of Contents</title>
+ </head>
+ <body>
+ <nav ops:type="toc">
+ <h1>Table of Contents</h1>
+ <ol>
+ <li><a href="nav.xhtml">Contents</a></li>
+ <li><a href="chap1.xhtml">Chapter 1</a></li>
+ <li><a href="chap2.xhtml">Chapter 2</a></li>
+ </ol>
+ </nav>
+ </body>
+</html>
--- /dev/null
+++ b/sample/mkfile
@@ -1,0 +1,10 @@
+textsource=text
+ebooksource=ebooksrc
+mssource=mssrc
+ebook=sample.epub
+ms=sample.ms
+
+MSARGS=-v 'firstheader=1'
+EBOOKARGS=-v 'firstheader=1'
+
+<../mkfile
--- /dev/null
+++ b/sample/mssrc/aaa.ms
@@ -1,0 +1,20 @@
+.de XS
+.ds LQ ""
+.nr |i (\\$1i-1i)/3u
+.ie '\\$1'0' .tm TOC:.XL \\$1 \\*(LQ\\$2\\*(LQ \\n%
+.el .tm TOC:.XL \\$1 \\*(LQ\h'\\n(|iu'\\*(SN\0\0\\$2\\*(LQ \\n%
+..
+.tm TOC:.de XL
+.tm TOC:.nr |i \\\\$1
+.tm TOC:.ta \\\\n(LLuR
+.tm TOC:.ie \\\\$1>1 \\
+.tm TOC:\\{\\
+.tm TOC:\\\\$2 \\a\\|\\|\\\\$3
+.tm TOC:.vs 15pt
+.tm TOC:.\\}
+.tm TOC:.el \\
+.tm TOC:\\{\\
+.tm TOC:\\fB\\\\$2 \\|\\|\\\\$3\\fR
+.tm TOC:.vs 25pt
+.tm TOC:.\\}
+.tm TOC:..
--- /dev/null
+++ b/sample/text/chap1.txt
@@ -1,0 +1,5 @@
+Chapter 1
+
+# Sample Chapter 1
+
+Hello Chapter 1.
--- /dev/null
+++ b/sample/text/chap2.txt
@@ -1,0 +1,5 @@
+Chapter 2
+
+# Hello Chapter 2
+
+Sample Chapter 2.
\ No newline at end of file