Hello,

I have done some work and made some progress with it. The following script 
is a test-script to generate the manifest part of the content.opf:

---

#!/usr/bin/env python 

#################################################################### 
# call the operating system (?) 
#################################################################### 
import os 

#################################################################### 
# create the directory structure 
#################################################################### 
My_Epub = "epub"
if not os.path.exists(My_Epub): 
    os.mkdir(My_Epub) 

root_path = "./epub/" 
folders = ["META-INF", "OEBPS", "OEBPS/texts", "OEBPS/css", "OEBPS/media", 
"OEBPS/fonts"] 
for folder in folders: 
   os.mkdir(os.path.join(root_path,folder)) 

#################################################################### 
# create the mimetype file 
#################################################################### 
with open(os.path.join(My_Epub, "mimetype"), "w") as fp: 
    fp.write("application/epub+zip") 

#################################################################### 
# create the container xml file 
#################################################################### 
My_Container_xml = """<?xml version="1.0" ?> 
<container version="1.0" 
xmlns="urn:oasis:names:tc:opendocument:xmlns:container"> 
<rootfiles> 
<rootfile full-path="OEBPS/content.opf" 
media-type="application/oebps-package+xml" /> 
</rootfiles> 
</container> 
""" 

with open(os.path.join(My_Epub, "META-INF", "container.xml"),"w") as fp: 
    fp.write(My_Container_xml) 

#################################################################### 
# create first parts of toc.ncx, content.opf and nav.xhtml
#################################################################### 
with open(os.path.join(My_Epub, "OEBPS", "toc.ncx"), "w") as fp: 
    fp.write("") 
with open(os.path.join(My_Epub, "OEBPS", "content.opf"), "w") as fp: 
    fp.write("") 
with open(os.path.join(My_Epub, "OEBPS", "nav.xhtml"), "w") as fp: 
    fp.write("") 

---

I do feel I did this not very 'nice', but (again) it works.Any suggestions 
to improve it will be more than welcome.

With regards,

Eelco Deuling

-- 
-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>



Reply via email to