SyntaxHighlighter v4.0.1

java

package tutorial;

import com.opensymphony.xwork2.ActionSupport;

public class HelloWorld extends ActionSupport {
  private String name;
  public String getName() {
  return name;
  }
  public void setName(String name) {
      this.name = name;
  }
  public String execute() {
      name = "Hello, " + name + "!";
      return SUCCESS;
  }
}

xml

<?xml version="1.0" encoding="utf-8" ?>

<!-- comments -->
<rootNode xmlns:namespace="http://www.w3.org/TR/html4/">
  <childNodes>
    <childNode attribute1 = "value"
               namespace:attribute2='value'
               attribute3=''/>
    <childNode />
    <childNode />
    <childNode />
    <childNode
      attr1="value"
      attr2="10"
      attr3="hello"
          >
      value
    </childNode>
    <namespace:childNode>
      <![CDATA[
              this is some CDATA content
              <!-- comments inside cdata -->
              <b alert='false'>tags inside cdata</b>
          ]]>

      value = "plain string outside"
      hello = world
    </namespace:childNode>
  </childNodes>
</rootNode>

<!--
  Multiline comments <b>tag</b>
-->

javascript

/**
 * This is a JavaScript sample.
 */
var matches = require('./matches');

module.exports = {
  /**
   * Applies all regular expression to the code and stores all found
   * matches in the `this.matches` array.
   */
  parse: function(code, regexList, opts)
  {
    var result = [];

    regexList = regexList || [];

    for (var i = 0, l = regexList.length; i < l; i++)
      // BUG: length returns len+1 for array if methods added to prototype chain (oising@gmail.com)
      if (typeof regexList[i] === 'object')
        result = result.concat(matches.find(code, regexList[i]));

    result = matches.sort(result);
    result = matches.removeNested(result);
    result = matches.compact(result);

    return result;
  }
};

bash

#!/bin/bash
X=3
Y=4
empty_string=""
if [ $X -lt $Y ]  # is $X less than $Y ?
then
  echo "\$X=${X}, which is smaller than \$Y=${Y}"
fi
 
if [ -n "$empty_string" ]; then
  echo "empty string is non_empty"
fi
 
if [ -e "${HOME}/.fvwmrc" ]; then             # test to see if ~/.fvwmrc exists
  echo "you have a .fvwmrc file"
  if [ -L "${HOME}/.fvwmrc" ]; then       # is it a symlink ? 
      echo "it's a symbolic link"
  elif [ -f "${HOME}/.fvwmrc" ]; then     # is it a regular file ?
      echo "it's a regular file"
  fi
else
  echo "you have no .fvwmrc file"
fi

sql

-- Data model to support XML exchange with thecontent repository of
-- the ArsDigita Community System
 
-- Copyright (C) 1999-2000 ArsDigita Corporation
-- Author: Karl Goldstein (karlg@arsdigita.com)
 
-- $Id: content-xml.sql,v 1.3 2001/04/28 19:58:39 donb Exp $
 
-- This is free software distributed under the terms of the GNU Public
-- License.  Full text of the license is available from the GNU Project:
-- http://www.fsf.org/copyleft/gpl.html
 
-- A sequence for uniquely identifying uploaded XML documents until
-- they are inserted into the repository
 
create sequence cr_xml_doc_seq;
 
-- create global temporary table cr_xml_docs (
--     doc_id        integer primary key,
--     doc           CLOB
-- ) on commit delete rows;
 
create table cr_xml_docs (
    doc_id        integer primary key,
    doc           text
);
 
comment on table cr_xml_docs is '
  A temporary table for holding uploaded XML documents for the
  duration of a transaction, until they can be inserted into
  the content repository.
';

css

