'
657 | + escape(cap[2], true)
658 | + '';
659 | continue;
660 | }
661 |
662 | // br
663 | if (cap = this.rules.br.exec(src)) {
664 | src = src.substring(cap[0].length);
665 | out += ''
877 | + this.token.text
878 | + '\n';
879 | }
880 | case 'table': {
881 | var body = ''
882 | , heading
883 | , i
884 | , row
885 | , cell
886 | , j;
887 |
888 | // header
889 | body += '\n\n' 929 | + body 930 | + '\n'; 931 | } 932 | case 'list_start': { 933 | var type = this.token.ordered ? 'ol' : 'ul' 934 | , body = ''; 935 | 936 | while (this.next().type !== 'list_end') { 937 | body += this.tok(); 938 | } 939 | 940 | return '<' 941 | + type 942 | + '>\n' 943 | + body 944 | + '' 945 | + type 946 | + '>\n'; 947 | } 948 | case 'list_item_start': { 949 | var body = ''; 950 | 951 | while (this.next().type !== 'list_item_end') { 952 | body += this.token.type === 'text' 953 | ? this.parseText() 954 | : this.tok(); 955 | } 956 | 957 | return '
' 979 | + this.inline.output(this.token.text) 980 | + '
\n'; 981 | } 982 | case 'text': { 983 | return '' 984 | + this.parseText() 985 | + '
\n'; 986 | } 987 | } 988 | }; 989 | 990 | /** 991 | * Helpers 992 | */ 993 | 994 | function escape(html, encode) { 995 | return html 996 | .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&') 997 | .replace(//g, '>') 999 | .replace(/"/g, '"') 1000 | .replace(/'/g, '''); 1001 | } 1002 | 1003 | function replace(regex, opt) { 1004 | regex = regex.source; 1005 | opt = opt || ''; 1006 | return function self(name, val) { 1007 | if (!name) return new RegExp(regex, opt); 1008 | val = val.source || val; 1009 | val = val.replace(/(^|[^\[])\^/g, '$1'); 1010 | regex = regex.replace(name, val); 1011 | return self; 1012 | }; 1013 | } 1014 | 1015 | function noop() {} 1016 | noop.exec = noop; 1017 | 1018 | function merge(obj) { 1019 | var i = 1 1020 | , target 1021 | , key; 1022 | 1023 | for (; i < arguments.length; i++) { 1024 | target = arguments[i]; 1025 | for (key in target) { 1026 | if (Object.prototype.hasOwnProperty.call(target, key)) { 1027 | obj[key] = target[key]; 1028 | } 1029 | } 1030 | } 1031 | 1032 | return obj; 1033 | } 1034 | 1035 | /** 1036 | * Marked 1037 | */ 1038 | 1039 | function marked(src, opt, callback) { 1040 | if (callback || typeof opt === 'function') { 1041 | if (!callback) { 1042 | callback = opt; 1043 | opt = null; 1044 | } 1045 | 1046 | opt = merge({}, marked.defaults, opt || {}); 1047 | 1048 | var highlight = opt.highlight 1049 | , tokens 1050 | , pending 1051 | , i = 0; 1052 | 1053 | try { 1054 | tokens = Lexer.lex(src, opt) 1055 | } catch (e) { 1056 | return callback(e); 1057 | } 1058 | 1059 | pending = tokens.length; 1060 | 1061 | var done = function() { 1062 | var out, err; 1063 | 1064 | try { 1065 | out = Parser.parse(tokens, opt); 1066 | } catch (e) { 1067 | err = e; 1068 | } 1069 | 1070 | opt.highlight = highlight; 1071 | 1072 | return err 1073 | ? callback(err) 1074 | : callback(null, out); 1075 | }; 1076 | 1077 | if (!highlight || highlight.length < 3) { 1078 | return done(); 1079 | } 1080 | 1081 | delete opt.highlight; 1082 | 1083 | if (!pending) return done(); 1084 | 1085 | for (; i < tokens.length; i++) { 1086 | (function(token) { 1087 | if (token.type !== 'code') { 1088 | return --pending || done(); 1089 | } 1090 | return highlight(token.text, token.lang, function(err, code) { 1091 | if (code == null || code === token.text) { 1092 | return --pending || done(); 1093 | } 1094 | token.text = code; 1095 | token.escaped = true; 1096 | --pending || done(); 1097 | }); 1098 | })(tokens[i]); 1099 | } 1100 | 1101 | return; 1102 | } 1103 | try { 1104 | if (opt) opt = merge({}, marked.defaults, opt); 1105 | return Parser.parse(Lexer.lex(src, opt), opt); 1106 | } catch (e) { 1107 | e.message += '\nPlease report this to https://github.com/chjj/marked.'; 1108 | if ((opt || marked.defaults).silent) { 1109 | return 'An error occured:
' 1110 | + escape(e.message + '', true) 1111 | + ''; 1112 | } 1113 | throw e; 1114 | } 1115 | } 1116 | 1117 | /** 1118 | * Options 1119 | */ 1120 | 1121 | marked.options = 1122 | marked.setOptions = function(opt) { 1123 | merge(marked.defaults, opt); 1124 | return marked; 1125 | }; 1126 | 1127 | marked.defaults = { 1128 | gfm: true, 1129 | tables: true, 1130 | breaks: false, 1131 | pedantic: false, 1132 | sanitize: false, 1133 | smartLists: false, 1134 | silent: false, 1135 | highlight: null, 1136 | langPrefix: 'lang-', 1137 | smartypants: false 1138 | }; 1139 | 1140 | /** 1141 | * Expose 1142 | */ 1143 | 1144 | marked.Parser = Parser; 1145 | marked.parser = Parser.parse; 1146 | 1147 | marked.Lexer = Lexer; 1148 | marked.lexer = Lexer.lex; 1149 | 1150 | marked.InlineLexer = InlineLexer; 1151 | marked.inlineLexer = InlineLexer.output; 1152 | 1153 | marked.parse = marked; 1154 | 1155 | if (typeof exports === 'object') { 1156 | module.exports = marked; 1157 | } else if (typeof define === 'function' && define.amd) { 1158 | define(function() { return marked; }); 1159 | } else { 1160 | this.marked = marked; 1161 | } 1162 | 1163 | }).call(function() { 1164 | return this || (typeof window !== 'undefined' ? window : global); 1165 | }()); 1166 | -------------------------------------------------------------------------------- /js/jquery.js: -------------------------------------------------------------------------------- 1 | /*! jQuery v1.9.1 | (c) 2005, 2012 jQuery Foundation, Inc. | jquery.org/license 2 | //@ sourceMappingURL=jquery.min.map 3 | */(function(e,t){var n,r,i=typeof t,o=e.document,a=e.location,s=e.jQuery,u=e.$,l={},c=[],p="1.9.1",f=c.concat,d=c.push,h=c.slice,g=c.indexOf,m=l.toString,y=l.hasOwnProperty,v=p.trim,b=function(e,t){return new b.fn.init(e,t,r)},x=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,w=/\S+/g,T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,N=/^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/,C=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,k=/^[\],:{}\s]*$/,E=/(?:^|:|,)(?:\s*\[)+/g,S=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,A=/"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g,j=/^-ms-/,D=/-([\da-z])/gi,L=function(e,t){return t.toUpperCase()},H=function(e){(o.addEventListener||"load"===e.type||"complete"===o.readyState)&&(q(),b.ready())},q=function(){o.addEventListener?(o.removeEventListener("DOMContentLoaded",H,!1),e.removeEventListener("load",H,!1)):(o.detachEvent("onreadystatechange",H),e.detachEvent("onload",H))};b.fn=b.prototype={jquery:p,constructor:b,init:function(e,n,r){var i,a;if(!e)return this;if("string"==typeof e){if(i="<"===e.charAt(0)&&">"===e.charAt(e.length-1)&&e.length>=3?[null,e,null]:N.exec(e),!i||!i[1]&&n)return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e);if(i[1]){if(n=n instanceof b?n[0]:n,b.merge(this,b.parseHTML(i[1],n&&n.nodeType?n.ownerDocument||n:o,!0)),C.test(i[1])&&b.isPlainObject(n))for(i in n)b.isFunction(this[i])?this[i](n[i]):this.attr(i,n[i]);return this}if(a=o.getElementById(i[2]),a&&a.parentNode){if(a.id!==i[2])return r.find(e);this.length=1,this[0]=a}return this.context=o,this.selector=e,this}return e.nodeType?(this.context=this[0]=e,this.length=1,this):b.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),b.makeArray(e,this))},selector:"",length:0,size:function(){return this.length},toArray:function(){return h.call(this)},get:function(e){return null==e?this.toArray():0>e?this[this.length+e]:this[e]},pushStack:function(e){var t=b.merge(this.constructor(),e);return t.prevObject=this,t.context=this.context,t},each:function(e,t){return b.each(this,e,t)},ready:function(e){return b.ready.promise().done(e),this},slice:function(){return this.pushStack(h.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(0>e?t:0);return this.pushStack(n>=0&&t>n?[this[n]]:[])},map:function(e){return this.pushStack(b.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:d,sort:[].sort,splice:[].splice},b.fn.init.prototype=b.fn,b.extend=b.fn.extend=function(){var e,n,r,i,o,a,s=arguments[0]||{},u=1,l=arguments.length,c=!1;for("boolean"==typeof s&&(c=s,s=arguments[1]||{},u=2),"object"==typeof s||b.isFunction(s)||(s={}),l===u&&(s=this,--u);l>u;u++)if(null!=(o=arguments[u]))for(i in o)e=s[i],r=o[i],s!==r&&(c&&r&&(b.isPlainObject(r)||(n=b.isArray(r)))?(n?(n=!1,a=e&&b.isArray(e)?e:[]):a=e&&b.isPlainObject(e)?e:{},s[i]=b.extend(c,a,r)):r!==t&&(s[i]=r));return s},b.extend({noConflict:function(t){return e.$===b&&(e.$=u),t&&e.jQuery===b&&(e.jQuery=s),b},isReady:!1,readyWait:1,holdReady:function(e){e?b.readyWait++:b.ready(!0)},ready:function(e){if(e===!0?!--b.readyWait:!b.isReady){if(!o.body)return setTimeout(b.ready);b.isReady=!0,e!==!0&&--b.readyWait>0||(n.resolveWith(o,[b]),b.fn.trigger&&b(o).trigger("ready").off("ready"))}},isFunction:function(e){return"function"===b.type(e)},isArray:Array.isArray||function(e){return"array"===b.type(e)},isWindow:function(e){return null!=e&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[m.call(e)]||"object":typeof e},isPlainObject:function(e){if(!e||"object"!==b.type(e)||e.nodeType||b.isWindow(e))return!1;try{if(e.constructor&&!y.call(e,"constructor")&&!y.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||y.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw Error(e)},parseHTML:function(e,t,n){if(!e||"string"!=typeof e)return null;"boolean"==typeof t&&(n=t,t=!1),t=t||o;var r=C.exec(e),i=!n&&[];return r?[t.createElement(r[1])]:(r=b.buildFragment([e],t,i),i&&b(i).remove(),b.merge([],r.childNodes))},parseJSON:function(n){return e.JSON&&e.JSON.parse?e.JSON.parse(n):null===n?n:"string"==typeof n&&(n=b.trim(n),n&&k.test(n.replace(S,"@").replace(A,"]").replace(E,"")))?Function("return "+n)():(b.error("Invalid JSON: "+n),t)},parseXML:function(n){var r,i;if(!n||"string"!=typeof n)return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(o){r=t}return r&&r.documentElement&&!r.getElementsByTagName("parsererror").length||b.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&b.trim(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(j,"ms-").replace(D,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,t,n){var r,i=0,o=e.length,a=M(e);if(n){if(a){for(;o>i;i++)if(r=t.apply(e[i],n),r===!1)break}else for(i in e)if(r=t.apply(e[i],n),r===!1)break}else if(a){for(;o>i;i++)if(r=t.call(e[i],i,e[i]),r===!1)break}else for(i in e)if(r=t.call(e[i],i,e[i]),r===!1)break;return e},trim:v&&!v.call("\ufeff\u00a0")?function(e){return null==e?"":v.call(e)}:function(e){return null==e?"":(e+"").replace(T,"")},makeArray:function(e,t){var n=t||[];return null!=e&&(M(Object(e))?b.merge(n,"string"==typeof e?[e]:e):d.call(n,e)),n},inArray:function(e,t,n){var r;if(t){if(g)return g.call(t,e,n);for(r=t.length,n=n?0>n?Math.max(0,r+n):n:0;r>n;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,o=0;if("number"==typeof r)for(;r>o;o++)e[i++]=n[o];else while(n[o]!==t)e[i++]=n[o++];return e.length=i,e},grep:function(e,t,n){var r,i=[],o=0,a=e.length;for(n=!!n;a>o;o++)r=!!t(e[o],o),n!==r&&i.push(e[o]);return i},map:function(e,t,n){var r,i=0,o=e.length,a=M(e),s=[];if(a)for(;o>i;i++)r=t(e[i],i,n),null!=r&&(s[s.length]=r);else for(i in e)r=t(e[i],i,n),null!=r&&(s[s.length]=r);return f.apply([],s)},guid:1,proxy:function(e,n){var r,i,o;return"string"==typeof n&&(o=e[n],n=e,e=o),b.isFunction(e)?(r=h.call(arguments,2),i=function(){return e.apply(n||this,r.concat(h.call(arguments)))},i.guid=e.guid=e.guid||b.guid++,i):t},access:function(e,n,r,i,o,a,s){var u=0,l=e.length,c=null==r;if("object"===b.type(r)){o=!0;for(u in r)b.access(e,n,u,r[u],!0,a,s)}else if(i!==t&&(o=!0,b.isFunction(i)||(s=!0),c&&(s?(n.call(e,i),n=null):(c=n,n=function(e,t,n){return c.call(b(e),n)})),n))for(;l>u;u++)n(e[u],r,s?i:i.call(e[u],u,n(e[u],r)));return o?e:c?n.call(e):l?n(e[0],r):a},now:function(){return(new Date).getTime()}}),b.ready.promise=function(t){if(!n)if(n=b.Deferred(),"complete"===o.readyState)setTimeout(b.ready);else if(o.addEventListener)o.addEventListener("DOMContentLoaded",H,!1),e.addEventListener("load",H,!1);else{o.attachEvent("onreadystatechange",H),e.attachEvent("onload",H);var r=!1;try{r=null==e.frameElement&&o.documentElement}catch(i){}r&&r.doScroll&&function a(){if(!b.isReady){try{r.doScroll("left")}catch(e){return setTimeout(a,50)}q(),b.ready()}}()}return n.promise(t)},b.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(e,t){l["[object "+t+"]"]=t.toLowerCase()});function M(e){var t=e.length,n=b.type(e);return b.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||"function"!==n&&(0===t||"number"==typeof t&&t>0&&t-1 in e)}r=b(o);var _={};function F(e){var t=_[e]={};return b.each(e.match(w)||[],function(e,n){t[n]=!0}),t}b.Callbacks=function(e){e="string"==typeof e?_[e]||F(e):b.extend({},e);var n,r,i,o,a,s,u=[],l=!e.once&&[],c=function(t){for(r=e.memory&&t,i=!0,a=s||0,s=0,o=u.length,n=!0;u&&o>a;a++)if(u[a].apply(t[0],t[1])===!1&&e.stopOnFalse){r=!1;break}n=!1,u&&(l?l.length&&c(l.shift()):r?u=[]:p.disable())},p={add:function(){if(u){var t=u.length;(function i(t){b.each(t,function(t,n){var r=b.type(n);"function"===r?e.unique&&p.has(n)||u.push(n):n&&n.length&&"string"!==r&&i(n)})})(arguments),n?o=u.length:r&&(s=t,c(r))}return this},remove:function(){return u&&b.each(arguments,function(e,t){var r;while((r=b.inArray(t,u,r))>-1)u.splice(r,1),n&&(o>=r&&o--,a>=r&&a--)}),this},has:function(e){return e?b.inArray(e,u)>-1:!(!u||!u.length)},empty:function(){return u=[],this},disable:function(){return u=l=r=t,this},disabled:function(){return!u},lock:function(){return l=t,r||p.disable(),this},locked:function(){return!l},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],!u||i&&!l||(n?l.push(t):c(t)),this},fire:function(){return p.fireWith(this,arguments),this},fired:function(){return!!i}};return p},b.extend({Deferred:function(e){var t=[["resolve","done",b.Callbacks("once memory"),"resolved"],["reject","fail",b.Callbacks("once memory"),"rejected"],["notify","progress",b.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return b.Deferred(function(n){b.each(t,function(t,o){var a=o[0],s=b.isFunction(e[t])&&e[t];i[o[1]](function(){var e=s&&s.apply(this,arguments);e&&b.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[a+"With"](this===r?n.promise():this,s?[e]:arguments)})}),e=null}).promise()},promise:function(e){return null!=e?b.extend(e,r):r}},i={};return r.pipe=r.then,b.each(t,function(e,o){var a=o[2],s=o[3];r[o[1]]=a.add,s&&a.add(function(){n=s},t[1^e][2].disable,t[2][2].lock),i[o[0]]=function(){return i[o[0]+"With"](this===i?r:this,arguments),this},i[o[0]+"With"]=a.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=h.call(arguments),r=n.length,i=1!==r||e&&b.isFunction(e.promise)?r:0,o=1===i?e:b.Deferred(),a=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?h.call(arguments):r,n===s?o.notifyWith(t,n):--i||o.resolveWith(t,n)}},s,u,l;if(r>1)for(s=Array(r),u=Array(r),l=Array(r);r>t;t++)n[t]&&b.isFunction(n[t].promise)?n[t].promise().done(a(t,l,n)).fail(o.reject).progress(a(t,u,s)):--i;return i||o.resolveWith(l,n),o.promise()}}),b.support=function(){var t,n,r,a,s,u,l,c,p,f,d=o.createElement("div");if(d.setAttribute("className","t"),d.innerHTML="
| t |