Skip to content

Instantly share code, notes, and snippets.

@valpackett
Created February 3, 2012 18:32
Show Gist options
  • Save valpackett/1731622 to your computer and use it in GitHub Desktop.
Save valpackett/1731622 to your computer and use it in GitHub Desktop.
Kindle dictionary template

Kindle dictionary template

Use it with KindleGen

kindlegen dic.opf

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Sample Dictionary</title>
</head>
<body>
<h1>Sample Dictionary</h1>
<h2>by John Doe</h2>
<mbp:pagebreak />
<a name="toc"></a>
<h1>Table of Contents</h1>
<p><a href="#langs">Languages</a></p>
<mbp:pagebreak />
<a name="langs"></a>
<p>
<idx:entry>
<idx:orth>Python</idx:orth> &mdash;
a programming language that lets you work more quickly and integrate your systems more effectively.
</idx:entry>
</p>
<p>
<idx:entry>
<idx:orth>Clojure</idx:orth> &mdash;
a dynamic programming language that targets the Java Virtual Machine (and the CLR, and JavaScript).
</idx:entry>
</p>
<p>
<idx:entry>
<idx:orth>Ruby</idx:orth> &mdash;
a dynamic, open source programming language with a focus on simplicity and productivity.
</idx:entry>
</p>
</body>
</html>
<?xml version="1.0" encoding="utf-8"?>
<package unique-identifier="uid">
<metadata>
<dc-metadata xmlns:dc="http://purl.org/metadata/dublin_core" xmlns:oebpackage="http://openebook.org/namespaces/oeb-package/1.0/">
<dc:Title>Sample Dictionary</dc:Title>
<dc:Language>en-us</dc:Language>
<dc:Creator>John Doe</dc:Creator>
<dc:Description>Demo</dc:Description>
<dc:Date>3/1/2012</dc:Date>
</dc-metadata>
<x-metadata>
<output encoding="utf-8" content-type="text/x-oeb1-document"></output>
<EmbeddedCover>dic.png</EmbeddedCover>
<!-- That's how it's recognized as a dictionary: -->
<DictionaryInLanguage>en-us</DictionaryInLanguage>
<DictionaryOutLanguage>en-us</DictionaryOutLanguage>
</x-metadata>
</metadata>
<manifest>
<item id="item1" media-type="text/x-oeb1-document" href="dic.html"></item>
</manifest>
<spine toc="toc">
<itemref idref="item1"/>
</spine>
<guide>
<reference type="toc" title="Table of Contents" href="dic.html#toc"></reference>
</guide>
</package>
@MrXyfir
Copy link

MrXyfir commented Jul 24, 2018

Any idea if this is still the current and proper way to do it? This information seems surprisingly hard to find; unless I'm searching for the wrong thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment