Skip to content

Instantly share code, notes, and snippets.

@mdgriffith
Created January 7, 2017 17:07
Show Gist options
  • Save mdgriffith/1cf022e60d80f8387e183d6b86e47223 to your computer and use it in GitHub Desktop.
Save mdgriffith/1cf022e60d80f8387e183d6b86e47223 to your computer and use it in GitHub Desktop.
# This is a dictionary for the file-type information when
# building the manifest entries in the OPF.
entry_dict = ({"xhtml": 'application/xhtml+xml',
"html": 'application/xhtml+xml',
"css": 'text/css',
"png": 'image/png',
"jpg": 'image/jpeg',
"jpeg": 'image/jpeg',
"tiff": 'image/tiff',
"gif": 'image/gif',
"mp4": 'video/mpeg4',
"mp3": 'audio/mp3',
"otf": 'application/vnd.ms-opentype',
"ttf": 'application/vnd.ms-truetype',})
item_template = '\t\t<item id="{fileid}" href="{href}" media-type="{media}" \>'
boilerentry = (item_template.format( fileid=fileid,
href=directory + dirname + filename,
media=entry_dict[file_ext]
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment