Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit 8862c173b7f45a8e84f9df92a8739aecf4be3d76 @Vaporbook committed Nov 22, 2012
Showing with 351 additions and 0 deletions.
  1. 0 .gitignore
  2. +11 −0 README.md
  3. +308 −0 html/read/index.html
  4. +1 −0 index.js
  5. +25 −0 lib/epub-tmpl.js
  6. +6 −0 test.js
No changes.
@@ -0,0 +1,11 @@
+epub-tmpl
+===========
+
+# What It Does
+
+Provides reading system templates, single HTML file templates for viewing Epub content in the browser. These can be called selectively based on the type of Epub, type of content it carries, or as a fixed feature of a larger reading system
+
+
+# Design
+
+The design of this module is dependent on a few assumptions: the reading systems here are meant to be fast, compact, lightweight, and heavily optimized for single file usage. The configuration for particular epub content is meant to be injected into the template. All CSS, Javascript and graphical assets should be packaged within this file. Assets can be worked with in separate files but the final template must be a single html file, minified, with a single line on its own for configuration injection.
Oops, something went wrong.
@@ -0,0 +1 @@
+module.exports = require('./lib/epub-tmpl.js');
@@ -0,0 +1,25 @@
+
+var fs = require('fs');
+var templateDir = __dirname + '/../html';
+var externalTemplates;
+
+module.exports.getTemplate = function getTemplate(name) {
+
+ if(externalTemplates[name]=='undefined') {
+ var template = fs.readFileSync(templateDir + '/' + name + '/index.html');
+ return template.toString();
+ } else {
+ return externalTemplates[name];
+ }
+
+}
+
+module.exports.addTemplate = function addTemplate(name, html) {
+
+ // adds a template without adding to filesystem. useful
+ // for using 3rd party or non oss templates
+
+ externalTemplates[name] = html;
+
+}
+
@@ -0,0 +1,6 @@
+
+var tmpl = require('../lib/epub-tmpl.js');
+
+var html = tmpl.getTemplate('read');
+
+console.log(html);

0 comments on commit 8862c17

Please sign in to comment.