~lutostag/ubuntu/utopic/maas/1.5.2

« back to all changes in this revision

Viewing changes to src/maasserver/static/jslibs/yui/3.4.1/docs/assets/vendor/prettify/README.html

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-03-15 18:14:08 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20120315181408-zgl94hzo0x4n99an
Tags: 0.1+bzr295+dfsg-0ubuntu2
* debian/patches:
  - 01-fix-database-settings.patch: Update to set PSERV_URL.
  - 02-pserv-config.patch: Set port to 8001.
* debian/maas.postinst: Run maas-import-isos on install.
* debian/control: Depends on rabbitmq-server.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
2
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
3
 
 
4
<html>
 
5
  <head>
 
6
    <title>Javascript code prettifier</title>
 
7
 
 
8
    <link href="src/prettify.css" type="text/css" rel="stylesheet" />
 
9
 
 
10
    <script src="src/prettify.js" type="text/javascript"></script>
 
11
 
 
12
    <style type="text/css">
 
13
      body { margin-left: .5in }
 
14
      h1, h2, h3, h4, .footer { margin-left: -.4in; }
 
15
    </style>
 
16
  </head>
 
17
 
 
18
  <body onload="prettyPrint()" bgcolor="white">
 
19
    <small style="float: right">Languages : <a href="README-zh-Hans.html">CH</a></small>
 
20
    <h1>Javascript code prettifier</h1>
 
21
 
 
22
    <h2>Setup</h2>
 
23
    <ol>
 
24
      <li><a href="http://code.google.com/p/google-code-prettify/downloads/list">Download</a> a distribution
 
25
      <li>Include the script and stylesheets in your document
 
26
        (you will need to make sure the css and js file are on your server, and
 
27
         adjust the paths in the <tt>script</tt> and <tt>link</tt> tag)
 
28
        <pre class="prettyprint">
 
29
&lt;link href="prettify.css" type="text/css" rel="stylesheet" /&gt;
 
30
&lt;script type="text/javascript" src="prettify.js"&gt;&lt;/script&gt;</pre>
 
31
      <li>Add <code class="prettyprint lang-in.tag">onload="prettyPrint()"</code> to your
 
32
      document's body tag.
 
33
      <li>Modify the stylesheet to get the coloring you prefer</li>
 
34
    </ol>
 
35
 
 
36
    <h2>Usage</h2>
 
37
    <p>Put code snippets in
 
38
    <tt>&lt;pre class="prettyprint"&gt;...&lt;/pre&gt;</tt>
 
39
    or <tt>&lt;code class="prettyprint"&gt;...&lt;/code&gt;</tt>
 
40
    and it will automatically be pretty printed.
 
41
 
 
42
    <table summary="code examples">
 
43
      <tr>
 
44
        <th>The original
 
45
        <th>Prettier
 
46
      <tr>
 
47
        <td><pre style="border: 1px solid #888;padding: 2px"
 
48
             ><a name="voila1"></a>class Voila {
 
49
public:
 
50
  // Voila
 
51
  static const string VOILA = "Voila";
 
52
 
 
53
  // will not interfere with embedded <a href="#voila1">tags</a>.
 
54
}</pre>
 
55
 
 
56
        <td><pre class="prettyprint"><a name="voila2"></a>class Voila {
 
57
public:
 
58
  // Voila
 
59
  static const string VOILA = "Voila";
 
60
 
 
61
  // will not interfere with embedded <a href="#voila2">tags</a>.
 
62
}</pre>
 
63
    </table>
 
64
 
 
65
    <h2>FAQ</h2>
 
66
    <h3 id="langs">For which languages does it work?</h3>
 
67
    <p>The comments in <tt>prettify.js</tt> are authoritative but the lexer
 
68
    should work on a number of languages including C and friends,
 
69
    Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, and Makefiles.
 
70
    It works passably on Ruby, PHP, VB, and Awk and a decent subset of Perl
 
71
    and Ruby, but, because of commenting conventions, doesn't work on
 
