elasticlunr
Version:
Lightweight full-text search engine in Javascript for browser search and offline search.
517 lines (493 loc) • 29.2 kB
HTML
<html>
<head>
<meta name="viewport" content="width=device-width" charset="utf-8">
<title>elasticlunr</title>
<link rel="stylesheet" href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css">
<link rel="stylesheet" href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css">
<link rel="stylesheet" href="http://getbootstrap.com/2.3.2/assets/css/docs.css">
<style>
body > .navbar .brand {
float:left;
text-shadow: rgba(255, 255, 255, 0.0980392) 0px 1px 0px, rgba(255, 255, 255, 0.4) 0px 0px 30px;
color: white;
margin-left:0px;
font-weight:normal;
}
.bs-docs-sidenav.affix {
box-shadow: 0 0 20px 1px rgba(0, 0, 0, 0.5);
z-index: 10;
}
.bs-docs-sidenav i{
width: 8px;
height: 8px;
padding: 0px;
margin: 0px;
display: inline-block;
margin-right:0.5em;
}
.bs-docs-sidenav > li > a {
word-wrap: break-word;
}
.bs-docs-sidenav > li:first-child > a {
border-top-right-radius: 6px;
border-top-left-radius: 6px;
}
code[class*="language-"],pre[class*="language-"]{color:black;text-shadow:0 1px white;font-family:Consolas,Monaco,'Andale Mono',monospace;direction:ltr;text-align:left;white-space:pre;word-spacing:normal;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-hyphens:none;-moz-hyphens:none;-ms-hyphens:none;hyphens:none}pre[class*="language-"]{padding:1em;margin:.5em 0;overflow:auto}:not(pre)>code[class*="language-"],pre[class*="language-"]{background:#f5f2f0}:not(pre)>code[class*="language-"]{padding:.1em;border-radius:.3em}.token.comment,.token.prolog,.token.doctype,.token.cdata{color:slategray}.token.punctuation{color:#999}.namespace{opacity:.7}.token.property,.token.tag,.token.boolean,.token.number{color:#905}.token.selector,.token.attr-name,.token.string{color:#690}.token.operator,.token.entity,.token.url,.language-css .token.string,.style .token.string{color:#a67f59;background:hsla(0,0%,100%,.5)}.token.atrule,.token.attr-value,.token.keyword{color:#07a}.token.regex,.token.important{color:#e90}.token.important{font-weight:bold}.token.entity{cursor:help}
div.description {margin: 14px 0; padding-top: 14px; border-bottom:1px solid #eee; }
.tags {}
.ctx-type {
display:inline-block;
margin-right:0.5em;
//- float:right; margin-top:8px
}
footer iframe{vertical-align:middle;}
</style>
</head>
<body data-spy="scroll" data-target=".scrollspy">
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container"><a class="brand">Doxx</a>
<div class="nav-collapse collapse">
<ul class="nav pull-right sponsored"></ul>
</div>
</div>
</div>
</div>
<header id="overview" class="jumbotron subhead">
<div class="container">
<h1>elasticlunr</h1>
<p class="lead"></p>
</div>
</header>
<div class="container">
<div class="row">
<div class="span3 bs-docs-sidebar">
<ul class="nav nav-list bs-docs-sidenav affix-top">
<li><a href="index.html">Main</a></li>
<li><a href="configuration.js.html">configuration.js</a></li>
<li><a href="document_store.js.html">document_store.js</a></li>
<li><a href="elasticlunr.js.html">elasticlunr.js</a></li>
<li><a href="event_emitter.js.html">event_emitter.js</a></li>
<li><a href="index.js.html">index.js</a></li>
<li><a href="inverted_index.js.html">inverted_index.js</a></li>
<li class="active"><a href="pipeline.js.html">pipeline.js</a></li>
<li><a href="sorted_set.js.html">sorted_set.js</a></li>
<li><a href="stemmer.js.html">stemmer.js</a></li>
<li><a href="stop_word_filter.js.html">stop_word_filter.js</a></li>
<li><a href="tokenizer.js.html">tokenizer.js</a></li>
<li><a href="trimmer.js.html">trimmer.js</a></li>
<li><a href="utils.js.html">utils.js</a></li>
</ul>
<div class="scrollspy">
<ul class="nav nav-list bs-docs-sidenav affix-top">
<li><a href="#Pipeline"><i class="alert alert-success"></i><span>Pipeline</span></a>
</li>
<li><a href="#registerFunction"><i class="alert alert-info"></i><span>registerFunction</span></a>
</li>
<li><a href="#getRegisteredFunction"><i class="alert alert-info"></i><span>getRegisteredFunction</span></a>
</li>
<li><a href="#load"><i class="alert alert-info"></i><span>load</span></a>
</li>
<li><a href="#add"><i class="alert alert-info"></i><span>add</span></a>
</li>
<li><a href="#after"><i class="alert alert-info"></i><span>after</span></a>
</li>
<li><a href="#before"><i class="alert alert-info"></i><span>before</span></a>
</li>
<li><a href="#remove"><i class="alert alert-info"></i><span>remove</span></a>
</li>
<li><a href="#run"><i class="alert alert-info"></i><span>run</span></a>
</li>
<li><a href="#reset"><i class="alert alert-info"></i><span>reset</span></a>
</li>
<li><a href="#get"><i class="alert alert-info"></i><span>get</span></a>
</li>
<li><a href="#toJSON"><i class="alert alert-info"></i><span>toJSON</span></a>
</li>
</ul>
</div>
</div>
<div class="span9">
<section id="Pipeline">
<h1>Pipeline</h1>
<h5 class="subheader"></h5>
<p>
<div class="label label-success radius ctx-type">constructor</div><span>elasticlunr.Pipeline()</span>
</p>
</section>
<div class="description"><p>elasticlunr.Pipelines maintain an ordered list of functions to be applied to<br />both documents tokens and query tokens.</p><p>An instance of elasticlunr.Index will contain a pipeline<br />with a trimmer, a stop word filter, an English stemmer. Extra<br />functions can be added before or after either of these functions or these<br />default functions can be removed.</p><p>When run the pipeline, it will call each function in turn.</p><p>The output of the functions in the pipeline will be passed to the next function<br />in the pipeline. To exclude a token from entering the index the function<br />should return undefined, the rest of the pipeline will not be called with<br />this token.</p><p>For serialisation of pipelines to work, all functions used in an instance of<br />a pipeline should be registered with elasticlunr.Pipeline. Registered functions can<br />then be loaded. If trying to load a serialised pipeline that uses functions<br />that are not registered an error will be thrown.</p><p>If not planning on serialising the pipeline then registering pipeline functions<br />is not necessary.</p> </div>
<pre><code class="language-javascript">elasticlunr.Pipeline = function () {
this._queue = [];
};
elasticlunr.Pipeline.registeredFunctions = {};</code></pre>
<section id="registerFunction">
<h1>registerFunction</h1>
<h5 class="subheader"></h5>
<p>
<div class="label label-info radius ctx-type">method</div><span>elasticlunr.Pipeline.registerFunction()</span>
</p>
</section>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width:20%">Option name</th>
<th style="width:20%">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>fn</td>
<td>Function</td>
<td><p>The function to register.</p></td>
</tr>
<tr>
<td>label</td>
<td>String</td>
<td><p>The label to register this function with</p></td>
</tr>
</tbody>
</table>
<div class="description"><p>Register a function in the pipeline.</p><p>Functions that are used in the pipeline should be registered if the pipeline<br />needs to be serialised, or a serialised pipeline needs to be loaded.</p><p>Registering a function does not add it to a pipeline, functions must still be<br />added to instances of the pipeline for them to be used when running a pipeline.</p> </div>
<pre><code class="language-javascript">elasticlunr.Pipeline.registerFunction = function (fn, label) {
if (label in elasticlunr.Pipeline.registeredFunctions) {
elasticlunr.utils.warn('Overwriting existing registered function: ' + label);
}
fn.label = label;
elasticlunr.Pipeline.registeredFunctions[label] = fn;
};</code></pre>
<section id="getRegisteredFunction">
<h1>getRegisteredFunction</h1>
<h5 class="subheader"></h5>
<p>
<div class="label label-info radius ctx-type">method</div><span>elasticlunr.Pipeline.getRegisteredFunction()</span>
</p>
</section>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width:20%">Option name</th>
<th style="width:20%">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>label</td>
<td>String</td>
<td><p>The label of registered function.</p></td>
</tr>
<tr>
<td>return</td>
<td>Function</td>
<td></td>
</tr>
</tbody>
</table>
<div class="description"><p>Get a registered function in the pipeline.</p> </div>
<pre><code class="language-javascript">elasticlunr.Pipeline.getRegisteredFunction = function (label) {
if ((label in elasticlunr.Pipeline.registeredFunctions) !== true) {
return null;
}
return elasticlunr.Pipeline.registeredFunctions[label];
};</code></pre>
<section id="load">
<h1>load</h1>
<h5 class="subheader"></h5>
<p>
<div class="label label-info radius ctx-type">method</div><span>elasticlunr.Pipeline.load()</span>
</p>
</section>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width:20%">Option name</th>
<th style="width:20%">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>serialised</td>
<td>Object</td>
<td><p>The serialised pipeline to load.</p></td>
</tr>
<tr>
<td>return</td>
<td>elasticlunr.Pipeline</td>
<td></td>
</tr>
</tbody>
</table>
<div class="description"><p>Loads a previously serialised pipeline.</p><p>All functions to be loaded must already be registered with elasticlunr.Pipeline.<br />If any function from the serialised data has not been registered then an<br />error will be thrown.</p> </div>
<pre><code class="language-javascript">elasticlunr.Pipeline.load = function (serialised) {
var pipeline = new elasticlunr.Pipeline;
serialised.forEach(function (fnName) {
var fn = elasticlunr.Pipeline.getRegisteredFunction(fnName);
if (fn) {
pipeline.add(fn);
} else {
throw new Error('Cannot load un-registered function: ' + fnName);
}
});
return pipeline;
};</code></pre>
<section id="add">
<h1>add</h1>
<h5 class="subheader"></h5>
<p>
<div class="label label-info radius ctx-type">method</div><span>elasticlunr.Pipeline.prototype.add()</span>
</p>
</section>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width:20%">Option name</th>
<th style="width:20%">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>functions</td>
<td>Function</td>
<td><p>Any number of functions to add to the pipeline.</p></td>
</tr>
</tbody>
</table>
<div class="description"><p>Adds new functions to the end of the pipeline.</p><p>Logs a warning if the function has not been registered.</p> </div>
<pre><code class="language-javascript">elasticlunr.Pipeline.prototype.add = function () {
var fns = Array.prototype.slice.call(arguments);
fns.forEach(function (fn) {
elasticlunr.Pipeline.warnIfFunctionNotRegistered(fn);
this._queue.push(fn);
}, this);
};</code></pre>
<section id="after">
<h1>after</h1>
<h5 class="subheader"></h5>
<p>
<div class="label label-info radius ctx-type">method</div><span>elasticlunr.Pipeline.prototype.after()</span>
</p>
</section>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width:20%">Option name</th>
<th style="width:20%">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>existingFn</td>
<td>Function</td>
<td><p>A function that already exists in the pipeline.</p></td>
</tr>
<tr>
<td>newFn</td>
<td>Function</td>
<td><p>The new function to add to the pipeline.</p></td>
</tr>
</tbody>
</table>
<div class="description"><p>Adds a single function after a function that already exists in the<br />pipeline.</p><p>Logs a warning if the function has not been registered.<br />If existingFn is not found, throw an Exception.</p> </div>
<pre><code class="language-javascript">elasticlunr.Pipeline.prototype.after = function (existingFn, newFn) {
elasticlunr.Pipeline.warnIfFunctionNotRegistered(newFn);
var pos = this._queue.indexOf(existingFn);
if (pos === -1) {
throw new Error('Cannot find existingFn');
}
this._queue.splice(pos + 1, 0, newFn);
};</code></pre>
<section id="before">
<h1>before</h1>
<h5 class="subheader"></h5>
<p>
<div class="label label-info radius ctx-type">method</div><span>elasticlunr.Pipeline.prototype.before()</span>
</p>
</section>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width:20%">Option name</th>
<th style="width:20%">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>existingFn</td>
<td>Function</td>
<td><p>A function that already exists in the pipeline.</p></td>
</tr>
<tr>
<td>newFn</td>
<td>Function</td>
<td><p>The new function to add to the pipeline.</p></td>
</tr>
</tbody>
</table>
<div class="description"><p>Adds a single function before a function that already exists in the<br />pipeline.</p><p>Logs a warning if the function has not been registered.<br />If existingFn is not found, throw an Exception.</p> </div>
<pre><code class="language-javascript">elasticlunr.Pipeline.prototype.before = function (existingFn, newFn) {
elasticlunr.Pipeline.warnIfFunctionNotRegistered(newFn);
var pos = this._queue.indexOf(existingFn);
if (pos === -1) {
throw new Error('Cannot find existingFn');
}
this._queue.splice(pos, 0, newFn);
};</code></pre>
<section id="remove">
<h1>remove</h1>
<h5 class="subheader"></h5>
<p>
<div class="label label-info radius ctx-type">method</div><span>elasticlunr.Pipeline.prototype.remove()</span>
</p>
</section>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width:20%">Option name</th>
<th style="width:20%">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>fn</td>
<td>Function</td>
<td><p>The function to remove from the pipeline.</p></td>
</tr>
</tbody>
</table>
<div class="description"><p>Removes a function from the pipeline.</p> </div>
<pre><code class="language-javascript">elasticlunr.Pipeline.prototype.remove = function (fn) {
var pos = this._queue.indexOf(fn);
if (pos === -1) {
return;
}
this._queue.splice(pos, 1);
};</code></pre>
<section id="run">
<h1>run</h1>
<h5 class="subheader"></h5>
<p>
<div class="label label-info radius ctx-type">method</div><span>elasticlunr.Pipeline.prototype.run()</span>
</p>
</section>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th style="width:20%">Option name</th>
<th style="width:20%">Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>tokens</td>
<td>Array</td>
<td><p>The tokens to run through the pipeline.</p></td>
</tr>
<tr>
<td>return</td>
<td>Array</td>
<td></td>
</tr>
</tbody>
</table>
<div class="description"><p>Runs the current list of functions that registered in the pipeline against the<br />input tokens.</p> </div>
<pre><code class="language-javascript">elasticlunr.Pipeline.prototype.run = function (tokens) {
var out = [],
tokenLength = tokens.length,
pipelineLength = this._queue.length;
for (var i = 0; i < tokenLength; i++) {
var token = tokens[i];
for (var j = 0; j < pipelineLength; j++) {
token = this._queue[j](token, i, tokens);
if (token === void 0 || token === null) break;
};
if (token !== void 0 && token !== null) out.push(token);
};
return out;
};</code></pre>
<section id="reset">
<h1>reset</h1>
<h5 class="subheader"></h5>
<p>
<div class="label label-info radius ctx-type">method</div><span>elasticlunr.Pipeline.prototype.reset()</span>
</p>
</section>
<div class="description"><p>Resets the pipeline by removing any existing processors.</p> </div>
<pre><code class="language-javascript">elasticlunr.Pipeline.prototype.reset = function () {
this._queue = [];
};</code></pre>
<section id="get">
<h1>get</h1>
<h5 class="subheader"></h5>
<p>
<div class="label label-info radius ctx-type">method</div><span>elasticlunr.Pipeline.prototype.get()</span>
</p>
</section>
<div class="description"><p>Get the pipeline if user want to check the pipeline.</p> </div>
<pre><code class="language-javascript">elasticlunr.Pipeline.prototype.get = function () {
return this._queue;
};</code></pre>
<section id="toJSON">
<h1>toJSON</h1>
<h5 class="subheader"></h5>
<p>
<div class="label label-info radius ctx-type">method</div><span>elasticlunr.Pipeline.prototype.toJSON()</span>
</p>
</section>
<div class="description"><p>Returns a representation of the pipeline ready for serialisation.<br />Only serialize pipeline function's name. Not storing function, so when<br />loading the archived JSON index file, corresponding pipeline function is<br />added by registered function of elasticlunr.Pipeline.registeredFunctions</p><p>Logs a warning if the function has not been registered.</p> </div>
<pre><code class="language-javascript">elasticlunr.Pipeline.prototype.toJSON = function () {
return this._queue.map(function (fn) {
elasticlunr.Pipeline.warnIfFunctionNotRegistered(fn);
return fn.label;
});
};</code></pre>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<p>Documentation generated with <a href="https://github.com/FGRibreau/doxx">Doxx </a> created by <a href="https://twitter.com/FGRibreau" data-show-count="false" class="twitter-follow-button">Francois-Guillaume Ribreau </a></p>
<p>Doxx is sponsored by <a href="http://bringr.net/?btt" title="Outil d'analyse des réseaux sociaux" class="bringr">Bringr </a> and <a href="https://redsmin.com/?btt" title="Full Redis GUI" class="redsmin">Redsmin</a></p>
<p>Theme borrowed from Twitter Bootstrap</p>
</div>
</footer>
<script src="http://platform.twitter.com/widgets.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.min.js"></script>
<script src="http://leaverou.github.com/prefixfree/prefixfree.js"></script>
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-transition.js"></script>
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-scrollspy.js"></script>
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-dropdown.js"></script>
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-collapse.js"></script>
<script src="http://getbootstrap.com/2.3.2/assets/js/bootstrap-affix.js"></script>
<script>
/**
* Prism: Lightweight, robust, elegant syntax highlighting
* MIT license http://www.opensource.org/licenses/mit-license.php/
* @author Lea Verou http://lea.verou.me
*/(function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=self.Prism={util:{type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var r={};for(var i in e)e.hasOwnProperty(i)&&(r[i]=t.util.clone(e[i]));return r;case"Array":return e.slice()}return e}},languages:{extend:function(e,n){var r=t.util.clone(t.languages[e]);for(var i in n)r[i]=n[i];return r},insertBefore:function(e,n,r,i){i=i||t.languages;var s=i[e],o={};for(var u in s)if(s.hasOwnProperty(u)){if(u==n)for(var a in r)r.hasOwnProperty(a)&&(o[a]=r[a]);o[u]=s[u]}return i[e]=o},DFS:function(e,n){for(var r in e){n.call(e,r,e[r]);t.util.type(e)==="Object"&&t.languages.DFS(e[r],n)}}},highlightAll:function(e,n){var r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code');for(var i=0,s;s=r[i++];)t.highlightElement(s,e===!0,n)},highlightElement:function(r,i,s){var o,u,a=r;while(a&&!e.test(a.className))a=a.parentNode;if(a){o=(a.className.match(e)||[,""])[1];u=t.languages[o]}if(!u)return;r.className=r.className.replace(e,"").replace(/\s+/g," ")+" language-"+o;a=r.parentNode;/pre/i.test(a.nodeName)&&(a.className=a.className.replace(e,"").replace(/\s+/g," ")+" language-"+o);var f=r.textContent;if(!f)return;f=f.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/\u00a0/g," ");var l={element:r,language:o,grammar:u,code:f};t.hooks.run("before-highlight",l);if(i&&self.Worker){var c=new Worker(t.filename);c.onmessage=function(e){l.highlightedCode=n.stringify(JSON.parse(e.data));l.element.innerHTML=l.highlightedCode;s&&s.call(l.element);t.hooks.run("after-highlight",l)};c.postMessage(JSON.stringify({language:l.language,code:l.code}))}else{l.highlightedCode=t.highlight(l.code,l.grammar);l.element.innerHTML=l.highlightedCode;s&&s.call(r);t.hooks.run("after-highlight",l)}},highlight:function(e,r){return n.stringify(t.tokenize(e,r))},tokenize:function(e,n){var r=t.Token,i=[e],s=n.rest;if(s){for(var o in s)n[o]=s[o];delete n.rest}e:for(var o in n){if(!n.hasOwnProperty(o)||!n[o])continue;var u=n[o],a=u.inside,f=!!u.lookbehind||0;u=u.pattern||u;for(var l=0;l<i.length;l++){var c=i[l];if(i.length>e.length)break e;if(c instanceof r)continue;u.lastIndex=0;var h=u.exec(c);if(h){f&&(f=h[1].length);var p=h.index-1+f,h=h[0].slice(f),d=h.length,v=p+d,m=c.slice(0,p+1),g=c.slice(v+1),y=[l,1];m&&y.push(m);var b=new r(o,a?t.tokenize(h,a):h);y.push(b);g&&y.push(g);Array.prototype.splice.apply(i,y)}}}return i},hooks:{all:{},add:function(e,n){var r=t.hooks.all;r[e]=r[e]||[];r[e].push(n)},run:function(e,n){var r=t.hooks.all[e];if(!r||!r.length)return;for(var i=0,s;s=r[i++];)s(n)}}},n=t.Token=function(e,t){this.type=e;this.content=t};n.stringify=function(e){if(typeof e=="string")return e;if(Object.prototype.toString.call(e)=="[object Array]"){for(var r=0;r<e.length;r++)e[r]=n.stringify(e[r]);return e.join("")}var i={type:e.type,content:n.stringify(e.content),tag:"span",classes:["token",e.type],attributes:{}};i.type=="comment"&&(i.attributes.spellcheck="true");t.hooks.run("wrap",i);var s="";for(var o in i.attributes)s+=o+'="'+(i.attributes[o]||"")+'"';return"<"+i.tag+' class="'+i.classes.join(" ")+'" '+s+">"+i.content+"</"+i.tag+">"};if(!self.document){self.addEventListener("message",function(e){var n=JSON.parse(e.data),r=n.language,i=n.code;self.postMessage(JSON.stringify(t.tokenize(i,t.languages[r])));self.close()},!1);return}var r=document.getElementsByTagName("script");r=r[r.length-1];if(r){t.filename=r.src;document.addEventListener&&!r.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)}})();;
Prism.languages.markup={comment:/<!--[\w\W]*?--(>|>)/g,prolog:/<\?.+?\?>/,doctype:/<!DOCTYPE.+?>/,cdata:/<!\[CDATA\[[\w\W]+?]]>/i,tag:{pattern:/<\/?[\w:-]+\s*(?:\s+[\w:-]+(?:=(?:("|')(\\?[\w\W])*?\1|\w+))?\s*)*\/?>/gi,inside:{tag:{pattern:/^<\/?[\w:-]+/i,inside:{punctuation:/^<\/?/,namespace:/^[\w-]+?:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/gi,inside:{punctuation:/=|>|"/g}},punctuation:/\/?>/g,"attr-name":{pattern:/[\w:-]+/g,inside:{namespace:/^[\w-]+?:/}}}},entity:/&#?[\da-z]{1,8};/gi};Prism.hooks.add("wrap",function(e){e.type==="entity"&&(e.attributes.title=e.content.replace(/&/,"&"))});;
Prism.languages.css={comment:/\/\*[\w\W]*?\*\//g,atrule:/@[\w-]+?(\s+[^;{]+)?(?=\s*{|\s*;)/gi,url:/url\((["']?).*?\1\)/gi,selector:/[^\{\}\s][^\{\}]*(?=\s*\{)/g,property:/(\b|\B)[a-z-]+(?=\s*:)/ig,string:/("|')(\\?.)*?\1/g,important:/\B!important\b/gi,ignore:/&(lt|gt|amp);/gi,punctuation:/[\{\};:]/g};Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<|<)style[\w\W]*?(>|>)[\w\W]*?(<|<)\/style(>|>)/ig,inside:{tag:{pattern:/(<|<)style[\w\W]*?(>|>)|(<|<)\/style(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.css}}});;
Prism.languages.clike={comment:{pattern:/(^|[^\\])(\/\*[\w\W]*?\*\/|\/\/.*?(\r?\n|$))/g,lookbehind:!0},string:/("|')(\\?.)*?\1/g,keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|catch|finally|null|break|continue)\b/g,"boolean":/\b(true|false)\b/g,number:/\b-?(0x)?\d*\.?[\da-f]+\b/g,operator:/[-+]{1,2}|!|=?<|=?>|={1,2}|(&){1,2}|\|?\||\?|\*|\//g,ignore:/&(lt|gt|amp);/gi,punctuation:/[{}[\];(),.:]/g};;
Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(var|let|if|else|while|do|for|return|in|instanceof|function|new|with|typeof|try|catch|finally|null|break|continue)\b/g,number:/\b(-?(0x)?\d*\.?[\da-f]+|NaN|-?Infinity)\b/g});Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/g,lookbehind:!0}});Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<|<)script[\w\W]*?(>|>)[\w\W]*?(<|<)\/script(>|>)/ig,inside:{tag:{pattern:/(<|<)script[\w\W]*?(>|>)|(<|<)\/script(>|>)/ig,inside:Prism.languages.markup.tag.inside},rest:Prism.languages.javascript}}});;
</script>
<!-- App js-->
<script>
$(function(){
var $window = $(window);
$('.scrollspy .nav').affix({
offset: {
top: function () { return $window.width() <= 980 ? 480 : 400 }
, bottom: 50
}
});
})
</script>
</body>
</html>