The branch, epub/new_features/navigation, has been updated.

- Log -----------------------------------------------------------------

commit 2a9e2815d95b6ac29604c7699e75504aa87dfc84
Author: Josh Hieronymus <[email protected]>
Date:   Mon Sep 23 23:14:30 2013 -0400

    Mark helper classes for EPUB conversion as internal.
    
    The Container class from epub_meta_inf and Content and Toc classes
    from epub_oebps are intended only to be used as helper classes
    in the module within which they are defined. A leading underscore
    has been added to them, conforming to Python convention for marking
    items as internal.

diff --git a/lib/scripts/epub/epub_meta_inf.py 
b/lib/scripts/epub/epub_meta_inf.py
index 4ad7922..9ca0e27 100644
--- a/lib/scripts/epub/epub_meta_inf.py
+++ b/lib/scripts/epub/epub_meta_inf.py
@@ -35,7 +35,7 @@ class MetaInf(object):
             to which MetaInf files will added to the EPUB file archive
         """
         self.pathname = os.path.join(base_pathname, self.ARCHIVE_DIRECTORY)
-        self.container = Container(self.pathname)
+        self.container = _Container(self.pathname)
 
     def write(self):
         """Write all MetaInf contents to file.
@@ -58,7 +58,7 @@ class MetaInf(object):
         """
         self.container.add_to_epub_file(epub_file)
 
-class Container(object):
+class _Container(object):
     FILENAME = "container.xml"
     XML_ENCODING = "UTF-8"
     CONTAINER_VERSION = "1.0"
diff --git a/lib/scripts/epub/epub_oebps.py b/lib/scripts/epub/epub_oebps.py
index 5f9ae6f..8954d84 100644
--- a/lib/scripts/epub/epub_oebps.py
+++ b/lib/scripts/epub/epub_oebps.py
@@ -54,8 +54,8 @@ class Oebps(object):
         self.pathname = os.path.join(base_pathname, self.ARCHIVE_DIRECTORY)
         xhtml_etree = ET.parse(xhtml_name)
         xhtml_root = xhtml_etree.getroot()
-        self.content = Content(self.pathname, self.xhtml_name, xhtml_root)
-        self.toc = Toc(self.pathname, self.xhtml_name, xhtml_root)
+        self.content = _Content(self.pathname, self.xhtml_name, xhtml_root)
+        self.toc = _Toc(self.pathname, self.xhtml_name, xhtml_root)
 
     def write(self):
         """Write all Oebps contents to file.
@@ -86,7 +86,7 @@ class Oebps(object):
         self.toc.add_to_epub_file(epub_file)
 
 # TODO: (Potentially) split XHTML file into smaller files
-class Content(object):
+class _Content(object):
     FILENAME = "content.opf"
     XML_VERSION = "1.0"
     XML_ENCODING = "UTF-8"
@@ -139,7 +139,7 @@ class Content(object):
         # Defaults for information that can't be extracted successfully.
         CREATOR_ROLE = "aut"
         def __init__(self, xhtml_root):
-            self.root = 
ET.Element("{{{}}}metadata".format(Content.PACKAGE_XMLNS))
+            self.root = 
ET.Element("{{{}}}metadata".format(_Content.PACKAGE_XMLNS))
             self.title = ET.Element(self.TITLE_TAG)
             self.title.text = extract_title(xhtml_root)
             self.root.append(self.title)
@@ -147,15 +147,15 @@ class Content(object):
             self.language.text = extract_language(xhtml_root)
             self.root.append(self.language)
             self.identifier = ET.Element(self.IDENTIFIER_TAG)
-            self.identifier.set("id", Content.PACKAGE_UNIQUE_IDENTIFIER)
+            self.identifier.set("id", _Content.PACKAGE_UNIQUE_IDENTIFIER)
             identifier_scheme = extract_identifier_scheme(xhtml_root)
-            self.identifier.set("{{{}}}scheme".format(Content.PACKAGE_XMLNS), 
identifier_scheme)
+            self.identifier.set("{{{}}}scheme".format(_Content.PACKAGE_XMLNS), 
identifier_scheme)
             self.identifier.text = extract_identifier(xhtml_root)
             self.root.append(self.identifier)
             self.creator = ET.Element(self.CREATOR_TAG)
             author_file_as = extract_author_file_as(xhtml_root)