72
    Smalltalk, or CAML-like languages.</p>
 
73
 
 
74
    <p>LISPy languages are supported via an extension:
 
75
    <a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-lisp.js"
 
76
     ><code>lang-lisp.js</code></a>.</p>
 
77
    <p>And similarly for
 
78
    <a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-clj.js"
 
79
     ><code>Clojure</code></a>,
 
80
    <a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-css.js"
 
81
     ><code>CSS</code></a>,
 
82
    <a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-go.js"
 
83
     ><code>Go</code></a>,
 
84
    <a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-hs.js"
 
85
     ><code>Haskell</code></a>,
 
86
    <a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-lua.js"
 
87
     ><code>Lua</code></a>,
 
88
    <a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-ml.js"
 
89
     ><code>OCAML, SML, F#</code></a>,
 
90
    <a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-n.js"
 
91
     ><code>Nemerle</code></a>,
 
92
    <a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-proto.js"
 
93
     ><code>Protocol Buffers</code></a>,
 
94
    <a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-scala.js"
 
95
     ><code>Scala</code></a>,
 
96
    <a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-sql.js"
 
97
     ><code>SQL</code></a>,
 
98
    <a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-tex.js"
 
99
     ><code>TeX, LaTeX</code></a>,
 
100
    <a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-vhdl.js"
 
101
     ><code>VHDL</code></a>,
 
102
    <a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-vb.js"
 
103
     ><code>Visual Basic</code></a>,
 
104
    <a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-wiki.js"
 
105
     ><code>WikiText</code></a>,
 
106
    <a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-xq.js"
 
107
     ><code>XQuery</code></a>, and
 
108
    <a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-yaml.js"
 
109
     ><code>YAML</code></a>.
 
110
 
 
111
    <p>If you'd like to add an extension for your favorite language, please
 
112
    look at <tt>src/lang-lisp.js</tt> and file an
 
113
    <a href="http://code.google.com/p/google-code-prettify/issues/list"
 
114
     >issue</a> including your language extension, and a testcase.</p>
 
115
 
 
116
    <h3>How do I specify the language of my code?</h3>
 
117
    <p>You don't need to specify the language since <code>prettyprint()</code>
 
118
    will guess.  You can specify a language by specifying the language extension
 
119
    along with the <code>prettyprint</code> class like so:</p>
 
120
    <pre class="prettyprint lang-html"
 
121
>&lt;pre class=&quot;prettyprint <b>lang-html</b>&quot;&gt;
 
122
  The lang-* class specifies the language file extensions.
 
123
  File extensions supported by default include
 
124
    "bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
 
125
    "java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
 
126
    "xhtml", "xml", "xsl".
 
127
&lt;/pre&gt;</pre>
 
128
 
 
129
    <p>You may also use the
 
130
    <a href="http://dev.w3.org/html5/spec-author-view/the-code-element.html#the-code-element"
 
131
     >HTML 5</a> convention of embedding a <tt>code</tt> element inside the
 
132
    <code>PRE</code> and using <code>language-java</code> style classes.
 
133
    E.g. <xmp class="prettyprint"><pre class="prettyprint"><code class="language-java">...</code></pre></xmp>
 
134
 
 
135
    <h3>It doesn't work on <tt>&lt;obfuscated code sample&gt;</tt>?</h3>
 
136
    <p>Yes.  Prettifying obfuscated code is like putting lipstick on a pig
 
137
    &mdash; i.e. outside the scope of this tool.</p>
 
138
 
 
139
    <h3>Which browsers does it work with?</h3>
 
140
    <p>It's been tested with IE 6, Firefox 1.5 &amp; 2, and Safari 2.0.4.
 
141
    Look at <a href="tests/prettify_test.html">the test page</a> to see if it
 
142
    works in your browser.</p>
 
143
 
 
144
    <h3>What's changed?</h3>
 
145
    <p>See the <a href="CHANGES.html">change log</a></p>
 
