Fixing brackets in code samples
Updated to latest hightlight.js
This commit is contained in:
bovenliggende
2ff95d383a
commit
8a68eb2e6e
@ -5,13 +5,13 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
@requires_authorization
|
||||
def somefunc(param1='', param2=0):
|
||||
r'''A docstring'''
|
||||
if param1 > param2: # interesting
|
||||
if param1 > param2: # interesting
|
||||
print 'Gre\'ater'
|
||||
return (param2 - param1 + 1) or None
|
||||
|
||||
class SomeClass:<br> pass
|
||||
|
||||
>>> message = '''interpreter
|
||||
>>> message = '''interpreter
|
||||
... prompt'''
|
||||
|
||||
|
||||
@ -29,7 +29,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
|
||||
**Ruby**
|
||||
|
||||
class A < B; def self.create(object = User) object end end
|
||||
class A < B; def self.create(object = User) object end end
|
||||
class Zebra; def inspect; "X#{2 + self.object_id}" end end
|
||||
|
||||
module ABC::DEF
|
||||
@ -39,7 +39,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
# @return [String] nothing
|
||||
def foo(test)
|
||||
Thread.new do |blockvar|
|
||||
ABC::DEF.reverse(:a_symbol, :'a symbol', :<=>, 'test' + test)
|
||||
ABC::DEF.reverse(:a_symbol, :'a symbol', :<=>, 'test' + test)
|
||||
end.join
|
||||
end
|
||||
|
||||
@ -56,7 +56,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
!!! XML
|
||||
%html
|
||||
%body
|
||||
%h1.jumbo{:id=>"a", :style=>'font-weight: normal', :title=>title} highlight.js
|
||||
%h1.jumbo{:id=>"a", :style=>'font-weight: normal', :title=>title} highlight.js
|
||||
/html comment
|
||||
-# ignore this line
|
||||
%ul(style='margin: 0')
|
||||
@ -73,25 +73,25 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
# loads object
|
||||
sub load
|
||||
{
|
||||
my $flds = $c->db_load($id,@_) || do {
|
||||
my $flds = $c->db_load($id,@_) || do {
|
||||
Carp::carp "Can`t load (class: $c, id: $id): '$!'"; return undef
|
||||
};
|
||||
my $o = $c->_perl_new();
|
||||
my $o = $c->_perl_new();
|
||||
$id12 = $id / 24 / 3600;
|
||||
$o->{'ID'} = $id12 + 123;
|
||||
#$o->{'SHCUT'} = $flds->{'SHCUT'};
|
||||
my $p = $o->props;
|
||||
$o->{'ID'} = $id12 + 123;
|
||||
#$o->{'SHCUT'} = $flds->{'SHCUT'};
|
||||
my $p = $o->props;
|
||||
my $vt;
|
||||
$string =~ m/^sought_text$/;
|
||||
$items = split //, 'abc';
|
||||
for my $key (keys %$p)
|
||||
{
|
||||
if(${$vt.'::property'}) {
|
||||
$o->{$key . '_real'} = $flds->{$key};
|
||||
tie $o->{$key}, 'CMSBuilder::Property', $o, $key;
|
||||
$o->{$key . '_real'} = $flds->{$key};
|
||||
tie $o->{$key}, 'CMSBuilder::Property', $o, $key;
|
||||
}
|
||||
}
|
||||
$o->save if delete $o->{'_save_after_load'};
|
||||
$o->save if delete $o->{'_save_after_load'};
|
||||
return $o;
|
||||
}
|
||||
|
||||
@ -145,24 +145,24 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
/** Turn command line arguments to uppercase */
|
||||
object Main {
|
||||
def main(args: Array[String]) {
|
||||
val res = for (a <- args) yield a.toUpperCase
|
||||
val res = for (a <- args) yield a.toUpperCase
|
||||
println("Arguments: " + res.toString)
|
||||
}
|
||||
}
|
||||
|
||||
/** Maps are easy to use in Scala. */
|
||||
object Maps {
|
||||
val colors = Map("red" -> 0xFF0000,
|
||||
"turquoise" -> 0x00FFFF,
|
||||
"black" -> 0x000000,
|
||||
"orange" -> 0xFF8040,
|
||||
"brown" -> 0x804000)
|
||||
val colors = Map("red" -> 0xFF0000,
|
||||
"turquoise" -> 0x00FFFF,
|
||||
"black" -> 0x000000,
|
||||
"orange" -> 0xFF8040,
|
||||
"brown" -> 0x804000)
|
||||
def main(args: Array[String]) {
|
||||
for (name <- args) println(
|
||||
for (name <- args) println(
|
||||
colors.get(name) match {
|
||||
case Some(code) =>
|
||||
case Some(code) =>
|
||||
name + " has code: " + code
|
||||
case None =>
|
||||
case None =>
|
||||
"Unknown color: " + name
|
||||
}
|
||||
)
|
||||
@ -200,8 +200,8 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
|
||||
func main() {
|
||||
ch := make(chan int)
|
||||
ch <- 1
|
||||
x, ok := <- ch
|
||||
ch <- 1
|
||||
x, ok := <- ch
|
||||
ok = true
|
||||
x = nil
|
||||
float_var := 1.0e10
|
||||
@ -214,77 +214,77 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
|
||||
**XML**
|
||||
|
||||
<?xml version="1.0"?>
|
||||
<response value="ok" xml:lang="en">
|
||||
<text>Ok</text>
|
||||
<comment html_allowed="true"/>
|
||||
<ns1:description><![CDATA[
|
||||
CDATA is <not> magical.
|
||||
]]></ns1:description>
|
||||
<a></a> <a/>
|
||||
</response>
|
||||
<?xml version="1.0"?>
|
||||
<response value="ok" xml:lang="en">
|
||||
<text>Ok</text>
|
||||
<comment html_allowed="true"/>
|
||||
<ns1:description><![CDATA[
|
||||
CDATA is <not> magical.
|
||||
]]></ns1:description>
|
||||
<a></a> <a/>
|
||||
</response>
|
||||
|
||||
|
||||
**HTML (with inline css and javascript)**
|
||||
|
||||
<!DOCTYPE html>
|
||||
<title>Title</title>
|
||||
<!DOCTYPE html>
|
||||
<title>Title</title>
|
||||
|
||||
<style>body {width: 500px;}</style>
|
||||
<style>body {width: 500px;}</style>
|
||||
|
||||
<script type="application/javascript">
|
||||
<script type="application/javascript">
|
||||
function $init() {return true;}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<body>
|
||||
<p checked class="title" id='title'>Title</p>
|
||||
<!-- here goes the rest of the page -->
|
||||
</body>
|
||||
<body>
|
||||
<p checked class="title" id='title'>Title</p>
|
||||
<!-- here goes the rest of the page -->
|
||||
</body>
|
||||
|
||||
**Lasso**
|
||||
|
||||
<?LassoScript
|
||||
<?LassoScript
|
||||
/* Lasso 8 */
|
||||
local('query' = 'SELECT * FROM `'+var:'table'+'` WHERE `id` > 10
|
||||
local('query' = 'SELECT * FROM `'+var:'table'+'` WHERE `id` > 10
|
||||
ORDER BY `Name` LIMIT 30');
|
||||
Inline: -Username=$DBuser, -Password=$DBpass, -Database=$DBname, -sql=#query;
|
||||
var("class.name" = (found_count != 0 ? `subtotal` | `nonefound`));
|
||||
records;
|
||||
output: ?><tr>[loop_count]</tr><?=;
|
||||
output: ?><tr>[loop_count]</tr><?=;
|
||||
/records;
|
||||
/Inline;
|
||||
?><div class="[$class.name]">[found_count]</div>
|
||||
?><div class="[$class.name]">[found_count]</div>
|
||||
[noprocess] causes [delimiters] to be skipped until the next [/noprocess]
|
||||
<?lasso
|
||||
<?lasso
|
||||
/* Lasso 9 */
|
||||
define strings_combine(value::string, ...other)::string => {
|
||||
local(result = #value->append(#other->asString))
|
||||
define strings_combine(value::string, ...other)::string => {
|
||||
local(result = #value->append(#other->asString))
|
||||
return #result
|
||||
}
|
||||
/**! descriptive text */
|
||||
define person => type {
|
||||
define person => type {
|
||||
data name::string, protected nickname
|
||||
data birthdate::date
|
||||
data private ssn = null
|
||||
public showName() => return .'name'
|
||||
protected fullName() => '"' + .nickname + '"' + .'name'
|
||||
public ssnListed => .ssn ? true | false
|
||||
public showName() => return .'name'
|
||||
protected fullName() => '"' + .nickname + '"' + .'name'
|
||||
public ssnListed => .ssn ? true | false
|
||||
}
|
||||
define person->name=(value) => {
|
||||
define person->name=(value) => {
|
||||
.'name' = #value
|
||||
return self->'name'
|
||||
return self->'name'
|
||||
}
|
||||
// query expression
|
||||
with n in array(-1, 0xABCD, 3.14159e14)
|
||||
let swapped = pair(#n->second, #n->first)
|
||||
group #swapped by #n->first into t
|
||||
let key = #t->key
|
||||
let swapped = pair(#n->second, #n->first)
|
||||
group #swapped by #n->first into t
|
||||
let key = #t->key
|
||||
order by #key
|
||||
select pair(#key, #t)
|
||||
do {^
|
||||
#n->upperCase
|
||||
#n->upperCase
|
||||
^}
|
||||
?>
|
||||
?>
|
||||
|
||||
**Markdown**
|
||||
|
||||
@ -300,9 +300,9 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
hello world
|
||||
===========
|
||||
|
||||
<this_is inline="xml"></this_is>
|
||||
<this_is inline="xml"></this_is>
|
||||
|
||||
> markdown is so cool
|
||||
> markdown is so cool
|
||||
|
||||
so are code segments
|
||||
|
||||
@ -313,7 +313,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
|
||||
Hello, World!
|
||||
============
|
||||
Author Name, <author@domain.foo>
|
||||
Author Name, <author@domain.foo>
|
||||
|
||||
you can write text http://example.com[with links], optionally
|
||||
using an explicit link:http://example.com[link prefix].
|
||||
@ -347,7 +347,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
|
||||
.Nested highlighting
|
||||
++++
|
||||
<this_is inline="xml"></this_is>
|
||||
<this_is inline="xml"></this_is>
|
||||
++++
|
||||
|
||||
____
|
||||
@ -381,10 +381,10 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
{% for article in articles %}
|
||||
|
||||
{# Striped table #}
|
||||
<tr class="{% cycle odd,even %}">
|
||||
<td>{{ article|default:"Hi... "|escape }}</td>
|
||||
<td {% if article.today %}class="today"{% endif %}>{{ article.date|date:"d.m.Y" }}</td>
|
||||
</tr>
|
||||
<tr class="{% cycle odd,even %}">
|
||||
<td>{{ article|default:"Hi... "|escape }}</td>
|
||||
<td {% if article.today %}class="today"{% endif %}>{{ article.date|date:"d.m.Y" }}</td>
|
||||
</tr>
|
||||
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
@ -396,13 +396,13 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
|
||||
**Handlebars**
|
||||
|
||||
<h3>Hours</h3>
|
||||
<h3>Hours</h3>
|
||||
|
||||
<ul>
|
||||
<ul>
|
||||
{{#each content.users}}
|
||||
<li {{bindAttr hello="world"}}>{{firstName}}</li>
|
||||
<li {{bindAttr hello="world"}}>{{firstName}}</li>
|
||||
{{/each}}
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
**CSS**
|
||||
|
||||
@ -492,8 +492,8 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
|
||||
a {
|
||||
color: $colorGreen;
|
||||
&:hover { color: $colorGreenDark; }
|
||||
&:visited { color: #c458cb; }
|
||||
&:hover { color: $colorGreenDark; }
|
||||
&:visited { color: #c458cb; }
|
||||
}
|
||||
|
||||
@for $i from 1 through 5 {
|
||||
@ -533,10 +533,10 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
/* handle exception */
|
||||
|
||||
var e4x =
|
||||
<div>Example
|
||||
<p>1234</p></div>;
|
||||
<div>Example
|
||||
<p>1234</p></div>;
|
||||
}
|
||||
for (var i = 0 / 2; i < classes.length; i++) { // "0 / 2" should not be parsed as regexp
|
||||
for (var i = 0 / 2; i < classes.length; i++) { // "0 / 2" should not be parsed as regexp
|
||||
if (checkCondition(classes[i]) === undefined)
|
||||
return /\d+[\s/]/g;
|
||||
}
|
||||
@ -558,7 +558,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
x = f /foo * 2/gm
|
||||
x = if true then /\n/ else /[.,]+/
|
||||
|
||||
grade = (student, period=(if b? then 7 else 6), messages={"A": "Excellent"}) ->
|
||||
grade = (student, period=(if b? then 7 else 6), messages={"A": "Excellent"}) ->
|
||||
if student.excellentWork
|
||||
"A+"
|
||||
else if student.okayStuff
|
||||
@ -638,7 +638,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
s = trim(ini_strings(i))
|
||||
|
||||
' skipping empty strings and comments
|
||||
if mid(s, 1, 1) <> "#" and len(s) > 0 then
|
||||
if mid(s, 1, 1) <> "#" and len(s) > 0 then
|
||||
' obtaining key and value
|
||||
parts = split(s, "=", -1, 1)
|
||||
|
||||
@ -667,14 +667,14 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
#Const DEBUG = True
|
||||
|
||||
Namespace Highlighter.Test
|
||||
''' <summary>This is an example class.</summary>
|
||||
''' <summary>This is an example class.</summary>
|
||||
Public Class Program
|
||||
Protected Shared hello As Integer = 3
|
||||
Private Const ABC As Boolean = False
|
||||
|
||||
#Region "Code"
|
||||
' Cheers!
|
||||
<STAThread()> _
|
||||
<STAThread()> _
|
||||
Public Shared Sub Main(ByVal args() As String, ParamArray arr As Object) Handles Form1.Click
|
||||
On Error Resume Next
|
||||
If ABC Then
|
||||
@ -689,7 +689,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
End Try
|
||||
Next
|
||||
Else
|
||||
Dim l As New System.Collections.List<String>()
|
||||
Dim l As New System.Collections.List<String>()
|
||||
SyncLock l
|
||||
If TypeOf l Is Decimal And l IsNot Nothing Then
|
||||
RemoveHandler button1.Paint, delegate
|
||||
@ -793,7 +793,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
Repeat
|
||||
ReadBufSize:=InFile.Read(Buffer,BufSize);
|
||||
OutFile.Write(Buffer,ReadBufSize);
|
||||
Until ReadBufSize<>BufSize;
|
||||
Until ReadBufSize<>BufSize;
|
||||
Log('File '''+InFileName+''' copied'#13#10);
|
||||
Finally
|
||||
InFile.Free;
|
||||
@ -804,7 +804,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
**Java**
|
||||
|
||||
/**
|
||||
* @author John Smith <john.smith@example.com>
|
||||
* @author John Smith <john.smith@example.com>
|
||||
* @version 1.0
|
||||
*/
|
||||
package l2f.gameserver.model;
|
||||
@ -817,7 +817,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
public void moveTo(int x, int y, int z) {
|
||||
_ai = null;
|
||||
_log.warning("Should not be called");
|
||||
if (1 > 5) {
|
||||
if (1 > 5) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -839,16 +839,16 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
|
||||
**C++**
|
||||
|
||||
#include <iostream>
|
||||
#include <iostream>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
/* An annoying "Hello World" example */
|
||||
for (auto i = 0; i < 0xFFFF; i++)
|
||||
cout << "Hello, World!" << endl;
|
||||
for (auto i = 0; i < 0xFFFF; i++)
|
||||
cout << "Hello, World!" << endl;
|
||||
|
||||
char c = '\n';
|
||||
unordered_map <string, vector<string> > m;
|
||||
unordered_map <string, vector<string> > m;
|
||||
m["key"] = "\\\\"; // this is an error
|
||||
|
||||
return -2e3 + 12l;
|
||||
@ -856,7 +856,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
|
||||
**Objective C**
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "Dependency.h"
|
||||
|
||||
@protocol WorldDataSource
|
||||
@ -866,7 +866,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
- (BOOL)allowsToLive;
|
||||
@end
|
||||
|
||||
@interface Test : NSObject <HelloDelegate, WorldDataSource> {
|
||||
@interface Test : NSObject <HelloDelegate, WorldDataSource> {
|
||||
NSString *_greeting;
|
||||
}
|
||||
|
||||
@ -927,7 +927,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
|
||||
var t = new Track(); // same as: Track t = new Track();
|
||||
var s = "hello"; // same as: string s = "hello";
|
||||
var l = new List<int>(); // same as: List<int> l = new List<int>();
|
||||
var l = new List<int>(); // same as: List<int> l = new List<int>();
|
||||
var i = 10; // same as: int i = 10;
|
||||
|
||||
|
||||
@ -957,7 +957,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
|
||||
public class Program
|
||||
{
|
||||
/// <summary>The entry point to the program.</summary>
|
||||
/// <summary>The entry point to the program.</summary>
|
||||
public static int Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("Hello, World!");
|
||||
@ -970,7 +970,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
}
|
||||
}
|
||||
|
||||
async Task<int> AccessTheWebAsync()
|
||||
async Task<int> AccessTheWebAsync()
|
||||
{
|
||||
// ...
|
||||
string urlContents = await getStringTask;
|
||||
@ -988,16 +988,16 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
*)
|
||||
let checkList alist =
|
||||
match alist with
|
||||
| [] -> 0
|
||||
| [a] -> 1
|
||||
| [a; b] -> 2
|
||||
| [a; b; c] -> 3
|
||||
| _ -> failwith "List is too big!"
|
||||
| [] -> 0
|
||||
| [a] -> 1
|
||||
| [a; b] -> 2
|
||||
| [a; b; c] -> 3
|
||||
| _ -> failwith "List is too big!"
|
||||
|
||||
|
||||
type IEncoding =
|
||||
abstract Encode : string -> string
|
||||
abstract Decode : string -> string
|
||||
abstract Encode : string -> string
|
||||
abstract Decode : string -> string
|
||||
|
||||
let text = "Some text..."
|
||||
let text2 = @"A ""verbatim"" string..."
|
||||
@ -1005,18 +1005,18 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
Some "long" string...
|
||||
"""
|
||||
|
||||
let rec fib x = if x <= 2 then 1 else fib(x-1) + fib(x-2)
|
||||
let rec fib x = if x <= 2 then 1 else fib(x-1) + fib(x-2)
|
||||
|
||||
let fibs =
|
||||
Async.Parallel [ for i in 0..40 -> async { return fib(i) } ]
|
||||
|> Async.RunSynchronously
|
||||
Async.Parallel [ for i in 0..40 -> async { return fib(i) } ]
|
||||
|> Async.RunSynchronously
|
||||
|
||||
type Sprocket(gears) =
|
||||
member this.Gears : int = gears
|
||||
|
||||
[<AbstractClass>]
|
||||
[<AbstractClass>]
|
||||
type Animal =
|
||||
abstract Speak : unit -> unit
|
||||
abstract Speak : unit -> unit
|
||||
|
||||
type Widget =
|
||||
| RedWidget
|
||||
@ -1024,9 +1024,9 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
|
||||
type Point = {X: float; Y: float;}
|
||||
|
||||
[<Measure>]
|
||||
[<Measure>]
|
||||
type s
|
||||
let minutte = 60<s>
|
||||
let minutte = 60<s>
|
||||
|
||||
**D**
|
||||
|
||||
@ -1041,7 +1041,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
enum COMPILED_ON = __TIMESTAMP__; // special token
|
||||
|
||||
enum character = '©';
|
||||
enum copy_valid = '&copy;';
|
||||
enum copy_valid = '©';
|
||||
enum backslash_escaped = '\\';
|
||||
|
||||
// string literals
|
||||
@ -1097,7 +1097,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
|
||||
FrameBegin 0
|
||||
Display "Scene" "framebuffer" "rgb"
|
||||
Option "searchpath" "shader" "+&:/home/kew"
|
||||
Option "searchpath" "shader" "+&:/home/kew"
|
||||
Option "trace" "int maxdepth" [4]
|
||||
Attribute "visibility" "trace" [1]
|
||||
Attribute "irradiance" "maxerror" [0.1]
|
||||
@ -1137,7 +1137,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
string $class[] = getClassification( `nodeType $shape` );
|
||||
|
||||
|
||||
if ( ( `size $class` ) > 0 && ( "light" == $class[0] ) )
|
||||
if ( ( `size $class` ) > 0 && ( "light" == $class[0] ) )
|
||||
{
|
||||
$selectedLights[ `size $selectedLights` ] = $shape;
|
||||
}
|
||||
@ -1170,7 +1170,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
layout(triangle_strip, max_vertices = 3) out;
|
||||
|
||||
void main() {
|
||||
for(int i = 0; i < gl_in.length(); i++) {
|
||||
for(int i = 0; i < gl_in.length(); i++) {
|
||||
gl_Position = gl_in[i].gl_Position;
|
||||
EmitVertex();
|
||||
}
|
||||
@ -1209,7 +1209,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
|
||||
**SmallTalk**
|
||||
|
||||
Object>>method: num
|
||||
Object>>method: num
|
||||
"comment 123"
|
||||
| var1 var2 |
|
||||
(1 to: num) do: [:i | |var| ^i].
|
||||
@ -1257,7 +1257,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
"Prompts
|
||||
for CD"
|
||||
(prompt-read "Title" 1.53 1 2/4 1.7 1.7e0 2.9E-4 +42 -7 #b001 #b001/100 #o777 #O777 #xabc55 #c(0 -5.6))
|
||||
(prompt-read "Artist" &rest)
|
||||
(prompt-read "Artist" &rest)
|
||||
(or (parse-integer (prompt-read "Rating") :junk-allowed t) 0)
|
||||
(if x (format t "yes") (format t "no" nil) ;and here comment
|
||||
)
|
||||
@ -1287,11 +1287,11 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
(def
|
||||
^{:macro true
|
||||
:added "1.0"}
|
||||
let (fn* let [&form &env & decl] (cons 'let* decl)))
|
||||
let (fn* let [&form &env & decl] (cons 'let* decl)))
|
||||
|
||||
(def
|
||||
|
||||
defn (fn defn [&form &env name & fdecl]
|
||||
defn (fn defn [&form &env name & fdecl]
|
||||
(let [m (conj {:arglists (list 'quote (sigs fdecl))} m)
|
||||
m (let [inline (:inline m)
|
||||
ifn (first inline)
|
||||
@ -1337,13 +1337,13 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
ExpiresActive On
|
||||
ExpiresByType application/x-javascript "access plus 1 days"
|
||||
|
||||
<Location /maps/>
|
||||
<Location /maps/>
|
||||
RewriteMap map txt:map.txt
|
||||
RewriteMap lower int:tolower
|
||||
RewriteCond %{REQUEST_URI} ^/([^/.]+)\.html$ [NC]
|
||||
RewriteCond ${map:${lower:%1}|NOT_FOUND} !NOT_FOUND
|
||||
RewriteRule .? /index.php?q=${map:${lower:%1}} [NC,L]
|
||||
</Location>
|
||||
</Location>
|
||||
|
||||
**nginx**
|
||||
|
||||
@ -1653,25 +1653,25 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
subtype RS is std_logic_vector (1 downto 0);
|
||||
begin
|
||||
if reset = '0' then
|
||||
QT <= '0';
|
||||
QT <= '0';
|
||||
else
|
||||
if rising_edge(C) then
|
||||
if not (R'stable(T) and S'stable(T)) then
|
||||
QT <= 'X';
|
||||
QT <= 'X';
|
||||
else
|
||||
case RS'(R&S) is
|
||||
when "01" => QT <= '1';
|
||||
when "10" => QT <= '0';
|
||||
when "11" => QT <= 'X';
|
||||
when others => null;
|
||||
case RS'(R&S) is
|
||||
when "01" => QT <= '1';
|
||||
when "10" => QT <= '0';
|
||||
when "11" => QT <= 'X';
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
Q <= QT;
|
||||
nQ <= not QT;
|
||||
Q <= QT;
|
||||
nQ <= not QT;
|
||||
end architecture behaviour;
|
||||
|
||||
**Parser 3**
|
||||
@ -1689,7 +1689,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
@create[aParam1;aParam2][local1;local2]
|
||||
^connect[mysql://host/database?ClientCharset=windows-1251]
|
||||
^for[i](1;10){
|
||||
<p class="paragraph">^eval($i+10)</p>
|
||||
<p class="paragraph">^eval($i+10)</p>
|
||||
^connect[mysql://host/database]{
|
||||
$tab[^table::sql{select * from `table` where a='1'}]
|
||||
$var_Name[some${value}]
|
||||
@ -1722,7 +1722,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
\begin{document}
|
||||
\section*{Highlight.js}
|
||||
\begin{table}[c|c]
|
||||
$\frac 12\, + \, \frac 1{x^3}\text{Hello \! world}$ & \textbf{Goodbye\~ world} \\\eTiX $ \pi=400 $
|
||||
$\frac 12\, + \, \frac 1{x^3}\text{Hello \! world}$ & \textbf{Goodbye\~ world} \\\eTiX $ \pi=400 $
|
||||
\end{table}
|
||||
Ch\'erie, \c{c}a ne me pla\^\i t pas! % comment \b
|
||||
G\"otterd\"ammerung~45\%=34.
|
||||
@ -1754,8 +1754,8 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
|
||||
-- Type class for converting StringLike types to and from strict ByteStrings
|
||||
class DataPacket a where
|
||||
toStrictBS :: a -> Strict.ByteString
|
||||
fromStrictBS :: Strict.ByteString -> a
|
||||
toStrictBS :: a -> Strict.ByteString
|
||||
fromStrictBS :: Strict.ByteString -> a
|
||||
|
||||
instance DataPacket Strict.ByteString where
|
||||
toStrictBS = id
|
||||
@ -1763,16 +1763,16 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
fromStrictBS = id
|
||||
{-# INLINE fromStrictBS #-}
|
||||
|
||||
openBoundUDPPort :: String -> Int -> IO Socket
|
||||
openBoundUDPPort :: String -> Int -> IO Socket
|
||||
openBoundUDPPort uri port = do
|
||||
s <- getUDPSocket
|
||||
bindAddr <- inet_addr uri
|
||||
s <- getUDPSocket
|
||||
bindAddr <- inet_addr uri
|
||||
let a = SockAddrInet (toEnum port) bindAddr
|
||||
bindSocket s a
|
||||
return s
|
||||
|
||||
pingUDPPort :: Socket -> SockAddr -> IO ()
|
||||
pingUDPPort s a = sendTo s (Strict.singleton 0) a >> return ()
|
||||
pingUDPPort :: Socket -> SockAddr -> IO ()
|
||||
pingUDPPort s a = sendTo s (Strict.singleton 0) a >> return ()
|
||||
|
||||
**Erlang**
|
||||
|
||||
@ -1790,36 +1790,36 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
channel
|
||||
}).
|
||||
|
||||
test(Foo)->Foo.
|
||||
test(Foo)->Foo.
|
||||
|
||||
init([Shell, Exec]) ->
|
||||
init([Shell, Exec]) ->
|
||||
{ok, #state{shell = Shell, exec = Exec}};
|
||||
init([Shell]) ->
|
||||
init([Shell]) ->
|
||||
false = not true,
|
||||
io:format("Hello, \"~p!~n", [atom_to_list('World')]),
|
||||
{ok, #state{shell = Shell}}.
|
||||
|
||||
concat([Single]) -> Single;
|
||||
concat(RList) ->
|
||||
concat([Single]) -> Single;
|
||||
concat(RList) ->
|
||||
EpsilonFree = lists:filter(
|
||||
fun (Element) ->
|
||||
fun (Element) ->
|
||||
case Element of
|
||||
epsilon -> false;
|
||||
_ -> true
|
||||
epsilon -> false;
|
||||
_ -> true
|
||||
end
|
||||
end,
|
||||
RList),
|
||||
case EpsilonFree of
|
||||
[Single] -> Single;
|
||||
Other -> {concat, Other}
|
||||
[Single] -> Single;
|
||||
Other -> {concat, Other}
|
||||
end.
|
||||
|
||||
union_dot_union({union, _}=U1, {union, _}=U2) ->
|
||||
union_dot_union({union, _}=U1, {union, _}=U2) ->
|
||||
union(lists:flatten(
|
||||
lists:map(
|
||||
fun (X1) ->
|
||||
fun (X1) ->
|
||||
lists:map(
|
||||
fun (X2) ->
|
||||
fun (X2) ->
|
||||
concat([X1, X2])
|
||||
end,
|
||||
union_to_list(U2)
|
||||
@ -1831,32 +1831,32 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
|
||||
**Erlang REPL**
|
||||
|
||||
1> Str = "abcd".
|
||||
1> Str = "abcd".
|
||||
"abcd"
|
||||
2> L = test:length(Str).
|
||||
2> L = test:length(Str).
|
||||
4
|
||||
3> Descriptor = {L, list_to_atom(Str)}.
|
||||
3> Descriptor = {L, list_to_atom(Str)}.
|
||||
{4,abcd}
|
||||
4> L.
|
||||
4> L.
|
||||
4
|
||||
5> b().
|
||||
5> b().
|
||||
Descriptor = {4,abcd}
|
||||
L = 4
|
||||
Str = "abcd"
|
||||
ok
|
||||
6> f(L).
|
||||
6> f(L).
|
||||
ok
|
||||
7> b().
|
||||
7> b().
|
||||
Descriptor = {4,abcd}
|
||||
Str = "abcd"
|
||||
ok
|
||||
8> {L, _} = Descriptor.
|
||||
8> {L, _} = Descriptor.
|
||||
{4,abcd}
|
||||
9> L.
|
||||
9> L.
|
||||
4
|
||||
10> 2#101.
|
||||
10> 2#101.
|
||||
5
|
||||
11> 1.85e+3.
|
||||
11> 1.85e+3.
|
||||
1850
|
||||
|
||||
**Rust**
|
||||
@ -1879,7 +1879,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
12E+99_f64; // type f64
|
||||
|
||||
/* Factorial */
|
||||
fn fac(n: int) -> int {
|
||||
fn fac(n: int) -> int {
|
||||
let s: str = "This is
|
||||
a multi-line string.
|
||||
|
||||
@ -1887,39 +1887,39 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
let c: char = 'Ф';
|
||||
|
||||
let result = 1, i = 1;
|
||||
while i <= n { // No parens around the condition
|
||||
while i <= n { // No parens around the condition
|
||||
result *= i;
|
||||
i += 1;
|
||||
}
|
||||
ret result;
|
||||
}
|
||||
|
||||
pure fn pure_length<T>(ls: list<T>) -> uint { /* ... */ }
|
||||
pure fn pure_length<T>(ls: list<T>) -> uint { /* ... */ }
|
||||
|
||||
type t = map::hashtbl<int,str>;
|
||||
let x = id::<int>(10);
|
||||
type t = map::hashtbl<int,str>;
|
||||
let x = id::<int>(10);
|
||||
|
||||
// Define some modules.
|
||||
#[path = "foo.rs"]
|
||||
mod foo;
|
||||
|
||||
iface seq<T> {
|
||||
fn len() -> uint;
|
||||
iface seq<T> {
|
||||
fn len() -> uint;
|
||||
}
|
||||
|
||||
impl <T> of seq<T> for [T] {
|
||||
fn len() -> uint { vec::len(self) }
|
||||
impl <T> of seq<T> for [T] {
|
||||
fn len() -> uint { vec::len(self) }
|
||||
fn iter(b: fn(T)) {
|
||||
for elt in self { b(elt); }
|
||||
}
|
||||
}
|
||||
|
||||
enum list<T> {
|
||||
enum list<T> {
|
||||
nil;
|
||||
cons(T, @list<T>);
|
||||
cons(T, @list<T>);
|
||||
}
|
||||
|
||||
let a: list<int> = cons(7, @cons(13, @nil));
|
||||
let a: list<int> = cons(7, @cons(13, @nil));
|
||||
|
||||
**Matlab**
|
||||
|
||||
@ -1932,7 +1932,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
for i = 1: n-1
|
||||
len(i) = points(i + 1, 1) - points(i, 1);
|
||||
end
|
||||
while(max(len) > 2 * min(len))
|
||||
while(max(len) > 2 * min(len))
|
||||
[d, i] = max(len);
|
||||
k = on_margin(points, i, d, -1);
|
||||
m = on_margin(points, i + 1, d, 1);
|
||||
@ -1966,7 +1966,7 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
|
||||
library(ggplot2)
|
||||
|
||||
centre <- function(x, type, ...) {
|
||||
centre <- function(x, type, ...) {
|
||||
switch(type,
|
||||
mean = mean(x),
|
||||
median = median(x),
|
||||
@ -1995,8 +1995,8 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
1L + 30
|
||||
plot(cars, xlim=20)
|
||||
plot(cars, xlim=0x20)
|
||||
foo<-30
|
||||
my.data.3 <- read() # not a number
|
||||
foo<-30
|
||||
my.data.3 <- read() # not a number
|
||||
c(1,2,3)
|
||||
1%%2
|
||||
|
||||
@ -2025,8 +2025,8 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
For If In Else Next Break .. .... "NULL" `NULL` 'NULL'
|
||||
|
||||
# operators
|
||||
+, -, *, /, %%, ^, >, >=, <, <=, ==, !=, !, &, |, ~,
|
||||
->, <-, <<-, $, :, ::
|
||||
+, -, *, /, %%, ^, >, >=, <, <=, ==, !=, !, &, |, ~,
|
||||
->, <-, <<-, $, :, ::
|
||||
|
||||
# infix operator
|
||||
foo %union% bar
|
||||
@ -2056,17 +2056,17 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
let D;
|
||||
|
||||
attr D is LambdaTerm-like means
|
||||
(dom D qua Tree) is finite &
|
||||
::> *143,306
|
||||
(dom D qua Tree) is finite &
|
||||
::> *143,306
|
||||
for r st r in dom D holds
|
||||
r is FinSequence of {0,1} &
|
||||
r^<*0*> in dom D implies D.r = 0;
|
||||
r is FinSequence of {0,1} &
|
||||
r^<*0*> in dom D implies D.r = 0;
|
||||
end;
|
||||
|
||||
registration
|
||||
cluster LambdaTerm-like for DecoratedTree of NAT;
|
||||
existence;
|
||||
::> *4
|
||||
::> *4
|
||||
end;
|
||||
|
||||
definition
|
||||
@ -2080,22 +2080,22 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
|
||||
pred M beta N means
|
||||
ex p st
|
||||
M|p beta_shallow N|p &
|
||||
M|p beta_shallow N|p &
|
||||
for q st not p is_a_prefix_of q holds
|
||||
[r,x] in M iff [r,x] in N;
|
||||
end;
|
||||
|
||||
theorem Th4:
|
||||
ProperPrefixes (v^<*x*>) = ProperPrefixes v \/ {v}
|
||||
ProperPrefixes (v^<*x*>) = ProperPrefixes v \/ {v}
|
||||
proof
|
||||
thus ProperPrefixes (v^<*x*>) c= ProperPrefixes v \/ {v}
|
||||
thus ProperPrefixes (v^<*x*>) c= ProperPrefixes v \/ {v}
|
||||
proof
|
||||
let y;
|
||||
assume y in ProperPrefixes (v^<*x*>);
|
||||
assume y in ProperPrefixes (v^<*x*>);
|
||||
then consider v1 such that
|
||||
A1: y = v1 and
|
||||
A2: v1 is_a_proper_prefix_of v^<*x*> by TREES_1:def 2;
|
||||
v1 is_a_prefix_of v & v1 <> v or v1 = v by A2,TREES_1:9;
|
||||
A2: v1 is_a_proper_prefix_of v^<*x*> by TREES_1:def 2;
|
||||
v1 is_a_prefix_of v & v1 <> v or v1 = v by A2,TREES_1:9;
|
||||
then
|
||||
v1 is_a_proper_prefix_of v or v1 in {v} by TARSKI:def 1,XBOOLE_0:def 8;
|
||||
then y in ProperPrefixes v or y in {v} by A1,TREES_1:def 2;
|
||||
@ -2109,15 +2109,15 @@ Highlight.js highlights syntax in code examples on blogs, forums and in fact on
|
||||
then consider v1 such that
|
||||
A5: y = v1 and
|
||||
A6: v1 is_a_proper_prefix_of v by TREES_1:def 2;
|
||||
v is_a_prefix_of v^<*x*> by TREES_1:1;
|
||||
then v1 is_a_proper_prefix_of v^<*x*> by A6,XBOOLE_1:58;
|
||||
v is_a_prefix_of v^<*x*> by TREES_1:1;
|
||||
then v1 is_a_proper_prefix_of v^<*x*> by A6,XBOOLE_1:58;
|
||||
hence thesis by A5,TREES_1:def 2;
|
||||
end;
|
||||
v^{} = v by FINSEQ_1:34;
|
||||
then
|
||||
v is_a_prefix_of v^<*x*> & v <> v^<*x*> by FINSEQ_1:33,TREES_1:1;
|
||||
then v is_a_proper_prefix_of v^<*x*> by XBOOLE_0:def 8;
|
||||
then y in ProperPrefixes v or y = v & v in ProperPrefixes (v^<*x*>)
|
||||
v is_a_prefix_of v^<*x*> & v <> v^<*x*> by FINSEQ_1:33,TREES_1:1;
|
||||
then v is_a_proper_prefix_of v^<*x*> by XBOOLE_0:def 8;
|
||||
then y in ProperPrefixes v or y = v & v in ProperPrefixes (v^<*x*>)
|
||||
by A3,TARSKI:def 1,TREES_1:def 2;
|
||||
hence thesis by A4;
|
||||
end;
|
||||
@ -2132,7 +2132,7 @@ Explicit Python highlighting
|
||||
count(x)
|
||||
|
||||
|
||||
Language set on <pre>
|
||||
Language set on <pre>
|
||||
|
||||
for x in [1, 2, 3]:
|
||||
count(x)
|
||||
@ -2149,9 +2149,9 @@ Replacing TAB with 4 spaces
|
||||
|
||||
Custom markup
|
||||
|
||||
<<a href="http://dev.w3.org/html5/spec/Overview.html#the-div-element">div</a> id="contents">
|
||||
<del><p>Hello, World!</del><!-- A comment should not break merging --><ins>Goodbye, cruel world!</ins>
|
||||
</div>
|
||||
<<a href="http://dev.w3.org/html5/spec/Overview.html#the-div-element">div</a> id="contents">
|
||||
<del><p>Hello, World!</del><!-- A comment should not break merging --><ins>Goodbye, cruel world!</ins>
|
||||
</div>
|
||||
|
||||
Custom markup + TAB replacement
|
||||
|
||||
|
2
js/highlight.min.js
vendored
2
js/highlight.min.js
vendored
Bestand-diff onderdrukt omdat een of meer regels te lang zijn
Laden…
Verwijs in nieuw issue
Block a user