commit
2843c77720
114 changed files with 10249 additions and 0 deletions
@ -0,0 +1,51 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
|||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="$language$" lang="$language$"> |
|||
<head> |
|||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
|||
<title>$title$</title> |
|||
<link rel="shortcut icon" type="image/x-icon" href="img/favicon.ico" /> |
|||
<link rel="stylesheet" type="text/css" href="css/scientific.css" /> |
|||
<link rel="stylesheet" type="text/css" href="css/solarized.css" /> |
|||
<!-- Font --> |
|||
<link href='http://fonts.googleapis.com/css?family=Inconsolata' rel='stylesheet' type='text/css'> |
|||
<link href='http://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'> |
|||
<link rel="alternate" type="application/rss+xml" title="RSS" href="http://feeds.feedburner.com/yannespositocom$language$"/> |
|||
<!--[if lt IE 9]> |
|||
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta4)/IE9.js"></script> |
|||
<![endif]--> |
|||
</head> |
|||
<body lang="$language$"> |
|||
<div id="content"> |
|||
<div id="titre"> |
|||
<h1>$title$</h1> |
|||
</div> |
|||
<div id="afterheader" class="article"> |
|||
<div class="corps"> |
|||
$body$ |
|||
</div> |
|||
<div id="bottom"> |
|||
<div> |
|||
Published on $date$ |
|||
</div> |
|||
<div> |
|||
<a href="https://twitter.com/yogsototh">Follow @yogsototh</a> |
|||
</div> |
|||
<div> |
|||
<a rel="license" href="http://creativecommons.org/licenses/by/3.0/deed.en_US">Yann Espositoยฉ</a> |
|||
</div> |
|||
<div> |
|||
Done with static-pandoc-template |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</body> |
|||
<script type="text/javascript" src="js/jquery-1.3.1.min.js"></script> |
|||
<script type="text/javascript" src="js/jquery.cookie.js"></script> |
|||
<script type="text/javascript" src="js/index.js"></script> |
|||
<script type="text/javascript" src="js/highlight/highlight.pack.js"></script> |
|||
<script type="text/javascript" src="js/article.js"></script> |
|||
<script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script> |
|||
</html> |
@ -0,0 +1 @@ |
|||
pre, code, a.cut{font-family:"cmuntt", Incosolata, Monaco, monospace}body{font-family:"ComputerModern", Georgia, Palatino, "Century Schoolbook L", "Times New Roman", Times, serif} |
@ -0,0 +1 @@ |
|||
@font-face{font-family:"cmuntt";src:url("fonts/cmuntt.eot");src:local("โบ"), url("fonts/cmuntt.svg") format("svg"), url("fonts/cmuntt.ttf") format("truetype");font-weight:normal;font-style:normal}@font-face{font-family:"ComputerModern";src:url("fonts/cmunrb.eot");src:local("โบ"), url("fonts/cmunrb.svg") format("svg"), url("fonts/cmunrb.ttf") format("truetype");font-weight:bold}@font-face{font-family:"ComputerModern";src:url("fonts/cmunsl.eot");src:local("โบ"), url("fonts/cmunsl.svg") format("svg"), url("fonts/cmunsl.ttf") format("truetype");font-style:italic, oblique}@font-face{font-family:"ComputerModern";src:url("fonts/cmunrm.eot");src:local("โบ"), url("fonts/cmunrm.svg") format("svg"), url("fonts/cmunrm.ttf") format("truetype");font-weight:normal;font-style:normal} |
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
|||
*{transition-property:all;transition-duration:0.5s;-moz-transition-property:all;-moz-transition-duration:0.5s;-webkit-transition-property:all;-webkit-transition-duration:0.5s;-o-transition-property:all;-o-transition-duration:0.5s}#social *, #comment *{transition-property:all;transition-duration:0s;-moz-transition-property:all;-moz-transition-duration:0s;-webkit-transition-property:all;-webkit-transition-duration:0s;-o-transition-property:all;-o-transition-duration:0s} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@ |
|||
pre{padding:0.8em;background:#f3f4f5;color:#657b83;color:#839496;display:block}pre .high0{color:#586e75}pre .high, pre .high1{color:#073642}pre .high2{color:#002b36}pre .DiffInserted, pre .DiffChanged, pre .DiffHeader, pre .DiffDeleted, pre .EmbeddedSource, pre .EmbeddedSourceBright{color:#839496}pre .DiffHeader{font-style:italic}pre .EmbeddedSource, pre .EmbeddedSourceBright{background-color:#073642}pre .low, pre .line-numbers, pre .DoctypeXmlProcessing{color:#586e75}pre .Comment{color:#586e75;font-style:italic}pre .yellow, pre .CssClass, pre .CssPropertyName, pre .Entity, pre .MarkupList{color:#b58900}pre .EntityInheritedClass{color:#b58900;font-style:italic}pre .orange, pre .String, pre .StringRegexp, pre .StringEmbeddedSource, pre .StringConstant, pre .MetaTagAll{color:#cb4b16}pre .red{color:#dc322f}pre .InvalidIllegal, pre .CssAtRule, pre .InvalidDeprecated{color:#dc322f;font-style:italic}pre .magenta, pre .CCCPreprocessorLine, pre .CCCPreprocessorDirective{color:#d33682}pre .violet, pre .Constant{color:#6c71c4}pre .blue, pre .Storage, pre .Variable, pre .CssId, pre .SupportFunction, pre .MetaTagInline, pre .StringRegexpSpecial, pre .CssTagName, pre .StringVariable, pre .Support{color:#268bd2}pre .cyan, pre .MarkupHeading, pre .CssAdditionalConstants, pre .CssPropertyValue, pre .SupportConstant{color:#2aa198}pre .green, pre .CssPseudoClass, pre .Keyword, pre .CssConstructorArgument{color:#859900}pre code{color:#657b83;background-color:#f3f4f5}pre .comment, pre .template_comment, pre .diff .header, pre .doctype, pre .lisp .string, pre .javadoc{color:#93a1a1;font-style:italic}pre .keyword, pre .css .rule .keyword, pre .winutils, pre .javascript .title, pre .method, pre .addition, pre .css .tag, pre .lisp .title{color:#859900}pre .number, pre .command, pre .string, pre .tag .value, pre .phpdoc, pre .tex .formula, pre .regexp, pre .hexcolor{color:#2aa198}pre .title, pre .localvars, pre .function .title, pre .chunk, pre .decorator, pre .builtin, pre .built_in, pre .lisp .title, pre .identifier, pre .title .keymethods, pre .id{color:#268bd2}pre .attribute, pre .variable, pre .instancevar, pre .lisp .body, pre .smalltalk .number, pre .constant, pre .class .title, pre .parent, pre .haskell .label{color:#b58900}pre .preprocessor, pre .pi, pre .shebang, pre .symbol, pre .diff .change, pre .special, pre .keymethods, pre .attr_selector, pre .important, pre .subst, pre .cdata{color:#cb4b16}pre .deletion{color:#dc322f}pre .tex .formula{background:#eee8d5} |
After Width: | Height: | Size: 1.4 KiB |
@ -0,0 +1,3 @@ |
|||
$(document).ready( function() { |
|||
hljs.initHighlighting(); |
|||
}); |
@ -0,0 +1,33 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
|||
theme: scientific |
|||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
|||
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr"> |
|||
<head> |
|||
<script type="text/javascript" src="/Scratch/js/jquery-1.3.1.min.js"></script> |
|||
<script type="text/javascript" src="/Scratch/js/jquery.cookie.js"></script> |
|||
<script> |
|||
$(document).ready(function(){ |
|||
$.cookie('admin',1, { path: '/Scratch'}); |
|||
$('#info').html('Analytics can no more see you.') |
|||
}); |
|||
</script> |
|||
<title>Hide to analytics</title> |
|||
</head> |
|||
<body lang="fr"> |
|||
<div id="content"> |
|||
<div id="titre"> |
|||
<h1> |
|||
Hide to Analytics |
|||
</h1> |
|||
</div> |
|||
<div class="flush"></div> |
|||
<div id="afterheader"> |
|||
<div class="corps"> |
|||
<div id="info"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</body> |
|||
</html> |
@ -0,0 +1,33 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" |
|||
theme: scientific |
|||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
|||
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="fr"> |
|||
<head> |
|||
<script type="text/javascript" src="/Scratch/js/jquery-1.3.1.min.js"></script> |
|||
<script type="text/javascript" src="/Scratch/js/jquery.cookie.js"></script> |
|||
<script> |
|||
$(document).ready(function(){ |
|||
$.cookie('admin',null, { path: '/Scratch'}); |
|||
$('#info').html('Analytics can see you.') |
|||
}); |
|||
</script> |
|||
<title>Be visible to analytics</title> |
|||
</head> |
|||
<body lang="fr"> |
|||
<div id="content"> |
|||
<div id="titre"> |
|||
<h1> |
|||
Be visible to Analytics |
|||
</h1> |
|||
</div> |
|||
<div class="flush"></div> |
|||
<div id="afterheader"> |
|||
<div class="corps"> |
|||
<div id="info"> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</body> |
|||
</html> |
@ -0,0 +1,23 @@ |
|||
if(document.getElementById("IDCommentsPostTitle") && document.getElementById("IDCommentsPostTitle").innerHTML.length>0) |
|||
idcomments_post_title = document.getElementById("IDCommentsPostTitle").innerHTML; |
|||
else |
|||
idcomments_post_title = document.title; |
|||
if(idcomments_post_title.length==0) |
|||
idcomments_post_title = "Post"; |
|||
|
|||
idcomments_post_title = idcomments_post_title.replace(/#/, "%23"); |
|||
|
|||
if(null==idcomments_post_url || idcomments_post_url==='') |
|||
idcomments_post_url = window.location.href; |
|||
if(null==idcomments_post_id) |
|||
idcomments_post_id = window.location.href; |
|||
idcomments_post_id = encodeURIComponent(idcomments_post_id); |
|||
idcomments_post_url = encodeURIComponent(idcomments_post_url); |
|||
idcomments_post_title = encodeURIComponent(idcomments_post_title); |
|||
var commentScript = document.createElement("script"); |
|||
commentScript.type = "text/javascript"; |
|||
commentScript.src = "http://intensedebate.com/js/genericCommentWrapper2.php?acct="+idcomments_acct+"&postid="+idcomments_post_id+"&title="+idcomments_post_title+"&url="+idcomments_post_url; |
|||
|
|||
$(document).ready( function() { |
|||
document.getElementsByTagName("head")[0].appendChild(commentScript); |
|||
}); |
@ -0,0 +1,55 @@ |
|||
Syntax highlighting with language autodetection. |
|||
|
|||
URL: http://softwaremaniacs.org/soft/highlight/en/ |
|||
|
|||
Original author and current maintainer: |
|||
Ivan Sagalaev <maniac@softwaremaniacs.org> |
|||
|
|||
Contributors: |
|||
|
|||
- Peter Leonov <gojpeg@gmail.com> |
|||
- Victor Karamzin <Victor.Karamzin@enterra-inc.com> |
|||
- Vsevolod Solovyov <vsevolod.solovyov@gmail.com> |
|||
- Anton Kovalyov <anton@kovalyov.net> |
|||
- Nikita Ledyaev <lenikita@yandex.ru> |
|||
- Konstantin Evdokimenko <qewerty@gmail.com> |
|||
- Dmitri Roudakov <dmitri@roudakov.ru> |
|||
- Yuri Ivanov <ivanov@supersoft.ru> |
|||
- Vladimir Ermakov <vooon341@mail.ru> |
|||
- Vladimir Gubarkov <xonixx@gmail.com> |
|||
- Brian Beck <exogen@gmail.com> |
|||
- MajestiC <majestic2k@gmail.com> |
|||
- Vasily Polovnyov <vast@whiteants.net> |
|||
- Vladimir Epifanov <voldmar@voldmar.ru> |
|||
- Alexander Makarov (http://rmcreative.ru/) |
|||
- Vah <vahtenberg@gmail.com> |
|||
- Shuen-Huei Guan <drake.guan@gmail.com> |
|||
- Jason Diamond <jason@diamond.name> |
|||
- Michal Gabrukiewicz <mgabru@gmail.com> |
|||
- Ruslan Keba <rukeba@gmail.com> |
|||
- Sergey Baranov <segyrn@yandex.ru> |
|||
- Zaripov Yura <yur4ik7@ukr.net> |
|||
- Oleg Volchkov <oleg@volchkov.net> |
|||
- Vasily Mikhailitchenko <vaskas@programica.ru> |
|||
- Jan Berkel <jan.berkel@gmail.com> |
|||
- Vladimir Moskva <vladmos@gmail.com> |
|||
- Loren Segal <lsegal@soen.ca> |
|||
- Andrew Fedorov <dmmdrs@mail.ru> |
|||
- Igor Kalnitsky <igor.kalnitsky@gmail.com> |
|||
- Jeremy Hull <sourdrums@gmail.com> |
|||
- Valerii Hiora <valerii.hiora@gmail.com> |
|||
- Nikolay Zakharov <nikolay.desh@gmail.com> |
|||
- Dmitry Kovega <arhibot@gmail.com> |
|||
- Sergey Ignatov <sergey@ignatov.spb.su> |
|||
- Antono Vasiljev <self@antono.info> |
|||
- Stephan Kountso <steplg@gmail.com> |
|||
- pumbur <pumbur@pumbur.net> |
|||
- John Crepezzi <john.crepezzi@gmail.com> |
|||
- Andrey Vlasovskikh <andrey.vlasovskikh@gmail.com> |
|||
- Alexander Myadzel <myadzel@gmail.com> |
|||
- Evgeny Stepanischev <imbolk@gmail.com> |
|||
- Dmytrii Nagirniak <dnagir@gmail.com> |
|||
- Oleg Efimov <efimovov@gmail.com> |
|||
- Luigi Maselli <grigio.org@gmail.com> |
|||
- Denis Bardadym <bardadymchik@gmail.com> |
|||
- Aahan Krish <geekpanth3r@gmail.com> |
@ -0,0 +1,55 @@ |
|||
ะะพะดัะฒะตัะบะฐ ัะธะฝัะฐะบัะธัะฐ ั ะฐะฒัะพะพะฟัะตะดะตะปะตะฝะธะตะผ ัะทัะบะฐ. |
|||
|
|||
URL: http://softwaremaniacs.org/soft/highlight/ |
|||
|
|||
ะะตัะฒะพะฝะฐัะฐะปัะฝัะน ะฐะฒัะพั ะธ ะฒะตะดััะธะน ะฟัะพะตะบัะฐ: |
|||
ะะฒะฐะฝ ะกะฐะณะฐะปะฐะตะฒ <maniac@softwaremaniacs.org> |
|||
|
|||
ะะฝะตัะปะธ ัะฒะพะน ะฒะบะปะฐะด: |
|||
|
|||
- ะะตัั ะะตะพะฝะพะฒ <gojpeg@gmail.com> |
|||
- ะะธะบัะพั ะะฐัะฐะผะทะธะฝ <Victor.Karamzin@enterra-inc.com> |
|||
- ะัะตะฒะพะปะพะด ะกะพะปะพะฒััะฒ <vsevolod.solovyov@gmail.com> |
|||
- ะะฝัะพะฝ ะะพะฒะฐะปัะฒ <anton@kovalyov.net> |
|||
- ะะธะบะธัะฐ ะะตะดัะตะฒ <lenikita@yandex.ru> |
|||
- ะะพะฝััะฐะฝัะธะฝ ะะฒะดะพะบะธะผะตะฝะบะพ <qewerty@gmail.com> |
|||
- ะะผะธััะธะน ะ ัะดะฐะบะพะฒ <dmitri@roudakov.ru> |
|||
- ะฎัะธะน ะะฒะฐะฝะพะฒ <ivanov@supersoft.ru> |
|||
- ะะปะฐะดะธะผะธั ะัะผะฐะบะพะฒ <vooon341@mail.ru> |
|||
- ะะปะฐะดะธะผะธั ะัะฑะฐััะบะพะฒ <xonixx@gmail.com> |
|||
- ะัะฐะนะฐะฝ ะะตะบ <exogen@gmail.com> |
|||
- MajestiC <majestic2k@gmail.com> |
|||
- ะะฐัะธะปะธะน ะะพะปะพะฒะฝัะฒ <vast@whiteants.net> |
|||
- ะะปะฐะดะธะผะธั ะะฟะธัะฐะฝะพะฒ <voldmar@voldmar.ru> |
|||
- ะะปะตะบัะฐะฝะดั ะะฐะบะฐัะพะฒ (http://rmcreative.ru/) |
|||
- Vah <vahtenberg@gmail.com> |
|||
- ะจััะฝ-ะฅััะน ะัะฐะฝ <drake.guan@gmail.com> |
|||
- ะะถะตะนัะพะฝ ะะฐะนะผะพะฝะด <jason@diamond.name> |
|||
- ะะธั
ะฐะป ะะฐะฑััะบะตะฒะธั <mgabru@gmail.com> |
|||
- ะ ััะปะฐะฝ ะะตะฑะฐ <rukeba@gmail.com> |
|||
- ะกะตัะณะตะน ะะฐัะฐะฝะพะฒ <segyrn@yandex.ru> |
|||
- ะะฐัะธะฟะพะฒ ะฎัะฐ <yur4ik7@ukr.net> |
|||
- ะะปะตะณ ะะพะปัะบะพะฒ <oleg@volchkov.net> |
|||
- ะะฐัะธะปะธะน ะะธั
ะฐะนะปะธัะตะฝะบะพ <vaskas@programica.ru> |
|||
- ะฏะฝ ะะตัะบะตะปั <jan.berkel@gmail.com> |
|||
- ะะปะฐะดะธะผะธั ะะพัะบะฒะฐ <vladmos@gmail.com> |
|||
- ะะพัะตะฝ ะกะตะณะฐะป <lsegal@soen.ca> |
|||
- ะะฝะดัะตะน ะคัะดะพัะพะฒ <dmmdrs@mail.ru> |
|||
- ะะณะพัั ะะฐะปัะฝะธัะบะธะน <igor.kalnitsky@gmail.com> |
|||
- ะะถะตัะตะผะธ ะฅะฐะปะป <sourdrums@gmail.com> |
|||
- ะะฐะปะตัะธะน ะฅะธะพัะฐ <valerii.hiora@gmail.com> |
|||
- ะะธะบะพะปะฐะน ะะฐั
ะฐัะพะฒ <nikolay.desh@gmail.com> |
|||
- ะะผะธััะธะน ะะพะฒะตะณะฐ <arhibot@gmail.com> |
|||
- ะกะตัะณะตะน ะะณะฝะฐัะพะฒ <sergey@ignatov.spb.su> |
|||
- ะะฝัะพะฝะพ ะะฐัะธะปัะตะฒ <self@antono.info> |
|||
- ะกัะตะฟะฐะฝ ะัะฝััะพ <steplg@gmail.com> |
|||
- pumbur <pumbur@pumbur.net> |
|||
- ะะถะพะฝ ะัะตะฟะตััะธ <john.crepezzi@gmail.com> |
|||
- ะะฝะดัะตะน ะะปะฐัะพะฒัะบะธั
<andrey.vlasovskikh@gmail.com> |
|||
- ะะปะตะบัะฐะฝะดั ะัะดะทะตะปั <myadzel@gmail.com> |
|||
- ะะฒะณะตะฝะธะน ะกัะตะฟะฐะฝะธัะตะฒ <imbolk@gmail.com> |
|||
- ะะผะธััะธะน ะะฐะณะธัะฝัะบ <dnagir@gmail.com> |
|||
- ะะปะตะณ ะัะธะผะพะฒ <efimovov@gmail.com> |
|||
- ะัะธะดะถะธ ะะฐะทะตะปะปะธ <grigio.org@gmail.com> |
|||
- ะะตะฝะธั ะะฐัะดะฐะดัะผ <bardadymchik@gmail.com> |
|||
- ะะฐั
ะฐะฝ ะัะธั <geekpanth3r@gmail.com> |
@ -0,0 +1,24 @@ |
|||
Copyright (c) 2006, Ivan Sagalaev |
|||
All rights reserved. |
|||
Redistribution and use in source and binary forms, with or without |
|||
modification, are permitted provided that the following conditions are met: |
|||
|
|||
* Redistributions of source code must retain the above copyright |
|||
notice, this list of conditions and the following disclaimer. |
|||
* Redistributions in binary form must reproduce the above copyright |
|||
notice, this list of conditions and the following disclaimer in the |
|||
documentation and/or other materials provided with the distribution. |
|||
* Neither the name of highlight.js nor the names of its contributors |
|||
may be used to endorse or promote products derived from this software |
|||
without specific prior written permission. |
|||
|
|||
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY |
|||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|||
DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY |
|||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
|||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
|||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
@ -0,0 +1,140 @@ |
|||
# Highlight.js |
|||
|
|||
theme: scientific |
|||
Highlight.js highlights syntax in code examples on blogs, forums and, |
|||
in fact, on any web page. It's very easy to use because it works |
|||
automatically: finds blocks of code, detects a language, highlights it. |
|||
|
|||
Autodetection can be fine tuned when it fails by itself (see "Heuristics"). |
|||
|
|||
|
|||
## Installation and usage |
|||
|
|||
The download package includes the file "highlight.pack.js" which is a full |
|||
compressed version of the library intended for use in production. All |
|||
uncompressed source files are also available, feel free to look into them! |
|||
|
|||
The script is installed by linking to a single file and making a single |
|||
initialization call: |
|||
|
|||
```html |
|||
<script type="text/javascript" src="highlight.pack.js"></script> |
|||
<script type="text/javascript"> |
|||
hljs.initHighlightingOnLoad(); |
|||
</script> |
|||
``` |
|||
|
|||
Also you can replace TAB ('\x09') characters used for indentation in your code |
|||
with some fixed number of spaces or with a `<span>` to give them special |
|||
styling: |
|||
|
|||
```html |
|||
<script type="text/javascript"> |
|||
hljs.tabReplace = ' '; // 4 spaces |
|||
// ... or |
|||
hljs.tabReplace = '<span class="indent">\t</span>'; |
|||
|
|||
hljs.initHighlightingOnLoad(); |
|||
</script> |
|||
``` |
|||
|
|||
The script looks in your page for fragments `<pre><code>...</code></pre>` |
|||
that are traditionally used to mark up code examples. Their content is |
|||
marked up by logical pieces with defined class names. |
|||
|
|||
|
|||
### Custom initialization |
|||
|
|||
If you use different markup for code blocks you can initialize them manually |
|||
with `highlightBlock(code, tabReplace)` function. It takes a DOM element |
|||
containing the code to highlight and optionally a string with which to replace |
|||
TAB characters. |
|||
|
|||
Initialization using, for example, jQuery might look like this: |
|||
|
|||
```javascript |
|||
$(document).ready(function() { |
|||
$('pre code').each(function(i, e) {hljs.highlightBlock(e, ' ')}); |
|||
}); |
|||
``` |
|||
|
|||
If your code container relies on `<br>` tags instead of line breaks (i.e. if |
|||
it's not `<pre>`) pass `true` into third parameter of `highlightBlock`: |
|||
|
|||
```javascript |
|||
$('div.code').each(function(i, e) {hljs.highlightBlock(e, null, true)}); |
|||
``` |
|||
|
|||
### Styling |
|||
|
|||
Elements of code marked up with classes can be styled as desired: |
|||
|
|||
```css |
|||
.comment { |
|||
color: gray; |
|||
} |
|||
|
|||
.keyword { |
|||
font-weight: bold; |
|||
} |
|||
|
|||
.python .string { |
|||
color: blue; |
|||
} |
|||
|
|||
.html .atribute .value { |
|||
color: green; |
|||
} |
|||
``` |
|||
|
|||
Highlight.js comes with several style themes located in "styles" directory that |
|||
can be used directly or as a base for your own experiments. |
|||
|
|||
**Note**: provided styles work for code defined inside `<pre>` blocks. If you use |
|||
custom markup you should modify styles accordingly. |
|||
|
|||
For full reference list of classes see [classref.txt][cr]. |
|||
|
|||
[cr]: http://github.com/isagalaev/highlight.js/blob/master/classref.txt |
|||
|
|||
|
|||
## Export |
|||
|
|||
File export.html contains a little program that allows you to paste in a code |
|||
snippet and then copy and paste the resulting HTML code generated by the |
|||
highlighter. This is useful in situations when you can't use the script itself |
|||
on a site. |
|||
|
|||
|
|||
## Heuristics |
|||
|
|||
Autodetection of a code's language is done using a simple heuristic: |
|||
the program tries to highlight a fragment with all available languages and |
|||
counts all syntactic structures that it finds along the way. The language |
|||
with greatest count wins. |
|||
|
|||
This means that in short fragments the probability of an error is high |
|||
(and it really happens sometimes). In this cases you can set the fragment's |
|||
language explicitly by assigning a class to the `<code>` element: |
|||
|
|||
```html |
|||
<pre><code class="html">...</code></pre> |
|||
``` |
|||
|
|||
You can use class names recommended in HTML5: "language-html", |
|||
"language-php". Classes also can be assigned to the `<pre>` element. |
|||
|
|||
To disable highlighting of a fragment altogether use "no-highlight" class: |
|||
|
|||
```html |
|||
<pre><code class="no-highlight">...</code></pre> |
|||
``` |
|||
|
|||
## Meta |
|||
|
|||
- Version: 6.2 |
|||
- URL: http://softwaremaniacs.org/soft/highlight/en/ |
|||
- Author: Ivan Sagalaev (<maniac@softwaremaniacs.org>) |
|||
|
|||
For the license terms see LICENSE files. |
|||
For the list of contributors see AUTHORS.en.txt file. |
@ -0,0 +1,145 @@ |
|||
# Highlight.js |
|||
|
|||
theme: scientific |
|||
Highlight.js ะฝัะถะตะฝ ะดะปั ะฟะพะดัะฒะตัะบะธ ัะธะฝัะฐะบัะธัะฐ ะฒ ะฟัะธะผะตัะฐั
ะบะพะดะฐ ะฒ ะฑะปะพะณะฐั
, |
|||
ัะพััะผะฐั
ะธ ะฒะพะพะฑัะต ะฝะฐ ะปัะฑัั
ะฒะตะฑ-ัััะฐะฝะธัะฐั
. ะะพะปัะทะพะฒะฐัััั ะธะผ ะพัะตะฝั ะฟัะพััะพ, |
|||
ะฟะพัะพะผั ััะพ ัะฐะฑะพัะฐะตั ะพะฝ ะฐะฒัะพะผะฐัะธัะตัะบะธ: ัะฐะผ ะฝะฐั
ะพะดะธั ะฑะปะพะบะธ ะบะพะดะฐ, ัะฐะผ |
|||
ะพะฟัะตะดะตะปัะตั ัะทัะบ, ัะฐะผ ะฟะพะดัะฒะตัะธะฒะฐะตั. |
|||
|
|||
ะะฒัะพะพะฟัะตะดะตะปะตะฝะธะตะผ ัะทัะบะฐ ะผะพะถะฝะพ ัะฟัะฐะฒะปััั, ะบะพะณะดะฐ ะพะฝะพ ะฝะต ัะฟัะฐะฒะปัะตััั ัะฐะผะพ (ัะผ. |
|||
ะดะฐะปััะต "ะญะฒัะธััะธะบะฐ"). |
|||
|
|||
|
|||
## ะะพะดะบะปััะตะฝะธะต ะธ ะธัะฟะพะปัะทะพะฒะฐะฝะธะต |
|||
|
|||
ะ ะทะฐะณััะถะตะฝะฝะพะผ ะฐัั
ะธะฒะต ะปะตะถะธั ัะฐะนะป "highlight.pack.js" -- ะฟะพะปะฝะฐั ัะถะฐัะฐั ะฒะตััะธั |
|||
ะฑะธะฑะปะธะพัะตะบะธ ะดะปั ัะฐะฑะพัั. ะัะต ะฝะตัะถะฐััะต ะธัั
ะพะดะฝัะต ัะฐะนะปั ัะฐะบะถะต ะตััั ะฒ ะฟะฐะบะตัะต, ะฟะพััะพะผั |
|||
ะฝะต ััะตัะฝัะนัะตัั ะฒ ะฝะธั
ัะผะพััะตัั! |
|||
|
|||
ะกะบัะธะฟั ะฟะพะดะบะปััะฐะตััั ะพะดะฝะธะผ ัะฐะนะปะพะผ ะธ ะพะดะฝะธะผ ะฒัะทะพะฒะพะผ ะธะฝะธัะธะฐะปะธะทะธััััะตะน |
|||
ััะฝะบัะธะธ: |
|||
|
|||
```html |
|||
<script type="text/javascript" src="highlight.pack.js"></script> |
|||
<script type="text/javascript"> |
|||
hljs.initHighlightingOnLoad(); |
|||
</script> |
|||
``` |
|||
|
|||
ะขะฐะบะถะต ะฒั ะผะพะถะตัะต ะทะฐะผะตะฝะธัั ัะธะผะฒะพะปั TAB ('\x09'), ะธัะฟะพะปัะทัะตะผัะต ะดะปั ะพััััะฟะพะฒ, ะฝะฐ |
|||
ัะธะบัะธัะพะฒะฐะฝะฝะพะต ะบะพะปะธัะตััะฒะพ ะฟัะพะฑะตะปะพะฒ ะธะปะธ ะฝะฐ ะพัะดะตะปัะฝัะน `<span>`, ััะพะฑั ะทะฐะดะฐัั ะตะผั |
|||
ะบะฐะบะพะน-ะฝะธะฑัะดั ัะฟะตัะธะฐะปัะฝัะน ััะธะปั: |
|||
|
|||
```html |
|||
<script type="text/javascript"> |
|||
hljs.tabReplace = ' '; // 4 spaces |
|||
// ... or |
|||
hljs.tabReplace = '<span class="indent">\t</span>'; |
|||
|
|||
hljs.initHighlightingOnLoad(); |
|||
</script> |
|||
``` |
|||
|
|||
ะะฐะปััะต ัะบัะธะฟั ะธัะตั ะฝะฐ ัััะฐะฝะธัะต ะบะพะฝััััะบัะธะธ `<pre><code>...</code></pre>`, |
|||
ะบะพัะพััะต ััะฐะดะธัะธะพะฝะฝะพ ะธัะฟะพะปัะทััััั ะดะปั ะฝะฐะฟะธัะฐะฝะธั ะบะพะดะฐ, ะธ ะบะพะด ะฒ ะฝะธั
|
|||
ัะฐะทะผะตัะฐะตััั ะฝะฐ ะบััะบะธ, ะฟะพะผะตัะตะฝะฝัะต ัะฐะทะฝัะผะธ ะทะฝะฐัะตะฝะธัะผะธ ะบะปะฐััะพะฒ. |
|||
|
|||
|
|||
### ะะฝะธัะธะฐะปะธะทะฐัะธั ะฒัััะฝัั |
|||
|
|||
ะัะปะธ ะฒั ะธัะฟะพะปัะทัะตัะต ะดััะณะธะต ัะตะณะธ ะดะปั ะฑะปะพะบะพะฒ ะบะพะดะฐ, ะฒั ะผะพะถะตัะต ะธะฝะธัะธะฐะปะธะทะธัะพะฒะฐัั ะธั
|
|||
ัะฒะฝะพ ั ะฟะพะผะพััั ััะฝะบัะธะธ `highlightBlock(code, tabReplace)`. ะะฝะฐ ะฟัะธะฝะธะผะฐะตั |
|||
DOM-ัะปะตะผะตะฝั ั ัะตะบััะพะผ ัะฐััะฒะตัะธะฒะฐะตะผะพะณะพ ะบะพะดะฐ ะธ ะพะฟัะธะพะฝะฐะปัะฝะพ - ัััะพัะบั ะดะปั ะทะฐะผะตะฝั |
|||
ัะธะผะฒะพะปะพะฒ TAB. |
|||
|
|||
ะะฐะฟัะธะผะตั ั ะธัะฟะพะปัะทะพะฒะฐะฝะธะตะผ jQuery ะบะพะด ะธะฝะธัะธะฐะปะธะทะฐัะธะธ ะผะพะถะตั ะฒัะณะปัะดะตัั ัะฐะบ: |
|||
|
|||
```javascript |
|||
$(document).ready(function() { |
|||
$('pre code').each(function(i, e) {hljs.highlightBlock(e, ' ')}); |
|||
}); |
|||
``` |
|||
|
|||
ะัะปะธ ะฒะฐั ะฑะปะพะบ ะบะพะดะฐ ะธัะฟะพะปัะทัะตั `<br>` ะฒะผะตััะพ ะฟะตัะตะฒะพะดะพะฒ ัััะพะบะธ (ั.ะต. ะตัะปะธ ััะพ ะฝะต |
|||
`<pre>`), ะฟะตัะตะดะฐะนัะต `true` ััะตััะธะผ ะฟะฐัะฐะผะตััะพะผ ะฒ `highlightBlock`: |
|||
|
|||
```javascript |
|||
$('div.code').each(function(i, e) {hljs.highlightBlock(e, null, true)}); |
|||
``` |
|||
|
|||
### ะัะฑะพั ััะธะปะตะน |
|||
|
|||
ะ ะฐะทะผะตัะตะฝะฝัะผ ะบะปะฐััะฐะผะธ ัะปะตะผะตะฝัะฐะผ ะบะพะดะฐ ะผะพะถะฝะพ ะทะฐะดะฐัั ะถะตะปะฐะตะผัะต ััะธะปะธ ะฝะฐะฟัะธะผะตั ัะฐะบ: |
|||
|
|||
```css |
|||
.comment { |
|||
color: gray; |
|||
} |
|||
|
|||
.keyword { |
|||
font-weight: bold; |
|||
} |
|||
|
|||
.python .string { |
|||
color: blue; |
|||
} |
|||
|
|||
.html .atribute .value { |
|||
color: green; |
|||
} |
|||
``` |
|||
|
|||
ะ ะบะพะผะฟะปะตะบัะต ั highlight.js ะธะดัั ะฝะตัะบะพะปัะบะพ ััะธะปะตะฒัั
ัะตะผ ะฒ ะดะธัะตะบัะพัะธะธ styles, |
|||
ะบะพัะพััะต ะผะพะถะฝะพ ะธัะฟะพะปัะทะพะฒะฐัั ะฝะฐะฟััะผัั ะธะปะธ ะบะฐะบ ะพัะฝะพะฒั ะดะปั ัะพะฑััะฒะตะฝะฝัั
ัะบัะฟะตัะธะผะตะฝัะพะฒ. |
|||
|
|||
**ะะฝะธะผะฐะฝะธะต**: ะฟัะธะปะพะถะตะฝะฝัะต ััะธะปะธ ัะฐะฑะพัะฐัั ะดะปั ะบะพะดะฐ, ะพะฟัะตะดะตะปัะฝะฝะพะณะพ ะฒะฝัััะธ ะฑะปะพะบะพะฒ |
|||
`<pre>`. ะัะปะธ ะฒั ะธัะฟะพะปัะทัะตัะต ัะพะฑััะฒะตะฝะฝัั ัะฐะทะผะตัะบั, ััะธะปะธ ะฝัะถะฝะพ ะธัะฟัะฐะฒะธัั |
|||
ัะพะพัะฒะตัััะฒัััะธะผ ะพะฑัะฐะทะพะผ. |
|||
|
|||
ะะพะปะฝัะน ัะฟะธัะพะบ ะบะปะฐััะพะฒ ะฟัะธะฒะตะดัะฝ ะฒ ัะฐะนะปะต [crossref.txt][cr]. |
|||
|
|||
[cr]: http://github.com/isagalaev/highlight.js/blob/master/classref.txt |
|||
|
|||
|
|||
## ะญะบัะฟะพัั |
|||
|
|||
ะ ัะฐะนะปะต export.html ะฝะฐั
ะพะดะธััั ะฝะตะฑะพะปััะฐั ะฟัะพะณัะฐะผะผะบะฐ, ะบะพัะพัะฐั ะฟะพะบะฐะทัะฒะฐะตั ะธ ะดะฐะตั |
|||
ัะบะพะฟะธัะพะฒะฐัั ะฝะตะฟะพััะตะดััะฒะตะฝะฝะพ HTML-ะบะพะด ะฟะพะดัะฒะตัะบะธ ะดะปั ะปัะฑะพะณะพ ะทะฐะดะฐะฝะฝะพะณะพ ััะฐะณะผะตะฝัะฐ ะบะพะดะฐ. |
|||
ะญัะพ ะผะพะถะตั ะฟะพะฝะฐะดะพะฑะธััั ะฝะฐะฟัะธะผะตั ะฝะฐ ัะฐะนัะต, ะฝะฐ ะบะพัะพัะพะผ ะฝะตะปัะทั ะฟะพะดะบะปััะธัั ัะฐะผ ัะบัะธะฟั |
|||
highlight.js. |
|||
|
|||
|
|||
## ะญะฒัะธััะธะบะฐ |
|||
|
|||
ะะฟัะตะดะตะปะตะฝะธะต ัะทัะบะฐ, ะฝะฐ ะบะพัะพัะพะผ ะฝะฐะฟะธัะฐะฝ ััะฐะณะผะตะฝั, ะดะตะปะฐะตััั ั ะฟะพะผะพััั |
|||
ะดะพะฒะพะปัะฝะพ ะฟัะพััะพะน ัะฒัะธััะธะบะธ: ะฟัะพะณัะฐะผะผะฐ ะฟััะฐะตััั ัะฐััะฒะตัะธัั ััะฐะณะผะตะฝั ะฒัะตะผะธ |
|||
ัะทัะบะฐะผะธ ะฟะพะดััะด, ะธ ะดะปั ะบะฐะถะดะพะณะพ ัะทัะบะฐ ััะธัะฐะตั ะบะพะปะธัะตััะฒะพ ะฟะพะดะพัะตะดัะธั
|
|||
ัะธะฝัะฐะบัะธัะตัะบะธ ะบะพะฝััััะบัะธะน ะธ ะบะปััะตะฒัั
ัะปะพะฒ. ะะปั ะบะฐะบะพะณะพ ัะทัะบะฐ ะฝะฐัะปะพัั ะฑะพะปััะต, |
|||
ัะพั ะธ ะฒัะฑะธัะฐะตััั. |
|||
|
|||
ะญัะพ ะพะทะฝะฐัะฐะตั, ััะพ ะฒ ะบะพัะพัะบะธั
ััะฐะณะผะตะฝัะฐั
ะฒััะพะบะฐ ะฒะตัะพััะฝะพััั ะพัะธะฑะบะธ, ััะพ |
|||
ะฟะตัะธะพะดะธัะตัะบะธ ะธ ัะปััะฐะตััั. ะงัะพะฑั ัะบะฐะทะฐัั ัะทัะบ ััะฐะณะผะตะฝัะฐ ัะฒะฝะพ, ะฝะฐะดะพ ะฝะฐะฟะธัะฐัั |
|||
ะตะณะพ ะฝะฐะทะฒะฐะฝะธะต ะฒ ะฒะธะดะต ะบะปะฐััะฐ ะบ ัะปะตะผะตะฝัั `<code>`: |
|||
|
|||
```html |
|||
<pre><code class="html">...</code></pre> |
|||
``` |
|||
|
|||
ะะพะถะฝะพ ะธัะฟะพะปัะทะพะฒะฐัั ัะตะบะพะผะตะฝะดะพะฒะฐะฝะฝัะต ะฒ HTML5 ะฝะฐะทะฒะฐะฝะธั ะบะปะฐััะพะฒ: |
|||
"language-html", "language-php". ะขะฐะบะถะต ะผะพะถะฝะพ ะฝะฐะทะฝะฐัะฐัั ะบะปะฐััั ะฝะฐ ัะปะตะผะตะฝั |
|||
`<pre>`. |
|||
|
|||
ะงัะพะฑั ะทะฐะฟัะตัะธัั ัะฐััะฒะตัะบั ััะฐะณะผะตะฝัะฐ ะฒะพะพะฑัะต, ะธัะฟะพะปัะทัะตััั ะบะปะฐัั "no-highlight": |
|||
|
|||
```html |
|||
<pre><code class="no-highlight">...</code></pre> |
|||
``` |
|||
|
|||
## ะะพะพัะดะธะฝะฐัั |
|||
|
|||
- ะะตััะธั: 6.2 |
|||
- URL: http://softwaremaniacs.org/soft/highlight/ |
|||
- ะะฒัะพั: ะะฒะฐะฝ ะกะฐะณะฐะปะฐะตะฒ (<maniac@softwaremaniacs.org>) |
|||
|
|||
ะะธัะตะฝะทะธะพะฝะฝะพะต ัะพะณะปะฐัะตะฝะธะต ัะธัะฐะนัะต ะฒ ัะฐะนะปะต LICENSE. |
|||
ะกะฟะธัะพะบ ัะพะฐะฒัะพัะพะฒ ัะธัะฐะนัะต ะฒ ัะฐะนะปะต AUTHORS.ru.txt |
@ -0,0 +1,497 @@ |
|||
This is a full list of available classes corresponding to languages' |
|||
syntactic structures. The parentheses after language name contain identifiers |
|||
used as class names in `<code>` element. |
|||
|
|||
Python ("python"): |
|||
|
|||
keyword keyword |
|||
built_in built-in objects (None, False, True and Ellipsis) |
|||
number number |
|||
string string (of any type) |
|||
comment comment |
|||
decorator @-decorator for functions |
|||
function function header "def some_name(...):" |
|||
class class header "class SomeName(...):" |
|||
title name of a function or a class inside a header |
|||
params everything inside parentheses in a function's or class' header |
|||
|
|||
Python profiler results ("profile"): |
|||
|
|||
number number |
|||
string string |
|||
builtin builtin function entry |
|||
filename filename in an entry |
|||
summary profiling summary |
|||
header header of table of results |
|||
keyword column header |
|||
function function name in an entry (including parentheses) |
|||
title actual name of a function in an entry (excluding parentheses) |
|||
|
|||
Ruby ("ruby"): |
|||
|
|||
keyword keyword |
|||
string string |
|||
subst in-string substitution (#{...}) |
|||
comment comment |
|||
yardoctag YARD tag |
|||
function function header "def some_name(...):" |
|||
class class header "class SomeName(...):" |
|||
title name of a function or a class inside a header |
|||
parent name of a parent class |
|||
symbol symbol |
|||
instancevar instance variable |
|||
|
|||
Perl ("perl"): |
|||
|
|||
keyword keyword |
|||
comment comment |
|||
number number |
|||
string string |
|||
regexp regular expression |
|||
sub subroutine header (from "sub" till "{") |
|||
variable variable starting with "$", "%", "@" |
|||
operator operator |
|||
pod plain old doc |
|||
|
|||
PHP ("php"): |
|||
|
|||
keyword keyword |
|||
number number |
|||
string string (of any type) |
|||
comment comment |
|||
phpdoc phpdoc params in comments |
|||
variable variable starting with "$" |
|||
preprocessor preprocessor marks: "<?php" and "?>" |
|||
|
|||
Scala ("scala"): |
|||
|
|||
keyword keyword |
|||
number number |
|||
string string |
|||
comment comment |
|||
annotaion annotation |
|||
javadoc javadoc comment |
|||
javadoctag @-tag in javadoc |
|||
class class header |
|||
title class name inside a header |
|||
params everything in parentheses inside a class header |
|||
inheritance keywords "extends" and "with" inside class header |
|||
|
|||
Go language ("go"): |
|||
comment comment |
|||
string string constant |
|||
number number |
|||
keyword language keywords |
|||
constant true false nil iota |
|||
typename built-in plain types (int, string etc.) |
|||
built_in built-in functions |
|||
|
|||
XML ("xml"): |
|||
|
|||
tag any tag from "<" till ">" |
|||
comment comment |
|||
pi processing instruction (<? ... ?>) |
|||
cdata CDATA section |
|||
attribute attribute |
|||
value attribute's value |
|||
|
|||
HTML ("html"): |
|||
|
|||
keyword HTML tag |
|||
tag any tag from "<" till ">" |
|||
comment comment |
|||
doctype <!DOCTYPE ... > declaration |
|||
attribute tag's attribute with or without value |
|||
value attribute's value |
|||
|
|||
CSS ("css"): |
|||
|
|||
tag HTML tag in selectors |
|||
id #some_name in selectors |
|||
class .some_name in selectors |
|||
at_rule @-rule till first "{" or ";" |
|||
attr_selector attribute selector (square brackets in a[href^=http://]) |
|||
pseudo pseudo classes and elemens (:after, ::after etc.) |
|||
comment comment |
|||
rules everything from "{" till "}" |
|||
property property name inside a rule |
|||
value property value inside a rule, from ":" till ";" or |
|||
till the end of rule block |
|||
number number within a value |
|||
string string within a value |
|||
hexcolor hex color (#FFFFFF) within a value |
|||
function CSS function within a value |
|||
params everything between "(" and ")" within a function |
|||
important "!important" symbol |
|||
|
|||
Markdown ("markdown"): |
|||
|
|||
header header |
|||
bullet list bullet |
|||
emphasis emphasis |
|||
strong strong emphasis |
|||
blockquote blockquote |
|||
code code |
|||
horizontal_rule horizontal rule |
|||
link_label link label |
|||
link_url link url |
|||
|
|||
Django ("django"): |
|||
|
|||
keyword HTML tag in HTML, default tags and default filters in templates |
|||
tag any tag from "<" till ">" |
|||
comment comment |
|||
doctype <!DOCTYPE ... > declaration |
|||
attribute tag's attribute with or withou value |
|||
value attribute's value |
|||
template_tag template tag {% .. %} |
|||
variable template variable {{ .. }} |
|||
template_comment template comment, both {# .. #} and {% comment %} |
|||
filter filter from "|" till the next filter or the end of tag |
|||
argument filter argument |
|||
|
|||
JavaScript ("javascript"): |
|||
|
|||
keyword keyword |
|||
comment comment |
|||
number number |
|||
literal special literal: "true", "false" and "null" |
|||
string string |
|||
regexp regular expression |
|||
function header of a function |
|||
title name of a function inside a header |
|||
params parentheses and everything inside them in a function's header |
|||
|
|||
CoffeeScript ("coffeescript"): |
|||
|
|||
keyword keyword |
|||
comment comment |
|||
number number |
|||
literal special literal: "true", "false" and "null" |
|||
string string |
|||
regexp regular expression |
|||
function header of a function |
|||
title name of a function variable inside a header |
|||
params parentheses and everything inside them in a function's header |
|||
|
|||
VBScript ("vbscript"): |
|||
|
|||
keyword keyword |
|||
number number |
|||
string string |
|||
comment comment |
|||
built_in built-in function |
|||
|
|||
Lua ("lua"): |
|||
|
|||
keyword keyword |
|||
number number |
|||
string string |
|||
comment comment |
|||
built_in built-in operator |
|||
function header of a function |
|||
title name of a function inside a header |
|||
params everything inside parentheses in a function's header |
|||
long_brackets multiline string in [=[ .. ]=] |
|||
|
|||
Delphi ("delphi"): |
|||
|
|||
keyword keyword |
|||
comment comment (of any type) |
|||
number number |
|||
string string |
|||
function header of a function, procedure, constructor and destructor |
|||
title name of a function, procedure, constructor or destructor |
|||
inside a header |
|||
params everything inside parentheses in a function's header |
|||
class class' body from "= class" till "end;" |
|||
|
|||
Java ("java"): |
|||
|
|||
keyword keyword |
|||
number number |
|||
string string |
|||
comment commment |
|||
annotaion annotation |
|||
javadoc javadoc comment |
|||
class class header from "class" till "{" |
|||
title class name inside a header |
|||
params everything in parentheses inside a class header |
|||
inheritance keywords "extends" and "implements" inside class header |
|||
|
|||
C++ ("cpp"): |
|||
|
|||
keyword keyword |
|||
number number |
|||
string string and character |
|||
comment comment |
|||
preprocessor preprocessor directive |
|||
stl_container instantiation of STL containers ("vector<...>") |
|||
|
|||
Objective C ("objectivec"): |
|||
keyword keyword |
|||
built_in Cocoa/Cocoa Touch constants and classes |
|||
number number |
|||
string string |
|||
comment comment |
|||
preprocessor preprocessor directive |
|||
class interface/implementation, protocol and forward class declaration |
|||
|
|||
Vala ("vala"): |
|||
|
|||
keyword keyword |
|||
number number |
|||
string string |
|||
comment comment |
|||
class class definitions |
|||
title in class definition |
|||
constant ALL_UPPER_CASE |
|||
|
|||
C# ("cs"): |
|||
|
|||
keyword keyword |
|||
number number |
|||
string string |
|||
comment commment |
|||
xmlDocTag xmldoc tag ("///", "<!--", "-->", "<..>") |
|||
|
|||
RenderMan RSL ("rsl"): |
|||
|
|||
keyword keyword |
|||
number number |
|||
string string (including @"..") |
|||
comment comment |
|||
preprocessor preprocessor directive |
|||
shader sahder keywords |
|||
shading shading keywords |
|||
built_in built-in function |
|||
|
|||
RenderMan RIB ("rib"): |
|||
|
|||
keyword keyword |
|||
number number |
|||
string string |
|||
comment comment |
|||
commands command |
|||
|
|||
Maya Embedded Language ("mel"): |
|||
|
|||
keyword keyword |
|||
number number |
|||
string string |
|||
comment comment |
|||
variable variable |
|||
|
|||
SQL ("sql"): |
|||
|
|||
keyword keyword (mostly SQL'92 and SQL'99) |
|||
number number |
|||
string string (of any type: "..", '..', `..`) |
|||
comment comment |
|||
aggregate aggregate function |
|||
|
|||
Smalltalk ("smalltalk"): |
|||
|
|||
keyword keyword |
|||
number number |
|||
string string |
|||
comment commment |
|||
symbol symbol |
|||
array array |
|||
class name of a class |
|||
char char |
|||
localvars block of local variables |
|||
|
|||
Lisp ("lisp"): |
|||
|
|||
keyword keyword |
|||
number number |
|||
string string |
|||
comment commment |
|||
variable variable |
|||
literal b, t and nil |
|||
list non-quoted list |
|||
title first symbol in a non-quoted list |
|||
body remainder of the non-quoted list |
|||
quoted quoted list, both "(quote .. )" and "'(..)" |
|||
|
|||
Ini ("ini"): |
|||
|
|||
title title of a section |
|||
value value of a setting of any type |
|||
string string |
|||
number number |
|||
keyword boolean value keyword |
|||
|
|||
Apache ("apache"): |
|||
|
|||
keyword keyword |
|||
number number |
|||
comment commment |
|||
literal On and Off |
|||
sqbracket variables in rewrites "%{..}" |
|||
cbracket options in rewrites "[..]" |
|||
tag begin and end of a configuration section |
|||
|
|||
Nginx ("nginx"): |
|||
|
|||
keyword keyword |
|||
string string |
|||
number number |
|||
comment comment |
|||
built_in built-in constant |
|||
variable $-variable |
|||
|
|||
Diff ("diff"): |
|||
|
|||
header file header |
|||
chunk chunk header within a file |
|||
addition added lines |
|||
deletion deleted lines |
|||
change changed lines |
|||
|
|||
DOS ("dos"): |
|||
|
|||
keyword keyword |
|||
flow batch control keyword |
|||
stream DOS special files ("con", "prn", ...) |
|||
winutils some commands (see dos.js specifically) |
|||
envvar environment variables |
|||
|
|||
Bash ("bash"): |
|||
|
|||
keyword keyword |
|||
string string |
|||
number number |
|||
comment comment |
|||
literal special literal: "true" ะธ "false" |
|||
variable variable |
|||
shebang script interpreter header |
|||
|
|||
CMake ("cmake") |
|||
|
|||
keyword keyword |
|||
number number |
|||
string string |
|||
comment commment |
|||
envvar $-variable |
|||
|
|||
Axapta ("axapta"): |
|||
|
|||
keyword keyword |
|||
number number |
|||
string string |
|||
comment commment |
|||
class class header from "class" till "{" |
|||
title class name inside a header |
|||
params everything in parentheses inside a class header |
|||
inheritance keywords "extends" and "implements" inside class header |
|||
preprocessor preprocessor directive |
|||
|
|||
1C ("1c"): |
|||
|
|||
keyword keyword |
|||
number number |
|||
date date |
|||
string string |
|||
comment commment |
|||
function header of function or procudure |
|||
title function name inside a header |
|||
params everything in parentheses inside a function header |
|||
preprocessor preprocessor directive |
|||
|
|||
AVR assembler ("avrasm"): |
|||
|
|||
keyword keyword |
|||
built_in pre-defined register |
|||
number number |
|||
string string |
|||
comment commment |
|||
label label |
|||
preprocessor preprocessor directive |
|||
localvars substitution in .macro |
|||
|
|||
VHDL ("vhdl") |
|||
|
|||
keyword keyword |
|||
number number |
|||
string string |
|||
comment commment |
|||
literal signal logical value |
|||
|
|||
Parser3 ("parser3"): |
|||
|
|||
keyword keyword |
|||
number number |
|||
comment commment |
|||
variable variable starting with "$" |
|||
preprocessor preprocessor directive |
|||
title user-defined name starting with "@" |
|||
|
|||
TeX ("tex"): |
|||
|
|||
comment comment |
|||
number number |
|||
command command |
|||
parameter parameter |
|||
formula formula |
|||
special special symbol |
|||
|
|||
Haskell ("haskell"): |
|||
|
|||
keyword keyword |
|||
built_in built-in typeclass/functions (Bool, Int) |
|||
number number |
|||
string string |
|||
comment comment |
|||
class type classes and other data types |
|||
title function name |
|||
label type class name |
|||
|
|||
Erlang ("erlang"): |
|||
|
|||
comment comment |
|||
string string |
|||
number number |
|||
keyword keyword |
|||
record_name record access (#record_name) |
|||
title name of declaration function |
|||
variable variable (starts with capital letter or with _) |
|||
pp.keywords module's attribute (-attribute) |
|||
function_name atom or atom:atom in case of function call |
|||
|
|||
Rust ("rust"): |
|||
|
|||
comment comment |
|||
string string |
|||
number number |
|||
keyword keyword |
|||
title name of declaration |
|||
preprocessor preprocessor directive |
|||
|
|||
ActionScript ("actionscript"): |
|||
|
|||
comment comment |
|||
string string |
|||
number number |
|||
keyword keywords |
|||
literal literal |
|||
reserved reserved keyword |
|||
title name of declaration (package, class or function) |
|||
preprocessor preprocessor directive (import, include) |
|||
type type of returned value (for functions) |
|||
package package (named or not) |
|||
class class/interface |
|||
function function |
|||
param params of function |
|||
rest_arg rest argument of function |
|||
|
|||
Matlab ("matlab"): |
|||
|
|||
comment comment |
|||
string string |
|||
number number |
|||
keyword keyword |
|||
title function name |
|||
function function |
|||
param params of function |
@ -0,0 +1,88 @@ |
|||
<!-- saved from url=(0013)about:internet --> |
|||
<!-- ^^^ This is for IE not to show security warning for local files, |
|||
theme: scientific |
|||
see http://www.microsoft.com/technet/prodtechnol/winxppro/maintain/sp2brows.mspx--> |
|||
|
|||
<!-- |
|||
Highlighted code export |
|||
Copyright (c) Vladimir Gubarkov <xonixx@gmail.com> |
|||
--> |
|||
|
|||
<html> |
|||
<head> |
|||
<title>Highlited code export</title> |
|||
<link rel="stylesheet" href="styles/default.css"> |
|||
<meta charset="utf-8"> |
|||
<style type="text/css"> |
|||
#t1, #t2 { width: 100%;} |
|||
tr { vertical-align: top; } |
|||
address { margin-top: 4em; } |
|||
</style> |
|||
<script src="highlight.pack.js"></script> |
|||
<script>hljs.initHighlightingOnLoad();</script> |
|||
</head> |
|||
<body> |
|||
<script type="text/javascript"> |
|||
String.prototype.escape = function() { |
|||
return this.replace(/&/gm, '&').replace(/</gm, '<').replace(/>/gm, '>'); |
|||
} |
|||
|
|||
function doIt() { |
|||
var viewDiv = document.getElementById("highlight-view"); |
|||
var t1 = document.getElementById("t1"); |
|||
var t2 = document.getElementById("t2"); |
|||
var selector = document.getElementById("langSelector"); |
|||
var selectedLang = selector.options[selector.selectedIndex].value.toLowerCase(); |
|||
if(selectedLang) { |
|||
viewDiv.innerHTML = '<pre><code class="'+selectedLang+'">'+t1.value.escape()+"</code></pre>"; |
|||
} else { // try auto |
|||
viewDiv.innerHTML = '<pre><code>' + t1.value.escape() + "</code></pre>"; |
|||
} |
|||
hljs.highlightBlock(viewDiv.firstChild.firstChild); |
|||
t2.value = viewDiv.innerHTML; |
|||
} |
|||
|
|||
function copyToBuffer(textToCopy) { |
|||
if (window.clipboardData) { // IE |
|||
window.clipboardData.setData("Text", textToCopy); |
|||
} else if (window.netscape) { // FF |
|||
// from http://developer.mozilla.org/en/docs/Using_the_Clipboard |
|||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); |
|||
var gClipboardHelper = Components.classes["@mozilla.org/widget/clipboardhelper;1"].getService(Components.interfaces.nsIClipboardHelper); |
|||
gClipboardHelper.copyString(textToCopy); |
|||
} |
|||
} |
|||
</script> |
|||
<script type="text/javascript"> |
|||
var langSelectorHtml = '<label>Language <select id="langSelector">'; |
|||
langSelectorHtml += '<option value="">Auto</option>'; |
|||
for (var i in hljs.LANGUAGES) { |
|||
if (hljs.LANGUAGES.hasOwnProperty(i)) |
|||
langSelectorHtml += '<option value=\"'+i+'\">'+i.charAt(0).toUpperCase()+i.substr(1)+'</option>'; |
|||
} |
|||
langSelectorHtml += '</select></label>'; |
|||
document.write(langSelectorHtml); |
|||
</script> |
|||
<table width="100%"> |
|||
<tr> |
|||
<td><textarea rows="20" cols="50" id="t1"></textarea></td> |
|||
<td><textarea rows="20" cols="50" id="t2"></textarea></td> |
|||
</tr> |
|||
<tr> |
|||
<td>Write a code snippet</td> |
|||
<td>Get HTML to paste anywhere (for actual styles and colors see sample.css)</td> |
|||
</tr> |
|||
</table> |
|||
<table width="98%"> |
|||
<tr> |
|||
<td><input type="button" value="Export →" onclick="doIt()"/></td> |
|||
<td align="right"><input type="button" value="Copy to buffer" onclick="copyToBuffer(document.getElementById('t2').value);"/></td> |
|||
</tr> |
|||
</table> |
|||
<div id="highlight-view"></div> |
|||
<address> |
|||
Export script: <a href="mailto:xonixx@gmail.com">Vladimir Gubarkov</a><br> |
|||
Highlighting: <a href="http://softwaremaniacs.org/soft/highlight/">highlight.js</a> |
|||
</address> |
|||
</body> |
|||
</html> |
@ -0,0 +1,643 @@ |
|||
/* |
|||
Syntax highlighting with language autodetection. |
|||
http://softwaremaniacs.org/soft/highlight/
|
|||
*/ |
|||
|
|||
var hljs = new function() { |
|||
|
|||
/* Utility functions */ |
|||
|
|||
function escape(value) { |
|||
return value.replace(/&/gm, '&').replace(/</gm, '<'); |
|||
} |
|||
|
|||
function langRe(language, value, global) { |
|||
return RegExp( |
|||
value, |
|||
'm' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : '') |
|||
); |
|||
} |
|||
|
|||
function findCode(pre) { |
|||
for (var i = 0; i < pre.childNodes.length; i++) { |
|||
var node = pre.childNodes[i]; |
|||
if (node.nodeName == 'CODE') |
|||
return node; |
|||
if (!(node.nodeType == 3 && node.nodeValue.match(/\s+/))) |
|||
break; |
|||
} |
|||
} |
|||
|
|||
function blockText(block, ignoreNewLines) { |
|||
var result = ''; |
|||
for (var i = 0; i < block.childNodes.length; i++) |
|||
if (block.childNodes[i].nodeType == 3) { |
|||
var chunk = block.childNodes[i].nodeValue; |
|||
if (ignoreNewLines) |
|||
chunk = chunk.replace(/\n/g, ''); |
|||
result += chunk; |
|||
} else if (block.childNodes[i].nodeName == 'BR') |
|||
result += '\n'; |
|||
else |
|||
result += blockText(block.childNodes[i]); |
|||
// Thank you, MSIE...
|
|||
if (/MSIE [678]/.test(navigator.userAgent)) |
|||
result = result.replace(/\r/g, '\n'); |
|||
return result; |
|||
} |
|||
|
|||
function blockLanguage(block) { |
|||
var classes = block.className.split(/\s+/); |
|||
classes = classes.concat(block.parentNode.className.split(/\s+/)); |
|||
for (var i = 0; i < classes.length; i++) { |
|||
var class_ = classes[i].replace(/^language-/, ''); |
|||
if (languages[class_] || class_ == 'no-highlight') { |
|||
return class_; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/* Stream merging */ |
|||
|
|||
function nodeStream(node) { |
|||
var result = []; |
|||
(function (node, offset) { |
|||
for (var i = 0; i < node.childNodes.length; i++) { |
|||
if (node.childNodes[i].nodeType == 3) |
|||
offset += node.childNodes[i].nodeValue.length; |
|||
else if (node.childNodes[i].nodeName == 'BR') |
|||
offset += 1; |
|||
else if (node.childNodes[i].nodeType == 1) { |
|||
result.push({ |
|||
event: 'start', |
|||
offset: offset, |
|||
node: node.childNodes[i] |
|||
}); |
|||
offset = arguments.callee(node.childNodes[i], offset); |
|||
result.push({ |
|||
event: 'stop', |
|||
offset: offset, |
|||
node: node.childNodes[i] |
|||
}); |
|||
} |
|||
} |
|||
return offset; |
|||
})(node, 0); |
|||
return result; |
|||
} |
|||
|
|||
function mergeStreams(stream1, stream2, value) { |
|||
var processed = 0; |
|||
var result = ''; |
|||
var nodeStack = []; |
|||
|
|||
function selectStream() { |
|||
if (stream1.length && stream2.length) { |
|||
if (stream1[0].offset != stream2[0].offset) |
|||
return (stream1[0].offset < stream2[0].offset) ? stream1 : stream2; |
|||
else { |
|||
/* |
|||
To avoid starting the stream just before it should stop the order is |
|||
ensured that stream1 always starts first and closes last: |
|||
|
|||
if (event1 == 'start' && event2 == 'start') |
|||
return stream1; |
|||
if (event1 == 'start' && event2 == 'stop') |
|||
return stream2; |
|||
if (event1 == 'stop' && event2 == 'start') |
|||
return stream1; |
|||
if (event1 == 'stop' && event2 == 'stop') |
|||
return stream2; |
|||
|
|||
... which is collapsed to: |
|||
*/ |
|||
return stream2[0].event == 'start' ? stream1 : stream2; |
|||
} |
|||
} else { |
|||
return stream1.length ? stream1 : stream2; |
|||
} |
|||
} |
|||
|
|||
function open(node) { |
|||
var result = '<' + node.nodeName.toLowerCase(); |
|||
for (var i = 0; i < node.attributes.length; i++) { |
|||
var attribute = node.attributes[i]; |
|||
result += ' ' + attribute.nodeName.toLowerCase(); |
|||
if (attribute.value !== undefined && attribute.value !== false && attribute.value !== null) { |
|||
result += '="' + escape(attribute.value) + '"'; |
|||
} |
|||
} |
|||
return result + '>'; |
|||
} |
|||
|
|||
while (stream1.length || stream2.length) { |
|||
var current = selectStream().splice(0, 1)[0]; |
|||
result += escape(value.substr(processed, current.offset - processed)); |
|||
processed = current.offset; |
|||
if ( current.event == 'start') { |
|||
result += open(current.node); |
|||
nodeStack.push(current.node); |
|||
} else if (current.event == 'stop') { |
|||
var node, i = nodeStack.length; |
|||
do { |
|||
i--; |
|||
node = nodeStack[i]; |
|||
result += ('</' + node.nodeName.toLowerCase() + '>'); |
|||
} while (node != current.node); |
|||
nodeStack.splice(i, 1); |
|||
while (i < nodeStack.length) { |
|||
result += open(nodeStack[i]); |
|||
i++; |
|||
} |
|||
} |
|||
} |
|||
return result + escape(value.substr(processed)); |
|||
} |
|||
|
|||
/* Initialization */ |
|||
|
|||
function compileModes() { |
|||
|
|||
function compileMode(mode, language, is_default) { |
|||
if (mode.compiled) |
|||
return; |
|||
var group; |
|||
|
|||
if (!is_default) { |
|||
mode.beginRe = langRe(language, mode.begin ? mode.begin : '\\B|\\b'); |
|||
if (!mode.end && !mode.endsWithParent) |
|||
mode.end = '\\B|\\b'; |
|||
if (mode.end) |
|||
mode.endRe = langRe(language, mode.end); |
|||
} |
|||
if (mode.illegal) |
|||
mode.illegalRe = langRe(language, mode.illegal); |
|||
if (mode.relevance === undefined) |
|||
mode.relevance = 1; |
|||
if (mode.keywords) { |
|||
mode.lexemsRe = langRe(language, mode.lexems || hljs.IDENT_RE, true); |
|||
for (var className in mode.keywords) { |
|||
if (!mode.keywords.hasOwnProperty(className)) |
|||
continue; |
|||
if (mode.keywords[className] instanceof Object) { |
|||
group = mode.keywords[className]; |
|||
} else { |
|||
group = mode.keywords; |
|||
className = 'keyword'; |
|||
} |
|||
for (var keyword in group) { |
|||
if (!group.hasOwnProperty(keyword)) |
|||
continue; |
|||
mode.keywords[keyword] = [className, group[keyword]]; |
|||
} |
|||
} |
|||
} |
|||
if (!mode.contains) { |
|||
mode.contains = []; |
|||
} |
|||
// compiled flag is set before compiling submodes to avoid self-recursion
|
|||
// (see lisp where quoted_list contains quoted_list)
|
|||
mode.compiled = true; |
|||
for (var i = 0; i < mode.contains.length; i++) { |
|||
if (mode.contains[i] == 'self') { |
|||
mode.contains[i] = mode; |
|||
} |
|||
compileMode(mode.contains[i], language, false); |
|||
} |
|||
if (mode.starts) { |
|||
compileMode(mode.starts, language, false); |
|||
} |
|||
} |
|||
|
|||
for (var i in languages) { |
|||
if (!languages.hasOwnProperty(i)) |
|||
continue; |
|||
compileMode(languages[i].defaultMode, languages[i], true); |
|||
} |
|||
} |
|||
|
|||
/* |
|||
Core highlighting function. Accepts a language name and a string with the |
|||
code to highlight. Returns an object with the following properties: |
|||
|
|||
- relevance (int) |
|||
- keyword_count (int) |
|||
- value (an HTML string with highlighting markup) |
|||
|
|||
*/ |
|||
function highlight(language_name, value) { |
|||
if (!compileModes.called) { |
|||
compileModes(); |
|||
compileModes.called = true; |
|||
} |
|||
|
|||
function subMode(lexem, mode) { |
|||
for (var i = 0; i < mode.contains.length; i++) { |
|||
if (mode.contains[i].beginRe.test(lexem)) { |
|||
return mode.contains[i]; |
|||
} |
|||
} |
|||
} |
|||
|
|||
function endOfMode(mode_index, lexem) { |
|||
if (modes[mode_index].end && modes[mode_index].endRe.test(lexem)) |
|||
return 1; |
|||
if (modes[mode_index].endsWithParent) { |
|||
var level = endOfMode(mode_index - 1, lexem); |
|||
return level ? level + 1 : 0; |
|||
} |
|||
return 0; |
|||
} |
|||
|
|||
function isIllegal(lexem, mode) { |
|||
return mode.illegal && mode.illegalRe.test(lexem); |
|||
} |
|||
|
|||
function compileTerminators(mode, language) { |
|||
var terminators = []; |
|||
|
|||
for (var i = 0; i < mode.contains.length; i++) { |
|||
terminators.push(mode.contains[i].begin); |
|||
} |
|||
|
|||
var index = modes.length - 1; |
|||
do { |
|||
if (modes[index].end) { |
|||
terminators.push(modes[index].end); |
|||
} |
|||
index--; |
|||
} while (modes[index + 1].endsWithParent); |
|||
|
|||
if (mode.illegal) { |
|||
terminators.push(mode.illegal); |
|||
} |
|||
|
|||
return langRe(language, '(' + terminators.join('|') + ')', true); |
|||
} |
|||
|
|||
function eatModeChunk(value, index) { |
|||
var mode = modes[modes.length - 1]; |
|||
if (!mode.terminators) { |
|||
mode.terminators = compileTerminators(mode, language); |
|||
} |
|||
mode.terminators.lastIndex = index; |
|||
var match = mode.terminators.exec(value); |
|||
if (match) |
|||
return [value.substr(index, match.index - index), match[0], false]; |
|||
else |
|||
return [value.substr(index), '', true]; |
|||
} |
|||
|
|||
function keywordMatch(mode, match) { |
|||
var match_str = language.case_insensitive ? match[0].toLowerCase() : match[0]; |
|||
var value = mode.keywords[match_str]; |
|||
if (value && value instanceof Array) |
|||
return value; |
|||
return false; |
|||
} |
|||
|
|||
function processKeywords(buffer, mode) { |
|||
buffer = escape(buffer); |
|||
if (!mode.keywords) |
|||
return buffer; |
|||
var result = ''; |
|||
var last_index = 0; |
|||
mode.lexemsRe.lastIndex = 0; |
|||
var match = mode.lexemsRe.exec(buffer); |
|||
while (match) { |
|||
result += buffer.substr(last_index, match.index - last_index); |
|||
var keyword_match = keywordMatch(mode, match); |
|||
if (keyword_match) { |
|||
keyword_count += keyword_match[1]; |
|||
result += '<span class="'+ keyword_match[0] +'">' + match[0] + '</span>'; |
|||
} else { |
|||
result += match[0]; |
|||
} |
|||
last_index = mode.lexemsRe.lastIndex; |
|||
match = mode.lexemsRe.exec(buffer); |
|||
} |
|||
return result + buffer.substr(last_index, buffer.length - last_index); |
|||
} |
|||
|
|||
function processBuffer(buffer, mode) { |
|||
if (mode.subLanguage && languages[mode.subLanguage]) { |
|||
var result = highlight(mode.subLanguage, buffer); |
|||
keyword_count += result.keyword_count; |
|||
return result.value; |
|||
} else { |
|||
return processKeywords(buffer, mode); |
|||
} |
|||
} |
|||
|
|||
function startNewMode(mode, lexem) { |
|||
var markup = mode.className?'<span class="' + mode.className + '">':''; |
|||
if (mode.returnBegin) { |
|||
result += markup; |
|||
mode.buffer = ''; |
|||
} else if (mode.excludeBegin) { |
|||
result += escape(lexem) + markup; |
|||
mode.buffer = ''; |
|||
} else { |
|||
result += markup; |
|||
mode.buffer = lexem; |
|||
} |
|||
modes.push(mode); |
|||
relevance += mode.relevance; |
|||
} |
|||
|
|||
function processModeInfo(buffer, lexem, end) { |
|||
var current_mode = modes[modes.length - 1]; |
|||
if (end) { |
|||
result += processBuffer(current_mode.buffer + buffer, current_mode); |
|||
return false; |
|||
} |
|||
|
|||
var new_mode = subMode(lexem, current_mode); |
|||
if (new_mode) { |
|||
result += processBuffer(current_mode.buffer + buffer, current_mode); |
|||
startNewMode(new_mode, lexem); |
|||
return new_mode.returnBegin; |
|||
} |
|||
|
|||
var end_level = endOfMode(modes.length - 1, lexem); |
|||
if (end_level) { |
|||
var markup = current_mode.className?'</span>':''; |
|||
if (current_mode.returnEnd) { |
|||
result += processBuffer(current_mode.buffer + buffer, current_mode) + markup; |
|||
} else if (current_mode.excludeEnd) { |
|||
result += processBuffer(current_mode.buffer + buffer, current_mode) + markup + escape(lexem); |
|||
} else { |
|||
result += processBuffer(current_mode.buffer + buffer + lexem, current_mode) + markup; |
|||
} |
|||
while (end_level > 1) { |
|||
markup = modes[modes.length - 2].className?'</span>':''; |
|||
result += markup; |
|||
end_level--; |
|||
modes.length--; |
|||