146
 
 
147
    <h3>Why doesn't Prettyprinting of strings work on WordPress?</h3>
 
148
    <p>Apparently wordpress does "smart quoting" which changes close quotes.
 
149
    This causes end quotes to not match up with open quotes.
 
150
    <p>This breaks prettifying as well as copying and pasting of code samples.
 
151
    See
 
152
    <a href="http://wordpress.org/support/topic/125038"
 
153
    >WordPress's help center</a> for info on how to stop smart quoting of code
 
154
    snippets.</p>
 
155
 
 
156
    <h3 id="linenums">How do I put line numbers in my code?</h3>
 
157
    <p>You can use the <code>linenums</code> class to turn on line
 
158
    numbering.  If your code doesn't start at line number 1, you can
 
159
    add a colon and a line number to the end of that class as in
 
160
    <code>linenums:52</code>.
 
161
 
 
162
    <p>For example
 
163
<pre class="prettyprint">&lt;pre class="prettyprint linenums:<b>4</b>"
 
164
&gt;// This is line 4.
 
165
foo();
 
166
bar();
 
167
baz();
 
168
boo();
 
169
far();
 
170
faz();
 
171
&lt;pre&gt;</pre>
 
172
    produces
 
173
<pre class="prettyprint linenums:4"
 
174
>// This is line 4.
 
175
foo();
 
176
bar();
 
177
baz();
 
178
boo();
 
179
far();
 
180
faz();
 
181
</pre>
 
182
 
 
183
    <h3>How do I prevent a portion of markup from being marked as code?</h3>
 
184
    <p>You can use the <code>nocode</code> class to identify a span of markup
 
185
    that is not code.
 
186
<pre class="prettyprint">&lt;pre class=prettyprint&gt;
 
187
int x = foo();  /* This is a comment  &lt;span class="nocode"&gt;This is not code&lt;/span&gt;
 
188
  Continuation of comment */
 
189
int y = bar();
 
190
&lt;/pre&gt;</pre>
 
191
produces
 
192
<pre class="prettyprint">
 
193
int x = foo();  /* This is a comment  <span class="nocode">This is not code</span>
 
194
  Continuation of comment */
 
195
int y = bar();
 
196
</pre>
 
197
 
 
198
    <p>For a more complete example see the issue22
 
199
    <a href="tests/prettify_test.html#issue22">testcase</a>.</p>
 
200
 
 
201
    <h3>I get an error message "a is not a function" or "opt_whenDone is not a function"</h3>
 
202
    <p>If you are calling <code>prettyPrint</code> via an event handler, wrap it in a function.
 
203
    Instead of doing
 
204
    <blockquote>
 
205
      <code class="prettyprint lang-js"
 
206
       >addEventListener('load', prettyPrint, false);</code>
 
207
    </blockquote>
 
208
    wrap it in a closure like
 
209
    <blockquote>
 
210
      <code class="prettyprint lang-js"
 
211
       >addEventListener('load', function (event) { prettyPrint() }, false);</code>
 
212
    </blockquote>
 
213
    so that the browser does not pass an event object to <code>prettyPrint</code> which
 
214
    will confuse it.
 
215
 
 
216
    <h3>How can I customize the colors and styles of my code?</h3>
 
217
    <p>
 
218
    Prettify adds <code>&lt;span&gt;</code> with <code>class</code>es describing
 
219
    the kind of code.  You can create CSS styles to matches these
 
220
    classes.
 
221
    See the
 
222
    <a href="http://google-code-prettify.googlecode.com/svn/trunk/styles/index.html">
 
223
    theme gallery</a> for examples.
 
224
    </p>
 
225
 
 
226
    <br><br><br>
 
227
 
 
228
    <div class="footer">
 
229
<!-- Created: Tue Oct  3 17:51:56 PDT 2006 -->
 
230
<!-- hhmts start -->Last modified: Fri May 27 20:23:23 PDT 2011 <!-- hhmts end -->
 
231
    </div>
 
232
  </body>
 
233
</html>