-            self.creator.set("{{{}}}file-as".format(Content.PACKAGE_XMLNS), 
author_file_as)
-            self.creator.set("{{{}}}role".format(Content.PACKAGE_XMLNS), 
self.CREATOR_ROLE)
+            self.creator.set("{{{}}}file-as".format(_Content.PACKAGE_XMLNS), 
author_file_as)
+            self.creator.set("{{{}}}role".format(_Content.PACKAGE_XMLNS), 
self.CREATOR_ROLE)
             self.creator.text = extract_author(xhtml_root)
             self.root.append(self.creator)
 
@@ -167,7 +167,7 @@ class Content(object):
         XHTML_XMLNS = "http://www.w3.org/1999/xhtml";
         def __init__(self, xhtml_name, xhtml_label, xhtml_root):
             self.linked_files = []
-            self.root = 
ET.Element("{{{}}}manifest".format(Content.PACKAGE_XMLNS))
+            self.root = 
ET.Element("{{{}}}manifest".format(_Content.PACKAGE_XMLNS))
             self.add_item(self.TOC_ID, self.TOC_HREF, self.TOC_MEDIA_TYPE)
             self.add_item(xhtml_label, xhtml_name, self.XHTML_MEDIA_TYPE)
             image_item_info = self.get_image_item_info(xhtml_root)
@@ -184,7 +184,7 @@ class Content(object):
                 self.add_item(css_id, css_href, css_media_type)
 
         def add_item(self, id_, href, media_type):
-            item = ET.Element("{{{}}}item".format(Content.PACKAGE_XMLNS))
+            item = ET.Element("{{{}}}item".format(_Content.PACKAGE_XMLNS))
             item.set("id", id_)
             item.set("href", href)
             item.set("media-type", media_type)
@@ -222,13 +222,13 @@ class Content(object):
     class Spine(object):
         SPINE_TOC = "ncx"
         def __init__(self, xhtml_label):
-            self.root = ET.Element("{{{}}}spine".format(Content.PACKAGE_XMLNS))
+            self.root = 
ET.Element("{{{}}}spine".format(_Content.PACKAGE_XMLNS))
             self.root.set("toc", self.SPINE_TOC)
-            itemref = ET.Element("{{{}}}itemref".format(Content.PACKAGE_XMLNS))
+            itemref = 
ET.Element("{{{}}}itemref".format(_Content.PACKAGE_XMLNS))
             itemref.set("idref", xhtml_label)
             self.root.append(itemref)
 
-class Toc(object):
+class _Toc(object):
     FILENAME = "toc.ncx"
     XML_VERSION = "1.0"
     XML_ENCODING = "UTF-8"

commit 9cc3aa67b0065a4f83fe353ad2e233ac3030e149
Author: Josh Hieronymus <[email protected]>
Date:   Mon Sep 23 19:51:58 2013 -0400

    Add some module-level docstrings for EPUB-related source code.

diff --git a/lib/scripts/epub/epub.py b/lib/scripts/epub/epub.py
index c64b2ba..ddce377 100644
--- a/lib/scripts/epub/epub.py
+++ b/lib/scripts/epub/epub.py
@@ -7,6 +7,8 @@
 
 # author Josh Hieronymus
 
+"""Parses an XHTML infile and returns an EPUB outfile."""
+
 import argparse
 import os
 import os.path
diff --git a/lib/scripts/epub/epub_meta_inf.py 
b/lib/scripts/epub/epub_meta_inf.py
index ce426ee..4ad7922 100644
--- a/lib/scripts/epub/epub_meta_inf.py
+++ b/lib/scripts/epub/epub_meta_inf.py
@@ -7,6 +7,8 @@
 
 # author Josh Hieronymus
 
+"""This module contains classes related to an EPUB file's META-INF 
directory."""
+
 import os
 import os.path
 import xml.etree.ElementTree as ET
diff --git a/lib/scripts/epub/epub_oebps.py b/lib/scripts/epub/epub_oebps.py
index 2204003..5f9ae6f 100644
--- a/lib/scripts/epub/epub_oebps.py
+++ b/lib/scripts/epub/epub_oebps.py
@@ -7,6 +7,8 @@
 
 # author Josh Hieronymus
 
+"""This module contains classes related to an EPUB file's OEBPS directory."""
+
 import mimetypes
 import os
 import os.path

-----------------------------------------------------------------------

Summary of changes:
 lib/scripts/epub/epub.py          |    2 ++
 lib/scripts/epub/epub_meta_inf.py |    6 ++++--
 lib/scripts/epub/epub_oebps.py    |   28 +++++++++++++++-------------
 3 files changed, 21 insertions(+), 15 deletions(-)


hooks/post-receive
-- 
Repositories for GSOC work

Reply via email to