Commits

Anonymous committed 383ea1c Draft

.

  • Participants
  • Parent commits 43f6c46

Comments (0)

Files changed (7)

doc/planning/misc_projects

+
+LDT: does the transparent textarea / display layer idea in a modular fashion.
+Could be forked to allow for markdown-esque highlighting while in Edit mode.
+https://github.com/kueblc/LDT/
+

doc/planning/philosophy.md

+Principle of Leebre editor
+==========
+
+Broad strategy
+----
+
+1. **Leebre is not a Word Processor.**
+
+    It is a Content Editor. It creates and describes meaning behind data.
+    WYMIWYG instead of WYSIWYG. This leads us to...
+
+2. **Semantic interaction.**
+
+    Not only is the format itself semantic, but the act of editing should be
+    meaningful also. In other words...
+
+3. **Atomicity is your friend.**
+
+    Every interaction is atomic at a logical level (ie, edit mode per
+    block-level element). This makes undo/redo, branching, real-time
+    collaboration, and so on, transparent at the user level, more so than the
+    word processor method where a "single edit" is not a concept. This is
+    inspired by...
+
+4. **Look to hacker tools for inspiration.**
+
+    Hacker tools make sense. Expose the power and logic of `vim`, `git`,
+    `markdown`, `apt-get`, but in a discoverable way.  Principles of hacker
+    tools is transparency, explicitness, DRY, MCV,
+    [TOOWTDI](http://wiki.python.org/moin/TOOWTDI) and so on.  These principles
+    were created because they are better than layperson approaches.  Which
+    enables...
+
+5. **Ramp up to hard mode.**
+
+    The Leebre Editor should be equally useful for both pro-hackers and novices
+    alike, and provide a means of transitioning to faster or more "pro"
+    interaction methods (ie shortcuts, markdown, etc). Also, pro users like to
+    scratch their own itches, which means we can...
+
+6. **Crowd source the long tail of categories of meaning.** <sup>1</sup>
+
+    Plugins consist of defining types of meaning, from recipes to homework
+    assignments. They can suggest better means of interacting with this data,
+    and suggestions of styling of this data for export.  Like node/npm, develop
+    a core application and a means of implementing plugins which are
+    independently developed. Make search as you go the way to find new
+    meanings. (See UI mock-ups.)
+
+
+Design principles
+----
+
+1. **The content is the interface.**
+
+2. **Old paradigms are fine if new UI is not apparent.**
+
+    Go ahead and use toolbars and menus, at the very least in the prototype, if
+    it is not obvious or generalizable how to derive UI from the content. As
+    user interaction patterns become more apparent and meaningful, and a
+    content-based interaction model manifests based on transparency and
+    atomicity, then "reform" to #1.
+
+3. **Be trendy since we need to compete.**
+
+    Flat is in. Retina photos are in. Tiles are in. Ultra-thin White Sans
+    Typeface is also in, but let us just ignore that one. This is because
+    Leebre branding is intended to invoke printed books.
+
+-------------
+
+[1] Bingo, sir!

doc/planning/philosophy.md.html

+<h1>Principle of Leebre editor</h1>
+
+<h2>Broad strategy</h2>
+
+<ol>
+<li><p><strong>Leebre is not a Word Processor.</strong></p>
+
+<p>It is a Content Editor. It creates and describes meaning behind data.
+WYMIWYG instead of WYSIWYG. This leads us to...</p></li>
+<li><p><strong>Semantic interaction.</strong></p>
+
+<p>Not only is the format itself semantic, but the act of editing should be
+meaningful also. In other words...</p></li>
+<li><p><strong>Atomicity is your friend.</strong></p>
+
+<p>Every interaction is atomic at a logical level (ie, edit mode per
+block-level element). This makes undo/redo, branching, real-time
+collaboration, and so on, transparent at the user level, more so than the
+word processor method where a "single edit" is not a concept. This is
+inspired by...</p></li>
+<li><p><strong>Look to hacker tools for inspiration.</strong></p>
+
+<p>Hacker tools make sense. Expose the power and logic of <code>vim</code>, <code>git</code>,
+<code>markdown</code>, <code>apt-get</code>, but in a discoverable way.  Principles of hacker
+tools is transparency, explicitness, DRY, MCV,
+<a href="http://wiki.python.org/moin/TOOWTDI">TOOWTDI</a> and so on.  These principles
+were created because they are better than layperson approaches.  Which
+enables...</p></li>
+<li><p><strong>Ramp up to hard mode.</strong></p>
+
+<p>The Leebre Editor should be equally useful for both pro-hackers and novices
+alike, and provide a means of transitioning to faster or more "pro"
+interaction methods (ie shortcuts, markdown, etc). Also, pro users like to
+scratch their own itches, which means we can...</p></li>
+<li><p><strong>Crowd source the long tail of categories of meaning.</strong> <sup>1</sup></p>
+
+<p>Plugins consist of defining types of meaning, from recipes to homework
+assignments. They can suggest better means of interacting with this data,
+and suggestions of styling of this data for export.  Like node/npm, develop
+a core application and a means of implementing plugins which are
+independently developed. Make search as you go the way to find new
+meanings. (See UI mock-ups.)</p></li>
+</ol>
+
+<h2>Design principles</h2>
+
+<ol>
+<li><p><strong>The content is the interface.</strong></p></li>
+<li><p><strong>Old paradigms are fine if new UI is not apparent.</strong></p>
+
+<p>Go ahead and use toolbars and menus, at the very least in the prototype, if
+it is not obvious or generalizable how to derive UI from the content. As
+user interaction patterns become more apparent and meaningful, and a
+content-based interaction model manifests based on transparency and
+atomicity, then "reform" to #1.</p></li>
+<li><p><strong>Be trendy since we need to compete.</strong></p>
+
+<p>Flat is in. Retina photos are in. Tiles are in. Ultra-thin White Sans
+Typeface is also in, but let us just ignore that one. This is because
+Leebre branding is intended to invoke printed books.</p></li>
+</ol>
+
+<hr />
+
+<p>[1] Bingo, sir!</p>

node/package.json

         "clean-css": "0.9.1",
         "cli-table": "0.2.0",
         "express": "3.1.0",
-        "jquery": "1.8.2",
+        "jquery": "1.8.3",
         "node-static": "0.6.7",
         "optimist": "0.3.5",
         "swig": "0.13.4",

node/phantomjs.js

         };
 
     if (fs.existsSync && !fs.existsSync(result.bin)) {
-        error('PhantomJS binary not found in expected location.');
+        error('PhantomJS binary not found in '+
+                'expected location. ['+platform+': '+result.bin+']');
     }
 
     return result;
 
 var _v = function () {
     if (globall.verbose) {
-        console.log.apply(console.log, arguments);
+        console.error.apply(console.log, arguments);
     }
 };
 
     _v("Wrote " + result.length + " characters to " + output_path);
 };
 
