added some bootstrap
This commit is contained in:
parent
7fa036ec2b
commit
712fa6d5b7
7
db.js
7
db.js
@ -1,8 +1,8 @@
|
|||||||
var FS = require('fs');
|
var FS = require('fs');
|
||||||
var Path = require('path');
|
var Path = require('path');
|
||||||
var Markdown = require("marked");
|
var Markdown = require("marked");
|
||||||
|
//var MdRenderer=require("./md-override")
|
||||||
var knex = require("knex");
|
var knex = require("knex");
|
||||||
|
|
||||||
var Bookshelf = require('bookshelf');
|
var Bookshelf = require('bookshelf');
|
||||||
|
|
||||||
|
|
||||||
@ -10,9 +10,10 @@ Markdown.setOptions({
|
|||||||
renderer: new Markdown.Renderer(),
|
renderer: new Markdown.Renderer(),
|
||||||
gfm: true,
|
gfm: true,
|
||||||
tables: true,
|
tables: true,
|
||||||
sanitize: true
|
sanitize: false
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// This function is used to map wiki page names to files
|
// This function is used to map wiki page names to files
|
||||||
// on the real filesystem.
|
// on the real filesystem.
|
||||||
function pathFromName(name) {
|
function pathFromName(name) {
|
||||||
@ -49,7 +50,7 @@ exports.loadPage = function (name, callback) {
|
|||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
var html = Markdown(markdown);
|
var html = Markdown(markdown);
|
||||||
|
|
||||||
callback(null, {
|
callback(null, {
|
||||||
name: name,
|
name: name,
|
||||||
title: null,
|
title: null,
|
||||||
|
83
md-override.js
Normal file
83
md-override.js
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
var Markdown = require("marked")
|
||||||
|
|
||||||
|
var renderer = new Markdown.Renderer();
|
||||||
|
|
||||||
|
|
||||||
|
Markdown.setOptions({
|
||||||
|
renderer: renderer,
|
||||||
|
gfm: true,
|
||||||
|
tables: true,
|
||||||
|
sanitize: false
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
renderer.image = function( href, title, text ) {
|
||||||
|
var result = ' alt="' + text.trim() + '" '; // this will be used to store our dimension string (if applicable)
|
||||||
|
var w, h; // our width & height variables
|
||||||
|
|
||||||
|
// title tags need to be between double quotes
|
||||||
|
var rTitle = /"(\w*\s*)+"/;
|
||||||
|
|
||||||
|
// dimension values need to prefix with an equal sign
|
||||||
|
// followed by at least one digit and the times 'x' sign
|
||||||
|
// and (optionally) MAY have a second value
|
||||||
|
var rDims = /=(\d+)x(\d*)/;
|
||||||
|
|
||||||
|
// classes to be placed within the image need to be prefixed with a colon
|
||||||
|
// any subsequent classes to be added with a "." without any leading or trailing
|
||||||
|
// spaces. IT MUST HAVE A SPACE IN FRONT OTHERWISE IT WILL CONFLICT WITH
|
||||||
|
// LINKS CONTAINING http://...
|
||||||
|
var rClass = /\s+:([^\)|\s]+)/;
|
||||||
|
|
||||||
|
// ids need to be prefixed with a hash symbol. MUST HAVE A SPACE BEFORE OTHERWISE
|
||||||
|
// CAN GET CONFUSED WITH URLs.
|
||||||
|
var rId = /\s+#([^\)|\s]+)/;
|
||||||
|
|
||||||
|
// first let's grab the title and then remove from href
|
||||||
|
if ( title === null ) {
|
||||||
|
var getTitle = rTitle.exec( href );
|
||||||
|
if ( getTitle && getTitle[0].length ) {
|
||||||
|
title = getTitle[0].replace( /"/g , "" );
|
||||||
|
result += ' title="' + title + '" ';
|
||||||
|
}
|
||||||
|
href = href.replace( rTitle, "" );
|
||||||
|
}
|
||||||
|
|
||||||
|
// get dimension values from href
|
||||||
|
var getDims = rDims.exec( href );
|
||||||
|
if ( getDims[0].length ) {
|
||||||
|
// width is the first dimension value
|
||||||
|
w = getDims[1];
|
||||||
|
result += ' width="' + w + '" ';
|
||||||
|
// height is the second dimension value (optional)
|
||||||
|
if ( getDims.length > 1 ) {
|
||||||
|
h = getDims[2];
|
||||||
|
result += ' height="' + h + '" ';
|
||||||
|
}
|
||||||
|
href = href.replace( rDims, "" );
|
||||||
|
}
|
||||||
|
|
||||||
|
// get class tag from href
|
||||||
|
var getClass = rClass.exec( href );
|
||||||
|
if ( getClass && getClass[0].length ) {
|
||||||
|
var c = getClass[1];
|
||||||
|
result += ' class="' + c + '" ';
|
||||||
|
href = href.replace( rClass, "" );
|
||||||
|
}
|
||||||
|
|
||||||
|
// get id tag from href
|
||||||
|
var getId = rId.exec( href );
|
||||||
|
if ( getId && getId[0].length ) {
|
||||||
|
var i = getId[1];
|
||||||
|
result += ' id="' + i + '" ';
|
||||||
|
href = href.replace( rId, "" );
|
||||||
|
}
|
||||||
|
|
||||||
|
return '<img src="' + href.trim() + '" ' + result + '>';
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
exports.Markdown = Markdown
|
91
npm-debug.log
Normal file
91
npm-debug.log
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
0 info it worked if it ends with ok
|
||||||
|
1 verbose cli [ '/usr/bin/node',
|
||||||
|
1 verbose cli '/usr/bin/npm',
|
||||||
|
1 verbose cli 'install',
|
||||||
|
1 verbose cli 'node-caja-sanitizer',
|
||||||
|
1 verbose cli '--install' ]
|
||||||
|
2 info using npm@1.4.28
|
||||||
|
3 info using node@v0.10.37
|
||||||
|
4 verbose node symlink /usr/bin/node
|
||||||
|
5 verbose readDependencies using package.json deps
|
||||||
|
6 verbose cache add [ 'node-caja-sanitizer', null ]
|
||||||
|
7 verbose cache add name=undefined spec="node-caja-sanitizer" args=["node-caja-sanitizer",null]
|
||||||
|
8 verbose parsed url { protocol: null,
|
||||||
|
8 verbose parsed url slashes: null,
|
||||||
|
8 verbose parsed url auth: null,
|
||||||
|
8 verbose parsed url host: null,
|
||||||
|
8 verbose parsed url port: null,
|
||||||
|
8 verbose parsed url hostname: null,
|
||||||
|
8 verbose parsed url hash: null,
|
||||||
|
8 verbose parsed url search: null,
|
||||||
|
8 verbose parsed url query: null,
|
||||||
|
8 verbose parsed url pathname: 'node-caja-sanitizer',
|
||||||
|
8 verbose parsed url path: 'node-caja-sanitizer',
|
||||||
|
8 verbose parsed url href: 'node-caja-sanitizer' }
|
||||||
|
9 silly lockFile ff2688e7-node-caja-sanitizer node-caja-sanitizer
|
||||||
|
10 verbose lock node-caja-sanitizer /home/pg/.npm/ff2688e7-node-caja-sanitizer.lock
|
||||||
|
11 silly lockFile ff2688e7-node-caja-sanitizer node-caja-sanitizer
|
||||||
|
12 silly lockFile ff2688e7-node-caja-sanitizer node-caja-sanitizer
|
||||||
|
13 verbose addNamed [ 'node-caja-sanitizer', '' ]
|
||||||
|
14 verbose addNamed [ null, '*' ]
|
||||||
|
15 silly lockFile ec89ea47-node-caja-sanitizer node-caja-sanitizer@
|
||||||
|
16 verbose lock node-caja-sanitizer@ /home/pg/.npm/ec89ea47-node-caja-sanitizer.lock
|
||||||
|
17 silly addNameRange { name: 'node-caja-sanitizer', range: '*', hasData: false }
|
||||||
|
18 verbose request where is /node-caja-sanitizer
|
||||||
|
19 verbose request registry https://registry.npmjs.org/
|
||||||
|
20 verbose request id f8cf19869ce074d8
|
||||||
|
21 verbose url raw /node-caja-sanitizer
|
||||||
|
22 verbose url resolving [ 'https://registry.npmjs.org/', './node-caja-sanitizer' ]
|
||||||
|
23 verbose url resolved https://registry.npmjs.org/node-caja-sanitizer
|
||||||
|
24 verbose request where is https://registry.npmjs.org/node-caja-sanitizer
|
||||||
|
25 info trying registry request attempt 1 at 00:02:56
|
||||||
|
26 http GET https://registry.npmjs.org/node-caja-sanitizer
|
||||||
|
27 http 404 https://registry.npmjs.org/node-caja-sanitizer
|
||||||
|
28 verbose headers { date: 'Mon, 30 Mar 2015 23:03:00 GMT',
|
||||||
|
28 verbose headers server: 'CouchDB/1.5.0 (Erlang OTP/R16B03)',
|
||||||
|
28 verbose headers 'content-type': 'application/json',
|
||||||
|
28 verbose headers 'cache-control': 'max-age=0',
|
||||||
|
28 verbose headers 'content-length': '51',
|
||||||
|
28 verbose headers 'accept-ranges': 'bytes',
|
||||||
|
28 verbose headers via: '1.1 varnish',
|
||||||
|
28 verbose headers age: '0',
|
||||||
|
28 verbose headers 'x-served-by': 'cache-lcy1126-LCY',
|
||||||
|
28 verbose headers 'x-cache': 'MISS',
|
||||||
|
28 verbose headers 'x-cache-hits': '0',
|
||||||
|
28 verbose headers 'x-timer': 'S1427756580.095012,VS0,VE658',
|
||||||
|
28 verbose headers 'keep-alive': 'timeout=10, max=50',
|
||||||
|
28 verbose headers connection: 'Keep-Alive' }
|
||||||
|
29 silly registry.get cb [ 404,
|
||||||
|
29 silly registry.get { date: 'Mon, 30 Mar 2015 23:03:00 GMT',
|
||||||
|
29 silly registry.get server: 'CouchDB/1.5.0 (Erlang OTP/R16B03)',
|
||||||
|
29 silly registry.get 'content-type': 'application/json',
|
||||||
|
29 silly registry.get 'cache-control': 'max-age=0',
|
||||||
|
29 silly registry.get 'content-length': '51',
|
||||||
|
29 silly registry.get 'accept-ranges': 'bytes',
|
||||||
|
29 silly registry.get via: '1.1 varnish',
|
||||||
|
29 silly registry.get age: '0',
|
||||||
|
29 silly registry.get 'x-served-by': 'cache-lcy1126-LCY',
|
||||||
|
29 silly registry.get 'x-cache': 'MISS',
|
||||||
|
29 silly registry.get 'x-cache-hits': '0',
|
||||||
|
29 silly registry.get 'x-timer': 'S1427756580.095012,VS0,VE658',
|
||||||
|
29 silly registry.get 'keep-alive': 'timeout=10, max=50',
|
||||||
|
29 silly registry.get connection: 'Keep-Alive' } ]
|
||||||
|
30 silly lockFile ec89ea47-node-caja-sanitizer node-caja-sanitizer@
|
||||||
|
31 silly lockFile ec89ea47-node-caja-sanitizer node-caja-sanitizer@
|
||||||
|
32 error 404 404 Not Found: node-caja-sanitizer
|
||||||
|
32 error 404
|
||||||
|
32 error 404 'node-caja-sanitizer' is not in the npm registry.
|
||||||
|
32 error 404 You should bug the author to publish it
|
||||||
|
32 error 404 It was specified as a dependency of 'wiki-contest'
|
||||||
|
32 error 404
|
||||||
|
32 error 404 Maybe try 'npm search caja sanitizer'
|
||||||
|
32 error 404
|
||||||
|
32 error 404 Note that you can also install from a
|
||||||
|
32 error 404 tarball, folder, or http url, or git url.
|
||||||
|
33 error System Linux 3.2.0-4-amd64
|
||||||
|
34 error command "/usr/bin/node" "/usr/bin/npm" "install" "node-caja-sanitizer" "--install"
|
||||||
|
35 error cwd /home/pg/wiki/wiki
|
||||||
|
36 error node -v v0.10.37
|
||||||
|
37 error npm -v 1.4.28
|
||||||
|
38 error code E404
|
||||||
|
39 verbose exit [ 1, true ]
|
@ -13,7 +13,10 @@
|
|||||||
"knex": "^0.7.6",
|
"knex": "^0.7.6",
|
||||||
"markdown": "~0.3.1",
|
"markdown": "~0.3.1",
|
||||||
"marked": "^0.3.3",
|
"marked": "^0.3.3",
|
||||||
|
"multimarkdown": "0.0.15",
|
||||||
|
"namp": "^0.2.25",
|
||||||
"passport-local": "^1.0.0",
|
"passport-local": "^1.0.0",
|
||||||
|
"showdown": "^0.4.0",
|
||||||
"trycatch": "~0.0.9"
|
"trycatch": "~0.0.9"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
###Hello THSF
|
###Hello THSF
|
||||||
this is a simple and stupid wiki :)
|
this is a simple and stupid wiki :)
|
||||||
|
|
||||||
![](http://stuffpoint.com/lol-cats/image/29077-lol-cats-magical-kitteh.png)
|
![](http://stuffpoint.com/lol-cats/image/29077-lol-cats-magical-kitteh.png)
|
||||||
|
|
||||||
<script> alert('loool'); </script>
|
|
@ -3,4 +3,18 @@ html
|
|||||||
head
|
head
|
||||||
title= title
|
title= title
|
||||||
link(rel='stylesheet', href='/stylesheets/style.css')
|
link(rel='stylesheet', href='/stylesheets/style.css')
|
||||||
body!= body
|
link(rel='stylesheet', href='http://lbesson.bitbucket.org/md/themes/cyborg.min.css')
|
||||||
|
link(rel='stylesheet', href='http://lbesson.bitbucket.org/md/themes/bootstrap-responsive.min.css')
|
||||||
|
body
|
||||||
|
nav.navbar.navbar-default
|
||||||
|
div.container-fluid
|
||||||
|
ul.nav.nav-pills
|
||||||
|
li(role="presentation" )
|
||||||
|
a(href="#") one
|
||||||
|
li(role="presentation")
|
||||||
|
a(href="#") two
|
||||||
|
li(role="presentation" )
|
||||||
|
a(href="#") three
|
||||||
|
|
||||||
|
block body
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
include ./layout.jade
|
include ./layout.jade
|
||||||
h1= title
|
.container-fluid
|
||||||
.article!= html
|
h1= title
|
||||||
a(href="/" + name + "/edit")= "Edit this Page"
|
|
||||||
|
.document!= html
|
||||||
|
a(href="/" + name + "/edit")= "Edit this Page"
|
||||||
|
Loading…
Reference in New Issue
Block a user