forked from highlightjs/highlight.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.html
executable file
·4050 lines (3431 loc) · 92 KB
/
test.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<head>
<title>highlight.js test</title>
<meta charset="utf-8">
<link rel="stylesheet" title="Default" href="styles/default.css">
<link rel="alternate stylesheet" title="Dark" href="styles/dark.css">
<link rel="alternate stylesheet" title="FAR" href="styles/far.css">
<link rel="alternate stylesheet" title="IDEA" href="styles/idea.css">
<link rel="alternate stylesheet" title="Sunburst" href="styles/sunburst.css">
<link rel="alternate stylesheet" title="Zenburn" href="styles/zenburn.css">
<link rel="alternate stylesheet" title="Visual Studio" href="styles/vs.css">
<link rel="alternate stylesheet" title="Ascetic" href="styles/ascetic.css">
<link rel="alternate stylesheet" title="Magula" href="styles/magula.css">
<link rel="alternate stylesheet" title="GitHub" href="styles/github.css">
<link rel="alternate stylesheet" title="Google Code" href="styles/googlecode.css">
<link rel="alternate stylesheet" title="Brown Paper" href="styles/brown_paper.css">
<link rel="alternate stylesheet" title="School Book" href="styles/school_book.css">
<link rel="alternate stylesheet" title="IR Black" href="styles/ir_black.css">
<link rel="alternate stylesheet" title="Solarized - Dark" href="styles/solarized_dark.css">
<link rel="alternate stylesheet" title="Solarized - Light" href="styles/solarized_light.css">
<link rel="alternate stylesheet" title="Arta" href="styles/arta.css">
<link rel="alternate stylesheet" title="Monokai" href="styles/monokai.css">
<link rel="alternate stylesheet" title="Monokai Sublime" href="styles/monokai_sublime.css">
<link rel="alternate stylesheet" title="XCode" href="styles/xcode.css">
<link rel="alternate stylesheet" title="Pojoaque" href="styles/pojoaque.css">
<link rel="alternate stylesheet" title="Rainbow" href="styles/rainbow.css">
<link rel="alternate stylesheet" title="Tomorrow" href="styles/tomorrow.css">
<link rel="alternate stylesheet" title="Tomorrow Night" href="styles/tomorrow-night.css">
<link rel="alternate stylesheet" title="Tomorrow Night Bright" href="styles/tomorrow-night-bright.css">
<link rel="alternate stylesheet" title="Tomorrow Night Blue" href="styles/tomorrow-night-blue.css">
<link rel="alternate stylesheet" title="Tomorrow Night Eighties" href="styles/tomorrow-night-eighties.css">
<link rel="alternate stylesheet" title="Railscasts" href="styles/railscasts.css">
<link rel="alternate stylesheet" title="Obsidian" href="styles/obsidian.css">
<link rel="alternate stylesheet" title="Docco" href="styles/docco.css">
<link rel="alternate stylesheet" title="Mono Blue" href="styles/mono-blue.css">
<link rel="alternate stylesheet" title="Foundation" href="styles/foundation.css">
<link rel="alternate stylesheet" title="Atelier Dune - Dark" href="styles/atelier-dune.dark.css">
<link rel="alternate stylesheet" title="Atelier Dune - Light" href="styles/atelier-dune.light.css">
<link rel="alternate stylesheet" title="Atelier Forest - Dark" href="styles/atelier-forest.dark.css">
<link rel="alternate stylesheet" title="Atelier Forest - Light" href="styles/atelier-forest.light.css">
<link rel="alternate stylesheet" title="Atelier Heath - Dark" href="styles/atelier-heath.dark.css">
<link rel="alternate stylesheet" title="Atelier Heath - Light" href="styles/atelier-heath.light.css">
<link rel="alternate stylesheet" title="Atelier Lakeside - Dark" href="styles/atelier-lakeside.dark.css">
<link rel="alternate stylesheet" title="Atelier Lakeside - Light" href="styles/atelier-lakeside.light.css">
<link rel="alternate stylesheet" title="Atelier Seaside - Dark" href="styles/atelier-seaside.dark.css">
<link rel="alternate stylesheet" title="Atelier Seaside - Light" href="styles/atelier-seaside.light.css">
<link rel="alternate stylesheet" title="Paraíso - Dark" href="styles/paraiso.dark.css">
<link rel="alternate stylesheet" title="Paraíso - Light" href="styles/paraiso.light.css">
<link rel="alternate stylesheet" title="Colorbrewer" href="styles/color-brewer.css">
<link rel="alternate stylesheet" title="Codepen.io Embed" href="styles/codepen-embed.css">
<link rel="alternate stylesheet" title="Kimbie - Dark" href="styles/kimbie.dark.css">
<link rel="alternate stylesheet" title="Kimbie - Light" href="styles/kimbie.light.css">
<link rel="alternate stylesheet" title="Hybrid" href="styles/hybrid.css">
<style>
/* Base styles */
body {
font: small Arial, sans-serif;
}
h2 {
font: bold 100% Arial, sans-serif;
margin-top: 2em;
margin-bottom: 0.5em;
}
table {
width: 100%;
padding: 0;
border-collapse: collapse;
}
th {
width: 12em;
padding: 0; margin: 0;
}
td {
padding-bottom: 1em;
}
td, th {
vertical-align: top;
text-align: left;
}
pre {
margin: 0;
font-size: medium;
}
.hljs-debug {
color: red;
}
/* Style switcher */
ul#switch {
width: 66em;
-webkit-column-width: 15em;
-webkit-column-gap: 2em;
-moz-column-width: 15em;
-moz-column-gap: 2em;
-o-column-width: 15em;
-o-column-gap: 2em;
column-width: 15em;
column-gap: 2em;
list-style: none;
overflow: auto;
padding: 0;
margin: 0;
}
ul#switch li {
-webkit-column-break-inside: avoid;
-moz-column-break-inside: avoid;
-o-column-break-inside: avoid;
column-break-inside: avoid;
padding: 0.1em;
margin: 0.1em 1em 0.1em 0;
background: #EEE;
cursor: pointer;
}
ul#switch li.current {
background: #CCC;
}
/* Tests */
.test {
color: #888;
font-weight: normal;
margin: 2em 0 0 0;
}
.test var {
font-style: normal;
}
.passed {
color: green;
}
.failed, .failed a {
color: red;
}
.code {
font: medium monospace;
}
.code .hljs-keyword {
font-weight: bold;
}
/* Export form */
#export_from, #export_to {
width: 98%;
}
address {
margin-top: 4em;
}
</style>
<script src="../build/highlight.pack.js"></script>
<script>
hljs.configure({tabReplace: ' '});
hljs.initHighlightingOnLoad();
</script>
<script>
// Stylesheet switcher © Vladimir Epifanov <[email protected]>
(function(container_id) {
if (window.addEventListener) {
var attach = function(el, ev, handler) {
el.addEventListener(ev, handler, false);
}
} else if (window.attachEvent) {
var attach = function(el, ev, handler) {
el.attachEvent('on' + ev, handler);
}
} else {
var attach = function(el, ev, handler) {
ev['on' + ev] = handler;
}
}
attach(window, 'load', function() {
var current = null;
var info = {};
var links = document.getElementsByTagName('link');
var ul = document.createElement('ul');
for (var i = 0; (link = links[i]); i++) {
if ((link.getAttribute('rel').indexOf('style') != -1) && link.title) {
var title = link.title;
info[title] = {
'link': link,
'li': document.createElement('li')
};
ul.appendChild(info[title].li);
info[title].li.title = title;
info[title].link.disabled = true;
info[title].li.appendChild(document.createTextNode(title));
attach(info[title].li, 'click', (function (el) {
return function() {
current.li.className = '';
current.link.disabled = true;
current = el;
current.li.className = 'current';
current.link.disabled = false;
}
})(info[title]));
}
}
current = info['Default'];
current.li.className = 'current';
current.link.disabled = false;
ul.id = 'switch';
container = document.getElementById(container_id);
container.appendChild(ul);
});
})('styleswitcher');
</script>
<script>
// Test result detection © Ivan Sagalaev <[email protected]>
function testDetection() {
if (!hljs.initHighlighting.called) {
window.setTimeout(testDetection, 500);
return;
}
var table = document.getElementById('autotest');
var tds = table.getElementsByTagName('TD');
var failed = [];
var passed, result
for (var i = 0; i < tds.length; i++) {
var tdClass = tds[i].className;
tds[i].id = 'anchor-' + tdClass.replace(/[^\w]/, '-');
if (hljs.getLanguage(tdClass)) {
var code = tds[i].getElementsByTagName('CODE')[0];
var langClass = code.className.replace('hljs', '').trim();
passed = (tdClass == langClass);
result = document.createElement('DIV');
result.className = 'test';
result.innerHTML = '<var class="'+ (passed ? 'passed' : 'failed') +'">' + langClass + '</var>';
result.innerHTML += ' (' + code.result.re + ')';
if (code.second_best) {
result.innerHTML += '<br>' + code.second_best.language + ' (' + code.second_best.re + ')';
}
tds[i].parentNode.getElementsByTagName('th')[0].appendChild(result);
if (!passed) {
failed.push('<a href="#' + tds[i].id + '">' + tdClass + '</a>');
}
} else {
tds[i].parentNode.style.display = 'none';
}
}
var summary = document.getElementById('summary');
summary.innerHTML = failed.length ? ('Failed tests: ' + failed.join(', ')) : 'All tests passed';
summary.className = failed.length ? 'failed' : 'passed';
}
testDetection();
</script>
<script>
// Highlighted code export © Vladimir Gubarkov <[email protected]>
String.prototype.escape = function() {
return this.replace(/&/gm, '&').replace(/</gm, '<').replace(/>/gm, '>');
};
function ExportDoIt() {
var export_from = document.getElementById("export_from");
var export_to = document.getElementById("export_to");
var export_view = document.getElementById("export_view");
var selector = document.getElementById("langSelector");
var selectedLang = selector.options[selector.selectedIndex].value.toLowerCase();
if (selectedLang) {
export_view.innerHTML = '<pre><code class="' + selectedLang + '">' + export_from.value.escape() + "</code></pre>";
} else { // try auto
export_view.innerHTML = '<pre><code>' + export_from.value.escape() + "</code></pre>";
}
hljs.highlightBlock(export_view.firstChild.firstChild);
export_to.value = export_view.innerHTML;
}
function ExportCopyToBuffer(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>
<body>
<p>This is a demo/test page showing all languages supported by <a href="https://highlightjs.org/">highlight.js</a>.
Most snippets do not contain working code :-).
<div id="styleswitcher">
<h2>Styles</h2>
</div>
<h2>Automatically detected languages</h2>
<p id="summary">...</p>
<table id="autotest">
<tr>
<th>Python
<td class="python">
<pre>
<code>@requires_authorization
def somefunc(param1='', param2=0):
r'''A docstring'''
if param1 > param2: # interesting
print 'Gre\'ater'
return (param2 - param1 + 1 + 0b10l) or None
class SomeClass:
pass
>>> message = '''interpreter
... prompt'''
</code></pre>
<tr>
<th>Python's profiler output
<td class="profile">
<pre><code> 261917242 function calls in 686.251 CPU seconds
ncalls tottime filename:lineno(function)
152824 513.894 {method 'sort' of 'list' objects}
129590630 83.894 rrule.py:842(__cmp__)
129590630 82.439 {cmp}
153900 1.296 rrule.py:399(_iter)
304393/151570 0.963 rrule.py:102(_iter_cached)
</code></pre>
<tr>
<th>Ruby
<td class="ruby">
<pre><code>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
include Comparable
# @param test
# @return [String] nothing
def foo(test)
Thread.new do |blockvar|
ABC::DEF.reverse(:a_symbol, :'a symbol', :<=>, 'test' + ?\012)
answer = valid?4 && valid?CONST && ?A && ?A.ord
end.join
end
def [](index) self[index] end
def ==(other) other == self end
end
class Car < ActiveRecord::Base
has_many :wheels, class_name: 'Wheel', foreign_key: 'car_id'
scope :available, -> { where(available: true) }
end
hash = {1 => 'one', 2 => 'two'}
2.0.0p0 :001 > ['some']
=> ["some"]
</code></pre>
<tr>
<th>ERB
<td class="erb">
<pre><code><%# this is a comment %>
<% @posts.each do |post| %>
<p><%= link_to post.title, post %></p>
<% end %>
<%- available_things = things.select(&:available?) -%>
<%%- x = 1 + 2 -%%>
<%% value = 'real string #{@value}' %%>
<%%= available_things.inspect %%>
</code></pre>
<tr>
<th>Haml
<td class="haml">
<pre><code>!!! XML
%html
%body
%h1.jumbo{:id=>"a", :style=>'font-weight: normal', :title=>title} highlight.js
/html comment
-# ignore this line
%ul(style='margin: 0')
-items.each do |i|
%i= i
= variable
=variable2
~ variable3
~variable4
The current year is #{DataTime.now.year}.
</code></pre>
<tr>
<th>Nix
<td class="nix">
<pre><code>{ stdenv, foo, bar ? false, ... }:
/*
* foo
*/
let
a = 1; # just a comment
b = null;
c = toString 10;
in stdenv.mkDerivation rec {
name = "foo-${version}";
version = "1.3";
configureFlags = [ "--with-foo2" ] ++ stdenv.lib.optional bar "--with-foo=${ with stdenv.lib; foo }"
postInstall = ''
${ if true then "--${test}" else false }
'';
meta = with stdenv.lib; {
homepage = https://nixos.org;
};
}
</code></pre>
<tr>
<th>Perl
<td class="perl">
<pre><code># loads object
sub load
{
my $flds = $c->db_load($id,@_) || do {
Carp::carp "Can`t load (class: $c, id: $id): '$!'"; return undef
};
my $o = $c->_perl_new();
$id12 = $id / 24 / 3600;
$o->{'ID'} = $id12 + 123;
#$o->{'SHCUT'} = $flds->{'SHCUT'};
my $p = $o->props;
my $vt;
$string =~ m/^sought_text$/;
$items = split //, 'abc';
$string //= "bar";
for my $key (keys %$p)
{
if(${$vt.'::property'}) {
$o->{$key . '_real'} = $flds->{$key};
tie $o->{$key}, 'CMSBuilder::Property', $o, $key;
}
}
$o->save if delete $o->{'_save_after_load'};
# GH-117
my $g = glob("/usr/bin/*");
return $o;
}
=head1 NAME
POD till the end of file
</code></pre>
<tr>
<th>PHP
<td class="php">
<pre><code>require_once 'Zend/Uri/Http.php';
namespace Location\Web;
interface Factory
{
static function _factory();
}
abstract class URI extends BaseURI implements Factory
{
abstract function test();
public static $st1 = 1;
const ME = "Yo";
var $list = NULL;
private $var;
/**
* Returns a URI
*
* @return URI
*/
static public function _factory($stats = array(), $uri = 'http')
{
echo __METHOD__;
$uri = explode(':', $uri, 0b10);
$schemeSpecific = isset($uri[1]) ? $uri[1] : '';
$desc = 'Multi
line description';
// Security check
if (!ctype_alnum($scheme)) {
throw new Zend_Uri_Exception('Illegal scheme');
}
$this->var = 0 - self::$st;
$this->list = list(Array("1"=> 2, 2=>self::ME));
return [
'uri' => $uri,
'value' => null,
];
}
}
echo URI::ME . URI::$st1;
__halt_compiler () ; datahere
datahere
datahere */
datahere</code></pre>
<tr>
<th>Scala
<td class="scala">
<pre><code>case class Person(name: String, age: Int)
def absoluteValue(n: Int): Int =
if (n < 0) -n else n
val hux = "hux"
def mux = "mux"
def qux: String = "qux"
type ξ[A] = (A, A)
trait Hist { lhs =>
def ⊕(rhs: Hist): Hist
}
def gsum[A: Ring](as: Seq[A]): A =
as.foldLeft(Ring[A].zero)(_ + _)
sealed trait Compass
case object North extends Compass
case object South extends Compass
case object East extends Compass
case object West extends Compass
trait Cake {
type T;
val things: Seq[T]
abstract class Spindler
def spindle(s: Spindler, ts: Seq[T], reversed: Boolean = false): Seq[T]
}
val colors = Map(
"red" -> 0xFF0000,
"turquoise" -> 0x00FFFF,
"black" -> 0x000000,
"orange" -> 0xFF8040,
"brown" -> 0x804000)
lazy val ns = for {
x <- 0 until 100
y <- 0 until 100
} yield (x + y) * 33.33
</code></pre>
<tr>
<th>Groovy</th>
<td class="groovy">
<pre><code>#!/usr/bin/env groovy
package model
import groovy.transform.CompileStatic
import java.util.List as MyList
trait Distributable {
void distribute(String version) {}
}
@CompileStatic
class Distribution implements Distributable {
double number = 1234.234 / 567
def otherNumber = 3 / 4
boolean archivable = condition ?: true
def ternary = a ? b : c
String name = "Guillaume"
Closure description = null
List<DownloadPackage> packages = []
String regex = ~/.*foo.*/
String multi = '''
multi line string
''' + """
now with double quotes and ${gstring}
""" + $/
even with dollar slashy strings
/$
/**
* description method
* @param cl the closure
*/
void description(Closure cl) { this.description = cl }
void version(String name, Closure versionSpec) {
def closure = { println "hi" } as Runnable
MyList ml = [1, 2, [a: 1, b:2,c :3]]
for (ch in "name") {}
// single line comment
DownloadPackage pkg = new DownloadPackage(version: name)
check that: true
label:
def clone = versionSpec.rehydrate(pkg, pkg, pkg)
/*
now clone() in a multiline comment
*/
clone()
packages.add(pkg)
assert 4 / 2 == 2
}
}
</code></pre>
<tr>
<th>Go
<td class="go">
<pre><code>package main
import (
"fmt"
"os"
)
const (
Sunday = iota
numberOfDays // this constant is not exported
)
type Foo interface {
FooFunc(int, float32) (complex128, []int)
}
type Bar struct {
os.File /* multi-line
comment */
PublicData chan int
}
func main() {
ch := make(chan int)
ch <- 1
x, ok := <- ch
ok = true
float_var := 1.0e10
defer fmt.Println('\'')
defer fmt.Println(`exitting now\`)
var fv1 float64 = 0.75
go println(len("hello world!"))
return
}
</code></pre>
<tr>
<th>XML
<td class="xml">
<pre><code><?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>
</code></pre>
<tr>
<th>HTML (with inline css and javascript)
<td class="xml">
<pre><code><!DOCTYPE html>
<title>Title</title>
<style>body {width: 500px;}</style>
<script type="application/javascript">
function $init() {return true;}
</script>
<body>
<p checked class="title" id='title'>Title</p>
<!-- here goes the rest of the page -->
</body>
</code></pre>
<tr>
<th>Lasso
<td class="lasso">
<pre><code><?LassoScript
/* Lasso 8 */
local('query' = 'SELECT * FROM `'+var:'table'+'` WHERE `id` > 10
ORDER BY `Name` LIMIT 30');
Inline: -Username=$DBuser, -Password=$DBpass, -Database=$DBname, -sql=#query;
var("class1.name" = (found_count != 0 ? "subtotal" | "nonefound"),
"total_amount" = found_count);
records;
output: "<tr>"loop_count"</tr>";
/records;
/Inline;
?><div class="[$class1.name]">[$total_amount]</div>
<?lasso
/* Lasso 9 */ ?>
[noprocess] causes [delimiters] to be <?=skipped?> until the next [/noprocess]
[
define strings_combine(value::string, ...other)::string => {
local(result = #value->append(#other->asString&trim))
return #result
}
/**! descriptive text */
define person => type {
parent entity
data name::string, protected nickname, birthdate :: date
data private ssn = null
private showAge() => { return ..age }
protected fullName() => `"` + .nickname + `"` + .'name'
public ssnListed::boolean => .ssn() ? true | false
}
define person->name=(value) => {
.'name' = #value
return self->'name'
}
] <!-- an HTML comment <?=disables delimiters?> as well -->
[no_square_brackets] disables [square brackets] for the rest of the file
<?=
// query expression
with n in array((:-12, 0xABCD, 3.14159e14), (:NaN, -infinity, .57721))
let swapped = pair(#n->second, #n->first)
group #swapped by #n->first into t
let key = #t->key
order by #key
select pair(#key, #1)
do {^
#n->upperCase
^}
?>
</code></pre>
<tr>
<th>Markdown
<td class="markdown">
<pre>
<code># hello world
you can write text [with links](http://example.com) inline or [link references][1].
* one _thing_ has *em*phasis
* two __things__ are **bold**
[1]: http://example.com
---
hello world
===========
<this_is inline="xml"></this_is>
> markdown is so cool
so are code segments
1. one thing (yeah!)
2. two thing `i can write code`, and `more` wipee!
</code></pre>
<tr>
<th>AsciiDoc
<td class="asciidoc">
<pre>
<code>Hello, World!
============
Author Name, <[email protected]>
you can write text http://example.com[with links], optionally
using an explicit link:http://example.com[link prefix].
* single quotes around a phrase place 'emphasis'
** alternatively, you can put underlines around a phrase to add _emphasis_
* astericks around a phrase make the text *bold*
* pluses around a phrase make it +monospaced+
* `smart' quotes using a leading backtick and trailing single quote
** use two of each for double ``smart'' quotes
- escape characters are supported
- you can escape a quote inside emphasized text like 'here\'s johnny!'
term:: definition
another term:: another definition
// this is just a comment
Let's make a break.
'''
////
we'll be right with you
after this brief interruption.
////
== We're back!
Want to see a image::images/tiger.png[Tiger]?
.Nested highlighting
++++
<this_is inline="xml"></this_is>
++++
____
asciidoc is so powerful.
____
another quote:
[quote, Sir Arthur Conan Doyle, The Adventures of Sherlock Holmes]
____
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
____
Getting Literal
---------------
want to get literal? prefix a line with a space.
....
I'll join that party, too.
....
. one thing (yeah!)
. two thing `i can write code`, and `more` wipee!
NOTE: AsciiDoc is quite cool, you should try it.</code></pre>
<tr>
<th>Django templates
<td class="django">
<pre><code>{% if articles|length %}
{% 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>
{% endfor %}
{% endif %}
{% comment %}
Comments may be long and multiline.
Markup is <em>not</em> highlighted within comments.
{% endcomment %}
</code></pre>
<tr>
<th>Twig templates
<td class="twig">
<pre><code>{% if posts|length %}
{% for article in articles %}
<div>
{{ article.title|upper() }}
{# outputs 'WELCOME' #}
</div>
{% endfor %}
{% endif %}
{% set user = json_encode(user) %}
{{ random(['apple', 'orange', 'citrus']) }}
{{ include(template_from_string("Hello {{ name }}")) }}
{#
Comments may be long and multiline.
Markup is <em>not</em> highlighted within comments.
#}
</code></pre>
<tr>
<th>Handlebars
<td class="handlebars">
<pre>
<code><h3>Hours</h3>
<ul>
{{#each content.users}}
<li {{bindAttr hello="world"}}>{{firstName}}</li>
{{/each}}
</ul>
</code></pre>
<tr>
<th>Dust.js
<td class="dust">
<pre>
<code><h3>Hours</h3>
<ul>
{#users}
<li {hello}}>{firstName}</li>{~n}
{/users}
</ul>
</code></pre>
<tr>
<th>CSS
<td class="css">
<pre><code>@media screen and (-webkit-min-device-pixel-ratio: 0) {
body:first-of-type pre::after {
content: 'highlight: ' attr(class);
}
body {
background: linear-gradient(45deg, blue, red);
}
}
@import url('print.css');
@page:right {
margin: 1cm 2cm 1.3cm 4cm;
}
@font-face {
font-family: Chunkfive; src: url('Chunkfive.otf');
}
div.text,
#content,
li[lang=ru] {
font: Tahoma, Chunkfive, sans-serif;
background: url('hatch.png') /* wtf? */; color: #F0F0F0 !important;
width: 100%;
}
</code></pre>
<tr>
<th>SCSS
<td class="scss">
<pre><code>@import "compass/reset";
// variables
$colorGreen: #008000;
$colorGreenDark: darken($colorGreen, 10);
@mixin container {
max-width: 980px;
}
// mixins with parameters
@mixin button($color:green) {
@if ($color == green) {
background-color: #008000;
}
@else if ($color == red) {
background-color: #B22222;
}
}
button {
@include button(red);
}
div,
.navbar,
#header,
input[type="input"] {
font-family: "Helvetica Neue", Arial, sans-serif;
width: auto;
margin: 0 auto;
display: block;
}
.row-12 > [class*="spans"] {
border-left: 1px solid #B5C583;
}
// nested definitions
ul {
width: 100%;