All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.bower_components.google-code-prettify.src.run_prettify.js Maven / Gradle / Ivy

There is a newer version: 1.2.2.1-jre17
Show newest version
// Copyright (C) 2013 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.


// Looks at query parameters to decide which language handlers and style-sheets
// to load.

// Query Parameter     Format           Effect                        Default
// +------------------+---------------+------------------------------+--------+
// | autorun=         | true | false  | If true then prettyPrint()   | "true" |
// |                  |               | is called on page load.      |        |
// +------------------+---------------+------------------------------+--------+
// | lang=            | language name | Loads the language handler   | Can    |
// |                  |               | named "lang-.js".      | appear |
// |                  |               | See available handlers at    | many   |
// |                  |               | http://code.google.com/p/    | times. |
// |                  |               | google-code-prettify/source/ |        |
// |                  |               | browse/trunk/src             |        |
// +------------------+---------------+------------------------------+--------+
// | skin=            | skin name     | Loads the skin stylesheet    | none.  |
// |                  |               | named ".css".          |        |
// |                  |               | http://code.google.com/p/    |        |
// |                  |               | google-code-prettify/source/ |        |
// |                  |               | browse/trunk/styles          |        |
// +------------------+---------------+------------------------------+--------+
// | callback=        | JS identifier | When "prettyPrint" finishes  | none   |
// |                  |               | window.exports[js_ident] is  |        |
// |                  |               | called.                      |        |
// |                  |               | The callback must be under   |        |
// |                  |               | exports to reduce the risk   |        |
// |                  |               | of XSS via query parameter   |        |
// |                  |               | injection.                   |        |
// +------------------+---------------+------------------------------+--------+

// Exmaples
// .../prettify.js?lang=css&skin=sunburst
//   1. Loads the CSS language handler which can be used to prettify CSS
//      stylesheets, HTML