.syntaxhighlighter,
.syntaxhighlighter .bold,
.syntaxhighlighter .italic,
.syntaxhighlighter .line .number,
.syntaxhighlighter.nogutter .line .number,
.syntaxhighlighter .line .content,
.syntaxhighlighter .line .content code,
.syntaxhighlighter .line .content .block,
.syntaxhighlighter .line .content .spaces,
.syntaxhighlighter.nogutter .line .content,
.syntaxhighlighter .bar,
.syntaxhighlighter.collapsed .bar,
.syntaxhighlighter.nogutter .bar,
.syntaxhighlighter .ruler,
.syntaxhighlighter.collapsed .lines,
.syntaxhighlighter.collapsed .ruler,
.syntaxhighlighter.printing,
.syntaxhighlighter.printing .tools,
.syntaxhighlighter.printing li,
.syntaxhighlighter .toolbar,
.syntaxhighlighter.nogutter .toolbar,
.syntaxhighlighter.collapsed .toolbar,
.syntaxhighlighter .toolbar a,
.syntaxhighlighter .toolbar a:hover
{
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  background: none;
  text-align: left;
  float: none;
  vertical-align: baseline;
  position: static;
  left: auto;
  top: auto;
  right: auto;
  bottom: auto;
  height: auto;
  width: auto;
  line-height: normal;
  font-family: "Consolas", "Monaco", "Bitstream Vera Sans Mono", "Courier New", Courier, monospace;
  font-weight: normal;
  font-style: normal;
  font-size: 100%;
}
 
.syntaxhighlighter
{
  font-size: 16px;
  width: 99%;
  overflow: auto;
  margin: 18px 0 18px 0 !important;
  padding-top: 1px; /* adds a little border on top when controls are hidden */
}
 
.syntaxhighlighter .bold {
  font-weight: bold;
}
 
.syntaxhighlighter .italic {
  font-style: italic;
}
 
.syntaxhighlighter .line .number
{
  float: left;
  width: 45px;
  padding-right: 5px;
  text-align: right;
  display: block;
}
 
/* Disable numbers when no gutter option is set */
.syntaxhighlighter.nogutter .line .number
{
  display: none;
}
 
.syntaxhighlighter .line .content
{
  margin-left: 50px;
  padding-left: 4px;
  display: block;
}
 
.syntaxhighlighter .line .content .block
{
  display: block;
  padding-left: 18px;
  text-indent: -18px;
}
 
.syntaxhighlighter .line .content .spaces
{
  display: none;
}
 
/* Disable border and margin on the lines when no gutter option is set */
.syntaxhighlighter.nogutter .line .content
{
  margin-left: 0;
  border-left: none;
}
 
.syntaxhighlighter .bar
{
  padding-left: 50px;
}
 
.syntaxhighlighter.collapsed .bar,
.syntaxhighlighter.nogutter .bar
{
  padding-left: 0px;
}
 
.syntaxhighlighter .ruler
{
  padding-left: 4px;
  overflow: hidden;
  padding-bottom: 2px;
}
 
/* Adjust some properties when collapsed */
 
.syntaxhighlighter.collapsed .lines,
.syntaxhighlighter.collapsed .ruler
{
  display: none;
}
 
/* Additional modifications when in print-view */
 
.syntaxhighlighter.printing
{
  border: none !important;
}
 
.syntaxhighlighter.printing .bar
{
  display: none !important;
}
 
/* Styles for the tools */
 
.syntaxhighlighter .toolbar
{
  font-size: 80%;
  font-family: Geneva, Verdana, Arial, Helvetica, sans-serif;
  padding: 1px 5px 5px 5px;
}
 
.syntaxhighlighter.nogutter .toolbar
{
  border-left: 0;
}
 
.syntaxhighlighter.collapsed .toolbar
{
  border-bottom: 0;
}
 
.syntaxhighlighter .toolbar a
{
  text-decoration: none;
  margin-right: 10px;
}
 
.syntaxhighlighter .toolbar a:hover
{
  text-decoration: underline;
  margin-right: 10px;
}