-var render_resets
-
 
 exports.render_then_convert = function (sb, style_list, output_path, target) {
 };
 
-exports.write_all_and_return_report = function (sb, sembook_path, output_paths) {
+exports.render_all = function (sb, sembook_path, output_paths) {
     // Function to render HTML as a PNG etc
     var render_image = function (opts, cb) {
     };
         // Cover info
         'cover_author_name': 'cover author_name',
         'cover_author_url': 'cover author_url',
-        'cover_license': 'cover author_url'
+        'cover_license': 'cover license'
+    };
+
+    // Two "rich text" fields should be rendered with to_html()
+    var _as_html = { author_bio: true, summary: true };
+
+    var render_meta = function (item, node) {
+        if (_as_html[item]) {
+            return node.to_html();
+        } else {
+            return node.data;
+        }
     };
 
     var results = {}
 
     for (var item in items) {
         var jq_path = items[item];
-        results[item] = sb.$meta(jq_path).data;
+        results[item] = render_meta(item, sb.$meta(jq_path));
     }
 
     return results;
         .alias('p', 'path')
         .describe('p', 'JSON paths to render various formats to.')
 
+        .boolean('r')
+        .alias('r', 'report')
+        .describe('r', 'generate report instead of rendering')
+
         .boolean('v')
         .alias('v', 'verbose')
         .describe('v', 'verbose mode')
         process.exit();
     }
 
-    var output_paths = JSON.parse(argv.path);
-
-    // Default operation
+    // parse in sembook
     var sb = exports.read_sembook(sembook_path);
 
     // JSON report
     //render_operation(sb, _v);
-    var report = exports.write_all_and_return_report(sb, sembook_path, output_paths);
-    console.log(JSON.stringify(exports.sembook_report(sb)));
+    if (argv.report) {
+        console.log(JSON.stringify(exports.sembook_report(sb)));
+    } else if (argv.path) {
+        var output_paths = JSON.parse(argv.path);
+        exports.render_all(sb, sembook_path, output_paths);
+    } else {
+        console.error("Should specify either --path for render "+
+                        "operation or --report for report operation");
+    }
     /*
     if (argv.json) {
         // JSON report
 import subprocess
 import json
 import os
+import sys
 
 path = os.path
 
 RENDERJS_PATH = path.abspath(path.join(__file__, "..", "render.js"))
 
 
-def render_all_and_return_report(sembook_path, output_paths, verbose=False):
+
+def get_report(sembook_path, verbose=False):
+    cmd = ['node', RENDERJS_PATH, sembook_path]
+    if verbose:
+        cmd += ['--verbose']
+
+    cmd += ['--report']
+
+    if verbose:
+        print("Executing: %s"%' '.join(cmd))
+    out = subprocess.check_output(cmd)
+
+    try:
+        result = json.loads(out)
+    except ValueError as e:
+        sys.stderr.write("Could not load Sembook information: %s\n" % out)
+        sys.stderr.write("[%s]\n" % repr(e))
+        raise ValueError
+    else:
+        return result
+
+def render_all(sembook_path, output_paths, verbose=False):
     cmd = ['node', RENDERJS_PATH, sembook_path]
     if verbose:
         cmd += ['--verbose']
 
     if verbose:
         print("Executing: %s"%' '.join(cmd))
-    #out = subprocess.check_output(cmd)
-    #return json.loads(out)
+    out = subprocess.check_output(cmd)
+    return out
 
 def test_main():
     tools = path.abspath(path.join(__file__, "..", "..", "testdata"))