PageRenderTime 59ms CodeModel.GetById 33ms app.highlight 17ms RepoModel.GetById 2ms app.codeStats 0ms

/samples/scalate-presentation/src/highlight/test.html

http://github.com/scalate/scalate
HTML | 1196 lines | 1117 code | 74 blank | 5 comment | 0 complexity | 9d3363be7f460f1c845f89ed79075e7d MD5 | raw file
   1<!DOCTYPE html>
   2<head>
   3  <title>Highlight</title>
   4  <meta charset="utf-8">
   5
   6  <link rel="stylesheet" title="Default" href="styles/default.css">
   7  <link rel="alternate stylesheet" title="Dark" href="styles/dark.css">
   8  <link rel="alternate stylesheet" title="FAR" href="styles/far.css">
   9  <link rel="alternate stylesheet" title="IDEA" href="styles/idea.css">
  10  <link rel="alternate stylesheet" title="Sunburst" href="styles/sunburst.css">
  11  <link rel="alternate stylesheet" title="Zenburn" href="styles/zenburn.css">
  12  <link rel="alternate stylesheet" title="Visual Studio" href="styles/vs.css">
  13  <link rel="alternate stylesheet" title="Ascetic" href="styles/ascetic.css">
  14  <link rel="alternate stylesheet" title="Magula" href="styles/magula.css">
  15  <link rel="alternate stylesheet" title="GitHub" href="styles/github.css">
  16  <link rel="alternate stylesheet" title="Brown Paper" href="styles/brown_paper.css">
  17  <link rel="alternate stylesheet" title="School Book" href="styles/school_book.css">
  18  <link rel="alternate stylesheet" title="IR_Black" href="styles/ir_black.css">
  19  <style>
  20    h2 {
  21      font: bold 100% Arial, sans-serif;
  22      margin-top: 2em;
  23      margin-bottom: 0.5em;
  24    }
  25    table {
  26      width: 100%;
  27    }
  28    th {
  29      width: 10em; font-weight: normal;
  30    }
  31    td, th {
  32      vertical-align: top;
  33      text-align: left;
  34    }
  35    pre {
  36      margin-top: 0;
  37    }
  38    ul#switch {
  39      padding: 0;
  40      margin: 0 0 0 -0.5em;
  41    }
  42    ul#switch li {
  43      border-bottom: 1px dashed blue;
  44      display: inline;
  45      padding: 0;
  46      margin: 0.5em;
  47      cursor: pointer;
  48    }
  49    ul#switch li.current {
  50      border-bottom: none;
  51      cursor: default;
  52    }
  53  </style>
  54
  55  <!--
  56  Don't include languages as individual files in production environment.
  57  Instead use <script src="highlight.pack.js"></script> with highlight.pack.js
  58  containing all the languages you've chosen when downloading the library
  59  -->
  60  <script src="highlight.js"></script>
  61  <script src="languages/cs.js"></script>
  62  <script src="languages/python.js"></script>
  63  <script src="languages/mel.js"></script>
  64  <script src="languages/perl.js"></script>
  65  <script src="languages/axapta.js"></script>
  66  <script src="languages/cpp.js"></script>
  67  <script src="languages/sql.js"></script>
  68  <script src="languages/smalltalk.js"></script>
  69  <script src="languages/profile.js"></script>
  70  <script src="languages/bash.js"></script>
  71  <script src="languages/lua.js"></script>
  72  <script src="languages/html-xml.js"></script>
  73  <script src="languages/renderman.js"></script>
  74  <script src="languages/1c.js"></script>
  75  <script src="languages/delphi.js"></script>
  76  <script src="languages/dos.js"></script>
  77  <script src="languages/django.js"></script>
  78  <script src="languages/vbscript.js"></script>
  79  <script src="languages/ini.js"></script>
  80  <script src="languages/apache.js"></script>
  81  <script src="languages/nginx.js"></script>
  82  <script src="languages/ruby.js"></script>
  83  <script src="languages/css.js"></script>
  84  <script src="languages/lisp.js"></script>
  85  <script src="languages/java.js"></script>
  86  <script src="languages/javascript.js"></script>
  87  <script src="languages/php.js"></script>
  88  <script src="languages/diff.js"></script>
  89  <script src="languages/avrasm.js"></script>
  90  <script src="languages/parser3.js"></script>
  91  <script src="languages/scala.js"></script>
  92  <script src="languages/tex.js"></script>
  93  <script>
  94  hljs.tabReplace = '    ';
  95  hljs.initHighlightingOnLoad();
  96  </script>
  97
  98  <script>
  99  // A stylesheet switcher for the test page. Not part of the highlight.js itself
 100  // (c) Vladimir Epifanov <voldmar@voldmar.ru>
 101  (function(container_id) {
 102      if (window.addEventListener) {
 103          var attach = function(el, ev, handler) {
 104              el.addEventListener(ev, handler, false);
 105          }
 106      } else if (window.attachEvent) {
 107          var attach = function(el, ev, handler) {
 108              el.attachEvent('on' + ev, handler);
 109          }
 110      } else {
 111          var attach = function(el, ev, handler) {
 112              ev['on' + ev] = handler;
 113          }
 114      }
 115
 116
 117      attach(window, 'load', function() {
 118          var current = null;
 119
 120          var info = {};
 121          var links = document.getElementsByTagName('link');
 122          var ul = document.createElement('ul')
 123
 124          for (var i = 0; (link = links[i]); i++) {
 125              if (link.getAttribute('rel').indexOf('style') != -1
 126                  && link.title) {
 127
 128                  var title = link.title;
 129
 130                  info[title] = {
 131                  'link': link,
 132                  'li': document.createElement('li')
 133                  }
 134
 135                  ul.appendChild(info[title].li)
 136                  info[title].li.title = title;
 137
 138                  info[title].link.disabled = true;
 139
 140                  info[title].li.appendChild(document.createTextNode(title));
 141                  attach(info[title].li, 'click', (function (el) {
 142                      return function() {
 143                          current.li.className = '';
 144                          current.link.disabled = true;
 145                          current = el;
 146                          current.li.className = 'current';
 147                          current.link.disabled = false;
 148                      }})(info[title]));
 149              }
 150          }
 151
 152          current = info['Default']
 153          current.li.className = 'current';
 154          current.link.disabled = false;
 155
 156          ul.id = 'switch';
 157          container = document.getElementById(container_id);
 158          container.appendChild(ul);
 159      });
 160
 161  })('styleswitcher');
 162  </script>
 163<body>
 164
 165<p>This page is a demo/test showing all languages supported by <a href="http://softwaremaniacs.org/soft/highlight/">highlight.js</a>.
 166Most of the code doesn't work :-).
 167<p>You can see this page in several different styles bundled with the library or
 168write your own (and contribute it back!)
 169
 170<div id="styleswitcher"></div>
 171
 172<h2>Automatically detected languages</h2>
 173
 174<table>
 175  <tr>
 176    <th>Python
 177    <td>
 178<pre>
 179<code>@requires_authorization
 180def somefunc(param1, param2):
 181  r'''A docstring'''
 182  if param1 > param2: # interesting
 183    print 'Gre\'ater'
 184    print ''
 185  return (param2 - param1 + 1) or None
 186
 187class SomeClass:<br>    pass
 188</code></pre>
 189
 190  <tr>
 191    <th>Python's profiler output
 192    <td>
 193<pre><code>       261917242 function calls in 686.251 CPU seconds
 194
 195       ncalls  tottime  filename:lineno(function)
 196       152824  513.894  {method 'sort' of 'list' objects}
 197    129590630   83.894  rrule.py:842(__cmp__)
 198    129590630   82.439  {cmp}
 199       153900    1.296  rrule.py:399(_iter)
 200304393/151570    0.963  rrule.py:102(_iter_cached)
 201</code></pre>
 202
 203  <tr>
 204    <th>Ruby
 205    <td>
 206<pre><code>class A &lt; B; def self.create(object = User) object end end
 207class Zebra; def inspect; "X#{2 + self.object_id}" end end
 208
 209module ABC::DEF
 210  include Comparable
 211
 212  # @param test
 213  # @return [String] nothing
 214  def foo(test)
 215    Thread.new do |blockvar|
 216      ABC::DEF.reverse(:a_symbol, :'a symbol' + 'test' + test)
 217    end.join
 218  end
 219
 220  def [](index) self[index] end
 221  def ==(other) other == self end
 222end
 223
 224anIdentifier = an_identifier
 225Constant = 1
 226</code></pre>
 227
 228  <tr>
 229    <th>Perl
 230    <td>
 231<pre><code># loads object
 232sub load
 233{
 234  my $flds = $c-&gt;db_load($id,@_) || do {
 235    Carp::carp "Can`t load (class: $c, id: $id): '$!'"; return undef
 236  };
 237  my $o = $c-&gt;_perl_new();
 238  $id12 = $id;
 239  $o-&gt;{'ID'} = $id12 + 123;
 240  $o-&gt;{'PAPA'} = $flds-&gt;{'PAPA'};
 241  #$o-&gt;{'SHCUT'} = $flds-&gt;{'SHCUT'};
 242  my $p = $o-&gt;props;
 243  my $vt;
 244  $string =~ m/^sought_text$/;
 245  for my $key (keys %$p)
 246  {
 247    if(${$vt.'::property'}) {
 248      $o-&gt;{$key . '_real'} = $flds-&gt;{$key};
 249      tie $o-&gt;{$key}, 'CMSBuilder::Property', $o, $key;
 250    } else {
 251      $o-&gt;{$key} = $flds-&gt;{$key};
 252    }
 253  }
 254  $o-&gt;save if delete $o-&gt;{'_save_after_load'};
 255  return $o;
 256}
 257</code></pre>
 258
 259  <tr>
 260    <th>PHP
 261    <td>
 262<pre><code>require_once 'Zend.php';
 263require_once 'Zend/Uri/Exception.php';
 264require_once 'Zend/Uri/Http.php';
 265require_once 'Zend/Uri/Mailto.php';
 266
 267abstract class Zend_Uri
 268{
 269
 270  /**
 271   * Return a string representation of this URI.
 272   *
 273   * @see     getUri()
 274   * @return  string
 275   */
 276  public function __toString()
 277  {
 278      return $this-&gt;getUri();
 279  }
 280
 281  static public function factory($uri = 'http')
 282  {
 283      $uri = explode(':', $uri, 2);
 284      $scheme = strtolower($uri[0]);
 285      $schemeSpecific = isset($uri[1]) ? $uri[1] : '';
 286
 287      // Security check: $scheme is used to load a class file,
 288      // so only alphanumerics are allowed.
 289      if (!ctype_alnum($scheme)) {
 290          throw new Zend_Uri_Exception('Illegal scheme');
 291      }
 292  }
 293}
 294</code></pre>
 295
 296  <tr>
 297    <th>Scala
 298    <td>
 299<pre><code>object abstractTypes extends Application {
 300  abstract class SeqBuffer {
 301    type T; val element: Seq[T]; def length = element.length
 302  }
 303}
 304
 305/** Turn command line arguments to uppercase */
 306object Main {
 307  def main(args: Array[String]) {
 308    val res = for (a &lt;- args) yield a.toUpperCase
 309    println("Arguments: " + res.toString)
 310  }
 311}
 312
 313/** Maps are easy to use in Scala. */
 314object Maps {
 315  val colors = Map("red" -> 0xFF0000,
 316                   "turquoise" -> 0x00FFFF,
 317                   "black" -> 0x000000,
 318                   "orange" -> 0xFF8040,
 319                   "brown" -> 0x804000)
 320  def main(args: Array[String]) {
 321    for (name &lt;- args) println(
 322      colors.get(name) match {
 323        case Some(code) =>
 324          name + " has code: " + code
 325        case None =&gt;
 326          "Unknown color: " + name
 327      }
 328    )
 329  }
 330}
 331</code></pre>
 332
 333  <tr>
 334    <th>XML
 335    <td>
 336<pre><code>&lt;?xml version="1.0"?&gt;
 337&lt;response value="ok" xml:lang="en"&gt;
 338  &lt;text&gt;Ok&lt;/text&gt;
 339  &lt;comment html_allowed="true"/&gt;
 340  &lt;ns1:description&gt;&lt;![CDATA[
 341  CDATA is &lt;not&gt; magical.
 342  ]]&gt;&lt;/ns1:description&gt;
 343  &lt;a&gt;&lt;/a&gt; &lt;a/&gt;
 344&lt;/response&gt;
 345</code></pre>
 346
 347  <tr>
 348    <th>HTML (with inline css and javascript)
 349    <td>
 350<pre><code>&lt;head&gt;
 351  &lt;title&gt;Title&lt;/title&gt;
 352
 353  &lt;style&gt;
 354    body {
 355      width: 500px;
 356    }
 357  &lt;/style&gt;
 358
 359  &lt;script&gt;
 360    function someFunction() {
 361      return true;
 362    }
 363  &lt;/script&gt;
 364
 365&lt;body&gt;
 366  &lt;p class="something" id='12'&gt;Something&lt;/p&gt;
 367  &lt;p class=something&gt;Something&lt;/p&gt;
 368  &lt;!-- comment --&gt;
 369  &lt;p class&gt;Something&lt;/p&gt;
 370  &lt;p class="something" title="p"&gt;Something&lt;/p&gt;
 371&lt;/body&gt;
 372</code></pre>
 373
 374  <tr>
 375    <th>Django templates
 376    <td>
 377<pre><code>{% if articles|length %}
 378{% for article in articles %}
 379
 380{# Striped table #}
 381&lt;tr class="{% cycle odd,even %}"&gt;
 382  &lt;td&gt;{{ article|default:"Hi... "|escape }}&lt;/td&gt;
 383  &lt;td&gt;{{ article.date|date:"d.m.Y" }}&lt;/td&gt;
 384&lt;/tr&gt;
 385
 386{% endfor %}
 387{% endif %}
 388
 389{% comment %}
 390Comments may be long and
 391multiline.
 392{% endcomment %}
 393</code></pre>
 394
 395  <tr>
 396    <th>CSS
 397    <td>
 398<pre><code>body,
 399html {
 400  font: Tahoma, Arial, san-serif;
 401  background: url('hatch.png');
 402}
 403
 404@import url('print.css');
 405
 406@media screen and (-webkit-min-device-pixel-ratio: 0) {
 407  @page :left {
 408    body:first-of-type pre::after {
 409      content: 'highlight: ' attr(class);
 410    }
 411}
 412
 413#content {
 414  width: 100%; /* wide enough */
 415  height: 100%
 416}
 417
 418p[lang=ru] {
 419  color: #F0F0F0; background: white;
 420}
 421</code></pre>
 422
 423  <tr>
 424    <th>Javascript
 425    <td>
 426<pre><code>function $initHighlight(block) {
 427  if (block.className.search(/\bno\-highlight\b/) != -1)
 428    return false;
 429  try {
 430    blockText(block);
 431  } catch (e) {
 432    if (e == 'Complex markup')
 433      return;
 434  }//try
 435  var classes = block.className.split(/\s+/);
 436  for (var i = 0 / 2; i &lt; classes.length; i++) { // "0 / 2" should not be parsed as regexp start
 437    if (LANGUAGES[classes[i]]) {
 438      highlightLanguage(block, classes[i]);
 439      return;
 440    }//if
 441  }//for
 442  highlightAuto(block);
 443}//initHighlight</code></pre>
 444
 445  <tr>
 446    <th>VBScript
 447    <td>
 448<pre><code>' creating configuration storage and initializing with default values
 449Set cfg = CreateObject("Scripting.Dictionary")
 450
 451' reading ini file
 452for i = 0 to ubound(ini_strings)
 453    s = trim(ini_strings(i))
 454
 455    ' skipping empty strings and comments
 456    if mid(s, 1, 1) &lt;&gt; "#" and len(s) > 0 then
 457      ' obtaining key and value
 458      parts = split(s, "=", -1, 1)
 459
 460      if ubound(parts)+1 = 2 then
 461        parts(0) = trim(parts(0))
 462        parts(1) = trim(parts(1))
 463
 464        ' reading configuration and filenames
 465        select case lcase(parts(0))
 466          case "uncompressed""_postfix" cfg.item("uncompressed""_postfix") = parts(1)
 467          case "f"
 468                    options = split(parts(1), "|", -1, 1)
 469                    if ubound(options)+1 = 2 then
 470                      ' 0: filename,  1: options
 471                      ff.add trim(options(0)), trim(options(1))
 472                    end if
 473        end select
 474      end if
 475    end if
 476next</code></pre>
 477
 478  <tr>
 479    <th>Lua
 480    <td>
 481<pre><code>--[[
 482Simple signal/slot implementation
 483]]
 484local signal_mt = {
 485    __index = {
 486        register = table.insert
 487    }
 488}
 489function signal_mt.__index:emit(... --[[ Comment in params ]])
 490    for _, slot in ipairs(self) do
 491        slot(self, ...)
 492    end
 493end
 494local function create_signal()
 495    return setmetatable({}, signal_mt)
 496end
 497
 498-- Signal test
 499local signal = create_signal()
 500signal:register(function (signal, ...)
 501    print(...)
 502end)
 503signal:emit('Answer to Life, the Universe, and Everything:', 42)
 504
 505--[==[ [=[ [[
 506Nested ]]
 507multi-line ]=]
 508comment ]==]
 509[==[ Nested
 510[=[ multi-line
 511[[ string
 512]] ]=] ]==]
 513</code></pre>
 514
 515  <tr>
 516    <th>Delphi
 517    <td>
 518<pre><code>TList=Class(TObject)
 519Private
 520  Some: String;
 521Public
 522  Procedure Inside;
 523End;{TList}
 524
 525Procedure CopyFile(InFileName,var OutFileName:String);
 526Const
 527  BufSize=4096; (* Huh? *)
 528Var
 529  InFile,OutFile:TStream;
 530  Buffer:Array[1..BufSize] Of Byte;
 531  ReadBufSize:Integer;
 532Begin
 533  InFile:=Nil;
 534  OutFile:=Nil;
 535  Try
 536    InFile:=TFileStream.Create(InFileName,fmOpenRead);
 537    OutFile:=TFileStream.Create(OutFileName,fmCreate);
 538    Repeat
 539      ReadBufSize:=InFile.Read(Buffer,BufSize);
 540      OutFile.Write(Buffer,ReadBufSize);
 541    Until ReadBufSize&lt;&gt;BufSize;
 542    Log('File '''+InFileName+''' copied'#13#10);
 543  Finally
 544    InFile.Free;
 545    OutFile.Free;
 546  End;{Try}
 547End;{CopyFile}
 548</code></pre>
 549
 550  <tr>
 551    <th>Java
 552    <td>
 553<pre><code>package l2f.gameserver.model;
 554
 555import java.util.ArrayList;
 556
 557/**
 558 * Mother class of all character objects of the world (PC, NPC...)&lt;BR&gt;&lt;BR&gt;
 559 *
 560 */
 561public abstract class L2Character extends L2Object
 562{
 563  protected static final Logger _log = Logger.getLogger(L2Character.class.getName());
 564
 565  public static final Short ABNORMAL_EFFECT_BLEEDING = 0x0001; // not sure
 566  public static final Short ABNORMAL_EFFECT_POISON = 0x0002;
 567
 568  public void detachAI() {
 569    _ai = null;
 570    //jbf = null;
 571    if (1 > 5) {
 572      return;
 573    }
 574  }
 575
 576  public void moveTo(int x, int y, int z) {
 577    moveTo(x, y, z, 0);
 578  }
 579
 580  /** Task of AI notification */
 581  @SuppressWarnings( { "nls", "unqualified-field-access", "boxing" })
 582  public class NotifyAITask implements Runnable {
 583    private final CtrlEvent _evt;
 584
 585    public void run() {
 586      try {
 587        getAI().notifyEvent(_evt, null, null);
 588      } catch (Throwable t) {
 589        _log.warning("Exception " + t);
 590        t.printStackTrace();
 591      }
 592    }
 593  }
 594
 595}
 596</code></pre>
 597
 598  <tr>
 599    <th>C++
 600    <td>
 601<pre><code>#include &lt;iostream&gt;
 602
 603int main(int argc, char *argv[]) {
 604
 605  /* An annoying "Hello World" example */
 606  for (unsigned i = 0; i &lt; 0xFFFF; i++)
 607    cout &lt;&lt; "Hello, World!" &lt;&lt; endl;
 608
 609  char c = '\n'; // just a test
 610  map &lt;string, vector&lt;string&gt; &gt; m;
 611  m["key"] = "\\\\"; // yeah, I know it's an error
 612}
 613</code></pre>
 614
 615  <tr>
 616    <th>C#
 617    <td>
 618<pre><code>using System;
 619
 620public class Program
 621{
 622    /// &lt;summary&gt;The entry point to the program.&lt;/summary&gt;
 623    /// &lt;remarks&gt;
 624    /// Using the Visual Studio style, the tags in this comment
 625    /// should be grey, but this text should be green.
 626    /// This comment should be green on the inside:
 627    /// &lt;!-- I'm green! --&gt;
 628    /// &lt;/remarks&gt;
 629    public static int Main(string[] args)
 630    {
 631        Console.WriteLine("Hello, World!");
 632        string s = @"This
 633""string""
 634spans
 635multiple
 636lines!";
 637        return 0;
 638    }
 639}
 640</code></pre>
 641
 642  <tr>
 643    <th>RenderMan RSL
 644    <td>
 645<pre><code>#define TEST_DEFINE 3.14
 646/*	plastic surface shader
 647 *
 648 * 	Pixie is:
 649 * 	(c) Copyright 1999-2003 Okan Arikan. All rights reserved.
 650 */
 651
 652surface plastic (float Ka = 1, Kd = 0.5, Ks = 0.5, roughness = 0.1;
 653                 color specularcolor = 1;) {
 654  normal Nf = faceforward (normalize(N),I);
 655  Ci = Cs * (Ka*ambient() + Kd*diffuse(Nf)) + specularcolor * Ks *
 656       specular(Nf,-normalize(I),roughness);
 657  Oi = Os;
 658  Ci *= Oi;
 659}
 660</code></pre>
 661
 662  <tr>
 663    <th>RenderMan RIB
 664    <td>
 665<pre><code>FrameBegin 0
 666Display "Scene" "framebuffer" "rgb"
 667Option "searchpath" "shader" "+&:/home/kew"
 668Option "trace" "int maxdepth" [4]
 669Attribute "visibility" "trace" [1]
 670Attribute "irradiance" "maxerror" [0.1]
 671Attribute "visibility" "transmission" "opaque"
 672Format 640 480 1.0
 673ShadingRate 2
 674PixelFilter "catmull-rom" 1 1
 675PixelSamples 4 4
 676Projection "perspective" "fov" 49.5502811377
 677Scale 1 1 -1
 678
 679WorldBegin
 680
 681ReadArchive "Lamp.002_Light/instance.rib"
 682Surface "plastic"
 683ReadArchive "Cube.004_Mesh/instance.rib"
 684# ReadArchive "Sphere.010_Mesh/instance.rib"
 685# ReadArchive "Sphere.009_Mesh/instance.rib"
 686ReadArchive "Sphere.006_Mesh/instance.rib"
 687
 688WorldEnd
 689FrameEnd
 690</code></pre>
 691
 692  <tr>
 693    <th>MEL (Maya Embedded Language)
 694    <td>
 695<pre><code class="mel">proc string[] getSelectedLights()
 696
 697{
 698  string $selectedLights[];
 699
 700  string $select[] = `ls -sl -dag -leaf`;
 701
 702  for ( $shape in $select )
 703  {
 704    // Determine if this is a light.
 705    //
 706    string $class[] = getClassification( `nodeType $shape` );
 707
 708
 709    if ( ( `size $class` ) > 0 &amp;&amp; ( "light" == $class[0] ) )
 710    {
 711      $selectedLights[ `size $selectedLights` ] = $shape;
 712    }
 713  }
 714
 715  // Result is an array of all lights included in
 716
 717  // current selection list.
 718  return $selectedLights;
 719}
 720</code></pre>
 721
 722  <tr>
 723    <th>SQL
 724    <td>
 725<pre><code>BEGIN;
 726CREATE TABLE "cicero_topic" (
 727    "id" serial NOT NULL PRIMARY KEY,
 728    "forum_id" integer NOT NULL,
 729    "subject" varchar(255) NOT NULL,
 730    "created" timestamp with time zone NOT NULL
 731);
 732ALTER TABLE "cicero_topic"
 733ADD CONSTRAINT forum_id_refs_id_4be56999
 734FOREIGN KEY ("forum_id")
 735REFERENCES "cicero_forum" ("id")
 736DEFERRABLE INITIALLY DEFERRED;
 737
 738-- Initials
 739insert into "cicero_forum"
 740  ("slug", "name", "group", "ordering")
 741values
 742  ('test', 'Forum for te''sting', 'Test', 0);
 743
 744-- Test
 745select count(*) from cicero_forum;
 746
 747COMMIT;
 748</code></pre>
 749
 750  <tr>
 751    <th>SmallTalk
 752    <td>
 753<pre><code>Object>>method: num
 754    "comment 123"
 755    | var1 var2 |
 756    (1 to: num) do: [:i | |var| ^i].
 757    Klass with: var1.
 758    Klass new.
 759    arr := #('123' 123.345 #hello Transcript var $@).
 760    arr := #().
 761    var2 = arr at: 3.
 762    ^ self abc
 763
 764heapExample
 765    "HeapTest new heapExample"
 766    "Multiline
 767    decription"
 768    | n rnd array time sorted |
 769    n := 5000.
 770    "# of elements to sort"
 771    rnd := Random new.
 772    array := (1 to: n)
 773                collect: [:i | rnd next].
 774    "First, the heap version"
 775    time := Time
 776                millisecondsToRun: [sorted := Heap withAll: array.
 777    1
 778        to: n
 779        do: [:i |
 780            sorted removeFirst.
 781            sorted add: rnd next]].
 782    Transcript cr; show: 'Time for Heap: ' , time printString , ' msecs'.
 783    "The quicksort version"
 784    time := Time
 785                millisecondsToRun: [sorted := SortedCollection withAll: array.
 786    1
 787        to: n
 788        do: [:i |
 789            sorted removeFirst.
 790            sorted add: rnd next]].
 791    Transcript cr; show: 'Time for SortedCollection: ' , time printString , ' msecs'
 792</code></pre>
 793
 794  <tr>
 795    <th>Lisp
 796    <th><pre><code>(defun prompt-for-cd ()
 797   "Prompts
 798    for CD"
 799   (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))
 800   (prompt-read "Artist" &amp;rest)
 801   (or (parse-integer (prompt-read "Rating") :junk-allowed t) 0)
 802  (if x (format t "yes") (format t "no" nil) ;and here comment
 803  )
 804  ;; second line comment
 805  '(+ 1 2)
 806  (defvar *lines*)                ; list of all lines
 807  (position-if-not #'sys::whitespacep line :start beg))
 808  (quote (privet 1 2 3))
 809  '(hello world)
 810  (* 5 7)
 811  (1 2 34 5)
 812  (:use "aaaa")
 813  (let ((x 10) (y 20))
 814    (print (+ x y))
 815  )</code></pre>
 816
 817  <tr>
 818    <th>Ini file
 819    <td>
 820<pre><code>;Settings relating to the location and loading of the database
 821[Database]
 822ProfileDir=.
 823ShowProfileMgr=smart
 824Profile1_Name[] = "\|/_-=MegaDestoyer=-_\|/"
 825DefaultProfile=True
 826AutoCreate = no
 827
 828[AutoExec]
 829Use="prompt"
 830Glob=autoexec_*.ini
 831AskAboutIgnoredPlugins=0
 832</code></pre>
 833
 834  <tr>
 835    <th>Apache
 836    <td>
 837<pre><code># rewrite`s rules for wordpress pretty url
 838LoadModule rewrite_module  modules/mod_rewrite.so
 839RewriteCond %{REQUEST_FILENAME} !-f
 840RewriteCond %{REQUEST_FILENAME} !-d
 841RewriteRule . index.php [NC,L]
 842
 843ExpiresActive On
 844ExpiresByType application/x-javascript  "access plus 1 days"
 845
 846&lt;Location /maps/&gt;
 847  RewriteMap map txt:map.txt
 848  RewriteMap lower int:tolower
 849  RewriteCond %{REQUEST_URI} ^/([^/.]+)\.html$ [NC]
 850  RewriteCond ${map:${lower:%1}|NOT_FOUND} !NOT_FOUND
 851  RewriteRule .? /index.php?q=${map:${lower:%1}} [NC,L]
 852&lt;/Location&gt;
 853</code></pre>
 854
 855  <tr>
 856    <th>nginx
 857    <td>
 858<pre><code>user  www www;
 859worker_processes  2;
 860pid /var/run/nginx.pid;
 861error_log  /var/log/nginx.error_log  debug | info | notice | warn | error | crit;
 862
 863events {
 864    connections   2000;
 865    use kqueue | rtsig | epoll | /dev/poll | select | poll;
 866}
 867
 868http {
 869    log_format main      '$remote_addr - $remote_user [$time_local] '
 870                         '"$request" $status $bytes_sent '
 871                         '"$http_referer" "$http_user_agent" '
 872                         '"$gzip_ratio"';
 873
 874    send_timeout 3m;
 875    client_header_buffer_size 1k;
 876
 877    gzip on;
 878    gzip_min_length 1100;
 879
 880    #lingering_time 30;
 881
 882    server {
 883        listen        one.example.com;
 884        server_name   one.example.com  www.one.example.com;
 885        access_log   /var/log/nginx.access_log  main;
 886
 887        location / {
 888            proxy_pass         http://127.0.0.1/;
 889            proxy_redirect     off;
 890            proxy_set_header   Host             $host;
 891            proxy_set_header   X-Real-IP        $remote_addr;
 892            charset            koi8-r;
 893        }
 894
 895        location ~* \.(jpg|jpeg|gif)$ {
 896            root         /spool/www;
 897        }
 898    }
 899}
 900</code></pre>
 901
 902  <tr>
 903    <th>Diff
 904    <td>
 905<pre><code>Index: languages/ini.js
 906===================================================================
 907--- languages/ini.js    (revision 199)
 908+++ languages/ini.js    (revision 200)
 909@@ -1,8 +1,7 @@
 910 hljs.LANGUAGES.ini =
 911 {
 912   case_insensitive: true,
 913-  defaultMode:
 914-  {
 915+  defaultMode: {
 916     contains: ['comment', 'title', 'setting'],
 917     illegal: '[^\\s]'
 918   },
 919
 920*** /path/to/original timestamp
 921--- /path/to/new      timestamp
 922***************
 923*** 1,3 ****
 924--- 1,9 ----
 925+ This is an important
 926+ notice! It should
 927+ therefore be located at
 928+ the beginning of this
 929+ document!
 930
 931! compress the size of the
 932! changes.
 933
 934  It is important to spell
 935</code></pre>
 936
 937  <tr>
 938    <th>DOS batch files
 939    <td>
 940<pre><code>cd \
 941copy a b
 942ping 192.168.0.1
 943@rem ping 192.168.0.1
 944net stop sharedaccess
 945del %tmp% /f /s /q
 946del %temp% /f /s /q
 947ipconfig /flushdns
 948taskkill /F /IM JAVA.EXE /T
 949
 950cd Photoshop/Adobe Photoshop CS3/AMT/
 951if exist application.sif (
 952    ren application.sif _application.sif
 953) else (
 954    ren _application.sif application.sif
 955)
 956
 957taskkill /F /IM proquota.exe /T
 958
 959sfc /SCANNOW
 960
 961set path = test
 962
 963xcopy %1\*.* %2
 964</code></pre>
 965
 966  <tr>
 967    <th>Bash
 968    <td>
 969<pre><code>#!/bin/bash
 970
 971###### BEGIN CONFIG
 972ACCEPTED_HOSTS="/root/.hag_accepted.conf"
 973BE_VERBOSE=false
 974###### END CONFIG
 975
 976if [ "$UID" -ne 0 ]
 977then
 978 echo "Superuser rights is required"
 979 exit 2
 980fi
 981
 982genApacheConf(){
 983 if [[ "$2" = "www" ]]
 984 then
 985  full_domain=$1
 986 else
 987  full_domain=$2.$1
 988 fi
 989 host_root="${APACHE_HOME_DIR}$1/$2"
 990 echo -e "# Host $1/$2 :"
 991}
 992</code></pre>
 993
 994  <tr>
 995    <th>Axapta
 996    <td>
 997<pre><code>class ExchRateLoadBatch extends RunBaseBatch {
 998  ExchRateLoad rbc;
 999  container currencies;
1000  boolean actual;
1001  boolean overwrite;
1002  date beg;
1003  date end;
1004
1005  #define.CurrentVersion(5)
1006
1007  #localmacro.CurrentList
1008    currencies,
1009    actual,
1010    beg,
1011    end
1012  #endmacro
1013}
1014
1015public boolean unpack(container packedClass) {
1016  container       base;
1017  boolean         ret;
1018  Integer         version    = runbase::getVersion(packedClass);
1019
1020  switch (version) {
1021    case #CurrentVersion:
1022      [version, #CurrentList] = packedClass;
1023      return true;
1024    default:
1025      return false;
1026  }
1027  return ret;
1028}
1029</code></pre>
1030
1031  <tr>
1032    <th>1033    <td>
1034<pre><code>
1035#Если Клиент Тогда
1036Перем СимвольныйКодКаталога = "ля-ля-ля"; //комментарий
1037Функция Сообщить(Знач ТекстСообщения, ТекстСообщения2) Экспорт //комментарий к функции
1038  x=ТекстСообщения+ТекстСообщения2+"
1039  |строка1
1040  |строка2
1041  |строка3";
1042КонецФункции
1043#КонецЕсли
1044
1045// Процедура ПриНачалеРаботыСистемы
1046//
1047Процедура ПриНачалеРаботыСистемы()
1048  Обработки.Помощник.ПолучитьФорму("Форма").Открыть();
1049  d = '21.01.2008'
1050КонецПроцедуры
1051</code></pre>
1052
1053  <tr>
1054    <th>AVR Assembler
1055    <td>
1056<pre><code>;* Title:       Block Copy Routines
1057;* Version:     1.1
1058
1059.include "8515def.inc"
1060
1061    rjmp    RESET   ;reset handle
1062
1063.def    flashsize=r16       ;size of block to be copied
1064
1065flash2ram:
1066    lpm         ;get constant
1067    st  Y+,r0       ;store in SRAM and increment Y-pointer
1068    adiw    ZL,1        ;increment Z-pointer
1069    dec flashsize
1070    brne    flash2ram   ;if not end of table, loop more
1071    ret
1072
1073.def    ramtemp =r1     ;temporary storage register
1074.def    ramsize =r16        ;size of block to be copied
1075</code></pre>
1076
1077  <tr>
1078    <th>Parser 3
1079    <td>
1080<pre><code>@CLASS
1081base
1082
1083@USE
1084module.p
1085
1086@BASE
1087class
1088
1089# Comment for code
1090@create[aParam1;aParam2][local1;local2]
1091  ^connect[mysql://host/database?ClientCharset=windows-1251]
1092  ^for[i](1;10){
1093    &lt;p class=&quot;paragraph&quot;&gt;^eval($i+10)&lt;/p&gt;
1094    ^connect[mysql://host/database]{
1095      $tab[^table::sql{select * from `table` where a='1'}]
1096      $var_Name[some${value}]
1097    }
1098  }
1099
1100  ^rem{
1101    Multiline comment with code: $var
1102    ^while(true){
1103      ^for[i](1;10){
1104        ^sleep[]
1105      }
1106    }
1107  }
1108  ^taint[^#0A]
1109
1110@GET_base[]
1111## Comment for code
1112  # Isn't comment
1113  $result[$.hash_item1[one] $.hash_item2[two]]
1114</code></pre>
1115
1116  <tr>
1117    <th>TeX
1118    <td>
1119<pre>
1120<code>\documentclass{article}
1121\usepackage[koi8-r]{inputenc}
1122\hoffset=0pt
1123\voffset=.3em
1124\tolerance=400
1125\newcommand{\eTiX}{\TeX}
1126\begin{document}
1127\section*{Highlight.js}
1128\begin{table}[c|c]
1129$\frac 12\, + \, \frac 1{x^3}\text{Hello \! world}$ & \textbf{Goodbye\~ world} \\\eTiX $ \pi=400 $
1130\end{table}
1131Ch\'erie, \c{c}a ne me pla\^\i t pas! % comment \b
1132G\"otterd\"ammerung~45\%=34.
1133$$
1134    \int\limits_{0}^{\pi}\frac{4}{x-7}=3
1135$$
1136\end{document}
1137</code></pre>
1138</table>
1139
1140<h2>Special tests</h2>
1141
1142<table>
1143  <tr>
1144    <th>Explicit Python highlighting
1145    <td>
1146<pre><code class="python">for x in [1, 2, 3]:
1147  count(x)
1148</code></pre>
1149
1150  <tr>
1151    <th>Language set on &lt;pre&gt;
1152    <td>
1153<pre class="python"><code>for x in [1, 2, 3]:
1154  count(x)
1155</code></pre>
1156
1157  <tr>
1158    <th>HTML5-style language class (language-python)
1159    <td>
1160<pre class="python"><code>for x in [1, 2, 3]:
1161  count(x)
1162</code></pre>
1163
1164  <tr>
1165    <th>Replacing TAB with 4 spaces
1166    <td>
1167<pre><code class="python">for x in [1, 2, 3]:
1168	count(x)
1169</code></pre>
1170
1171  <tr>
1172    <th>Custom markup
1173    <td>
1174<pre><code>&lt;<a href="http://dev.w3.org/html5/spec/Overview.html#the-div-element">div</a> id="contents"&gt;
1175  <del>&lt;p&gt;Hello, World!</del>
1176&lt;/div&gt;
1177</code></pre>
1178
1179  <tr>
1180    <th>Custom markup + TAB replacement
1181    <td>
1182<pre><code class="python">for x in [1, 2, 3]:
1183<span style="background:yellow">	</span>count(x)
1184	if x == 3:
1185	<span style="background:yellow">	</span>count(x + 1)
1186</code></pre>
1187
1188  <tr>
1189    <th>Disabled highlighting
1190    <td>
1191<pre><code class="no-highlight">&lt;div id="contents"&gt;
1192  &lt;p&gt;Hello, World!
1193&lt;/div&gt;
1194</code></pre>
1195
1196</table>