Permalink
Browse files

misc

  • Loading branch information...
yaronn committed Jul 17, 2015
1 parent d4d339b commit 8fb30f022f8e61e9f21c0051a62bb9caa2772677
Showing with 30 additions and 16 deletions.
  1. +2 −1 .gitignore
  2. +5 −5 package.json
  3. +4 −3 server/presenter.js
  4. +8 −3 server/server.js
  5. +6 −0 server/test/test.txt
  6. +5 −4 test/sample.xml
@@ -1,2 +1,3 @@
p.js
node_modules
node_modules
p.txt
@@ -1,25 +1,25 @@
{
"name": "doc-term",
"name": "wopr",
"version": "0.0.1",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+ssh://git@bitbucket.org/yaronn01/doc-term.git"
"url": "https://github.com/yaronn/wopr.git"
},
"author": "Yaron Naveh (yaronn01@gmail.com)",
"bin": {
"doc-term": "./bin/presenter-cli.js"
"wopr": "./bin/presenter-cli.js"
},
"license": "ISC",
"dependencies": {
"blessed": "^0.1.7",
"blessed-contrib": "git+https://github.com/yaronn/blessed-contrib.git",
"blessed-contrib": "^2.3.1",
"xml2js": "^0.4.9"
},
"homepage": "https://bitbucket.org/yaronn01/doc-term#readme",
"homepage": "https://github.com/yaronn/wopr",
"directories": {
"test": "test"
},
@@ -7,7 +7,7 @@ var parse = require('xml2js').parseString
, contrib = require('blessed-contrib')


function present(req, res, body, cba) {
function present(req, res, body, delay, cba) {

blessed.Screen.global = null
blessed.Program.global = null
@@ -45,13 +45,14 @@ function present(req, res, body, cba) {
viewer = new Viewer(doc.document, screen)
var err = viewer.renderPage(page)
if (err!==null) return cba(err)


//note the setTimeout is necessary even if delay is 0
setTimeout(function() {
//res.write('\r\n\r\n\r\n\r\nPress Return to continue\r\n\r\n')
//restore cursor
res.end('\033[?25h')
return cba()
}, 0)
}, delay)

}

@@ -1,3 +1,8 @@


require('supports-color').support = function() {return true;}


var http = require('http')
, url = require('url')
, fs = require('fs')
@@ -18,7 +23,7 @@ http.createServer(function (req, res) {
req.connection.destroy();
});
req.on('end', function () {
present(req, res, body, function(err) {
present(req, res, body, 0, function(err) {
if (err) return contrib.serverError(req, res, err)
})
});
@@ -27,14 +32,14 @@ http.createServer(function (req, res) {
if (req.headers["user-agent"].indexOf('curl')!=-1) {

var content = fs.readFileSync(__dirname+'/../test/sample.xml')
present(req, res, content, function(err) {
present(req, res, content, 3000, function(err) {
if (err) return contrib.serverError(req, res, err)
})

//else return contrib.serverError(req, res, "this url only supports POST")
}
else {
res.writeHead(301, {'Location': 'https://github.com/yaronn/blessed-contrib'});
res.writeHead(301, {'Location': 'https://github.com/yaronn/wopr'});
res.end()
return
}
@@ -13,3 +13,9 @@ a=$(curl -s https://gist.githubusercontent.com/yaronn/6a8f6947fedd88f783d3/raw/1

p=0; while true; do curl tty.zone/$((p++)); read; done


sudo PORT=1337 FORCE_COLOR=1 forever start server.js


curl -N tty.zone/[0-2]

@@ -8,7 +8,7 @@

<markdown style-paragraph="chalk.white" style-strong="chalk.cyan.underline" style-em="chalk.green" border-type="line" border-fg="gray">
<markdown>
*doc-term* is a markup format for rich terminal `reports`, `presentations` and `inforgraphics`. Build the report from any language and view it locally or remotely via curl. &#10;&#10;More information: [http://www.w.com](http://www.w.com) or [http://www.w.com](http://www.w.com) &#10;&#10;Press **Return** for the next slide
*wopr* is a markup format for rich terminal `reports`, `presentations` and `inforgraphics`. Build the report from any language and view it locally or remotely via curl. &#10;&#10;More information: [https://github.com/yaronn/wopr](https://github.com/yaronn/wopr) or [https://twitter.com/YaronNaveh](https://twitter.com/YaronNaveh) &#10;&#10;Press **Return** for the next slide
</markdown>
</markdown>

@@ -74,7 +74,7 @@

<markdown style-paragraph="chalk.white" style-strong="chalk.cyan.underline" style-em="chalk.green" border-type="line" border-fg="gray">
<markdown>
*doc-term* is a markup format for rich terminal `reports`, `presentations` and `inforgraphics`. &#10;Build the report from any language and view it locally or remotely via curl. &#10;More information: [http://www.w.com](http://www.w.com) or [http://www.w.com](http://www.w.com) &#10;&#10;Press **Return** for the next slide
*wopr* is a markup format for rich terminal `reports`, `presentations` and `inforgraphics`. &#10;Build the report from any language and view it locally or remotely via curl. &#10;More information: [https://github.com/yaronn/wopr](https://github.com/yaronn/wopr) or [https://twitter.com/YaronNaveh](https://twitter.com/YaronNaveh) &#10;&#10;Press **Return** for the next slide
</markdown>
</markdown>

@@ -143,11 +143,12 @@


<page>
<item col="4" row="5" colSpan="5" rowSpan="2">

<item col="4" row="6" colSpan="5" rowSpan="2">

<markdown style-paragraph="chalk.white" style-strong="chalk.cyan.underline" style-em="chalk.green">
<markdown>
*Thank you!*&#10;&#10;&#10;&#10;More information: &#10;&#10;[http://www.w.com](http://www.w.com)&#10;&#10;[http://www.w.com](http://www.w.com)&#10;&#10;&#10;&#10;created by @YaronNaveh
*Thank you!*&#10;&#10;&#10;&#10;More information: &#10;&#10;[https://github.com/yaronn/wopr](https://github.com/yaronn/wopr)&#10;&#10;[https://twitter.com/YaronNaveh](https://twitter.com/YaronNaveh)&#10;&#10;&#10;&#10;created by @YaronNaveh
</markdown>
</markdown>

0 comments on commit 8fb30f0

Please sign in to comment.