Commits

Brian Mearns  committed b826c1d

[n] Added meta and uuid related symbols to templ stack for writeEpub, added display-seq to author list for writeEpub.

  • Participants
  • Parent commits ca44544

Comments (0)

Files changed (3)

 Rel 8 - ???????? - ??????????
-    
+    [n] Added META-* and UUID-* symbols to templ stack for writeEpub.
+    [n] Added display-seq to dc:creator author list for writeEpub.
 
 Rel 7 - v1.2.4.0 - 2013-04-26
     [p] A little better handling of UTF-8 and a few character accents.

File src/tome/version.py

 
 YEAR        = 2013
 MONTH       = 4
-DAY         = 26
+DAY         = 30
 COPYRIGHT   = YEAR
 
 TAG         = "dev"

File src/tome/writeEpub.py

 import sys
 import errno
 import pkg_resources
+import uuid
 
 
 def htmlEscape(text):
         templStack = templ.stack.Stack(globs)
         topScope = templStack.push()
 
+        ### All Meta
+        _meta = []
+        _meta_keys = []
+        for k in self.__tome.metaIter():
+            _meta_keys.append(k)
+            _meta.append(k)
+            _meta.append(templ.ttypes.List(self.__tome.getMeta(k)))
+        topScope["META-PLIST"] = templ.ttypes.List(_meta)
+        topScope["META-KEYS"] = templ.ttypes.List(_meta_keys)
+
         ### Generate title stuff.
         allTitles = self.__tome.allTitles()
         topScope["TITLE-LIST"] = templ.ttypes.List(allTitles)
         ### Some additional top-level contnet
         now = time.gmtime()
         topScope["UID"] = templ.ttypes.String(self.__uid)
+        topScope["UUID-1-1"] = templ.ttypes.String(str(uuid.uuid1()))
+        topScope["UUID-1-5-DNS"] = templ.ttypes.String(str(uuid.uuid5(uuid.NAMESPACE_DNS, str(self.__uid))))
+        topScope["UUID-1-5-URL"] = templ.ttypes.String(str(uuid.uuid5(uuid.NAMESPACE_URL, str(self.__uid))))
+        topScope["UUID-1-5-OID"] = templ.ttypes.String(str(uuid.uuid5(uuid.NAMESPACE_OID, str(self.__uid))))
+        topScope["UUID-1-5-X500"] = templ.ttypes.String(str(uuid.uuid5(uuid.NAMESPACE_X500, str(self.__uid))))
         topScope["LANG"] = templ.ttypes.String(self.__lang)
         topScope["MODIFIED"] = templ.ttypes.String(time.strftime("%Y-%m-%dT%H:%M:%SZ", now))
         topScope["COPYRIGHT-YEAR"] = templ.ttypes.String(time.strftime("%Y", now))
         <dc:creator id='creator{cid}'>{author}</dc:creator>
             <meta refines='#creator{cid}' property='role' scheme='marc:relators'>aut</meta>
             <meta refines='#creator{cid}' property='file-as'>{authorAs}</meta>
+            <meta refines='#creator{cid}' property='display-seq'>{cid}</meta>
     """.format(
                 cid=str(cid),
                 author=htmlEscape(author),