ulmul 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README-en +118 -63
- data/README-ja +92 -58
- data/Rakefile +26 -10
- data/bin/ulmul2html5 +7 -58
- data/bin/ulmul2latex +34 -0
- data/bin/ulmul2xhtml +6 -58
- data/google-code-prettify/CHANGES.html +130 -0
- data/google-code-prettify/COPYING +202 -0
- data/google-code-prettify/README-zh-Hans.html +143 -0
- data/google-code-prettify/README.html +203 -0
- data/google-code-prettify/src/lang-apollo.js +51 -0
- data/google-code-prettify/src/lang-css.js +78 -0
- data/google-code-prettify/src/lang-fortran.js +53 -0
- data/google-code-prettify/src/lang-hs.js +101 -0
- data/google-code-prettify/src/lang-lisp.js +93 -0
- data/google-code-prettify/src/lang-lua.js +59 -0
- data/google-code-prettify/src/lang-ml.js +56 -0
- data/google-code-prettify/src/lang-proto.js +35 -0
- data/google-code-prettify/src/lang-scala.js +54 -0
- data/google-code-prettify/src/lang-sql.js +57 -0
- data/google-code-prettify/src/lang-vb.js +61 -0
- data/google-code-prettify/src/lang-vhdl.js +34 -0
- data/google-code-prettify/src/lang-wiki.js +53 -0
- data/google-code-prettify/src/lang-yaml.js +27 -0
- data/google-code-prettify/src/prettify.css +44 -0
- data/google-code-prettify/src/prettify.js +1508 -0
- data/google-code-prettify/tests/large_input_test.html +122 -0
- data/google-code-prettify/tests/prettify_test.html +2772 -0
- data/google-code-prettify/tests/test_base.js +132 -0
- data/google-code-prettify/tests/test_styles.css +5 -0
- data/hello.c +7 -0
- data/index.en.html +221 -120
- data/index.ja.html +182 -115
- data/lib/ulmul.rb +477 -276
- data/test/unit/ulmul_test.rb +21 -0
- data/ulmul-slidy.css +21 -8
- data/ulmul.gemspec +9 -5
- data/ulmul2html5.css +19 -5
- data/ulmul2xhtml.css +17 -1
- metadata +90 -12
- data/tests/ulmul_test.rb +0 -14
@@ -0,0 +1,143 @@
|
|
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
|
+
<meta http-equiv="content-type" value="text/html; charset=UTF-8" />
|
7
|
+
<title>Javascript code prettifier</title>
|
8
|
+
|
9
|
+
<link href="src/prettify.css" type="text/css" rel="stylesheet" />
|
10
|
+
|
11
|
+
<script src="src/prettify.js" type="text/javascript"></script>
|
12
|
+
|
13
|
+
<style type="text/css">
|
14
|
+
body { margin-left: .5in }
|
15
|
+
h1, h2, h3, h4, .footer { margin-left: -.4in; }
|
16
|
+
</style>
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body onload="prettyPrint()" bgcolor="white">
|
20
|
+
<h1>Javascript code prettifier</h1>
|
21
|
+
<h1>Javascript 代码美容师</h1>
|
22
|
+
<h2>安装使用</h2>
|
23
|
+
<ol>
|
24
|
+
<li><a href="http://google-code-prettify.googlecode.com/files/prettify-small-5-Jul-2008.zip">下载</a> 文件
|
25
|
+
<li>在你的文件中包含这儿的脚本和样式表(你要保证这儿的 css 和 js 文件按在你的服务器上, 并且调整在 <tt>script</tt> 和 <tt>link</tt>标签中的路径)
|
26
|
+
<pre class="prettyprint">
|
27
|
+
<link href="prettify.css" type="text/css" rel="stylesheet" />
|
28
|
+
<script type="text/javascript" src="prettify.js"></script></pre>
|
29
|
+
<li>添加<code class="prettyprint">onload="prettyPrint()"</code> 到你的文件的 body 标签中.
|
30
|
+
<li>修改样式表,使用你自己喜欢的颜色.</li>
|
31
|
+
</ol>
|
32
|
+
|
33
|
+
<h2>使用方法<br></h2>
|
34
|
+
<p>在
|
35
|
+
<tt><pre class="prettyprint">...</pre></tt> 或 <tt><code class="prettyprint">...</code></tt>
|
36
|
+
中间放上代码片段,它就会自动被美化了.
|
37
|
+
|
38
|
+
<table summary="code examples">
|
39
|
+
<tr>
|
40
|
+
<th>The original
|
41
|
+
<th>Prettier
|
42
|
+
<tr>
|
43
|
+
<td><pre style="border: 1px solid #888;padding: 2px"
|
44
|
+
><a name="voila1"></a>class Voila {
|
45
|
+
public:
|
46
|
+
// Voila
|
47
|
+
static const string VOILA = "Voila";
|
48
|
+
|
49
|
+
// will not interfere with embedded <a href="#voila1">tags</a>.
|
50
|
+
}</pre>
|
51
|
+
|
52
|
+
<td><pre class="prettyprint"><a name="voila2"></a>class Voila {
|
53
|
+
public:
|
54
|
+
// Voila
|
55
|
+
static const string VOILA = "Voila";
|
56
|
+
|
57
|
+
// will not interfere with embedded <a href="#voila2">tags</a>.
|
58
|
+
}</pre>
|
59
|
+
</table>
|
60
|
+
|
61
|
+
|
62
|
+
<h2>常见问题</h2>
|
63
|
+
<h3 id="langs">它是为什么语言工作的?</h3>
|
64
|
+
<p><tt>prettify.js中的注释是权威的,但是它的语法分析程序可以在很多语言中使用</tt>,包括 C ,
|
65
|
+
Java, Python, Bash, SQL, HTML, XML, CSS, Javascript, 和 Makefiles.
|
66
|
+
它在 Ruby, PHP, VB, 和 Awk 中还算可以,而且也可以在 Perl 和 Ruby的合适子集中起作用,但是, 因为注释的约定,它对
|
67
|
+
Smalltalk, 或 CAML类似的语言起作用.<br></p>
|
68
|
+
|
69
|
+
|
70
|
+
<p>LISP系列的语言可以使用一个拓展<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-lisp.js"><code>lang-lisp.js</code></a>.</p><p>对于 <a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-css"><code>CSS</code></a>,
|
71
|
+
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-hs"><code>Haskell</code></a>,
|
72
|
+
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-lua.js"><code>Lua</code></a>,
|
73
|
+
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-ml.js"><code>OCAML, SML, F#</code></a>,
|
74
|
+
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-vb.js"><code>Visual Basic</code></a>,
|
75
|
+
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-sql.js"><code>SQL</code></a>,
|
76
|
+
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-proto.js"><code>Protocol Buffers</code></a>, 和
|
77
|
+
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-wiki.js"><code>WikiText</code></a>..也是类似的</p><p>如果你想给你喜欢的语言写个拓展版本, 请参阅<tt>src/lang-lisp.js</tt> ,并写一个包括你的语言的拓展的 <a href="http://code.google.com/p/google-code-prettify/issues/list"
|
78
|
+
>发布</a> 和一个测试用例.</p>
|
79
|
+
|
80
|
+
<h3>如何指定我的代码在哪种语言里?</h3>
|
81
|
+
<p>你不需要指定语言环境,因为 <code>prettyprint()</code>
|
82
|
+
会对此进行猜测. 你可以使用<code> prettyprint </code>这个类通过指定语言的拓展名来指定语言,就像这样:</p>
|
83
|
+
<pre class="prettyprint lang-html"
|
84
|
+
><pre class="prettyprint <b>lang-html</b>">
|
85
|
+
The lang-* class specifies the language file extensions.
|
86
|
+
File extensions supported by default include
|
87
|
+
"bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
|
88
|
+
"java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
|
89
|
+
"xhtml", "xml", "xsl".
|
90
|
+
</pre></pre>
|
91
|
+
|
92
|
+
<h3>它在混淆代码例子上不起作用吗?</h3>
|
93
|
+
<p>是的. 美化混淆代码就像给小猪涂口红,也就是不在这个工具的范围内. <br></p>
|
94
|
+
|
95
|
+
<h3>它可以在那些浏览器上工作?</h3>
|
96
|
+
<p>这个工具已经在 IE 6, Firefox 1.5 & 2, 和 Safari 2.0.4 上测试通过. 打开 <a href="tests/prettify_test.html">测试页面</a> ,看看它能不能在你的浏览器上起作用.</p>
|
97
|
+
|
98
|
+
<h3>有什么改变?</h3>
|
99
|
+
<p>查看 <a href="CHANGES.html">变化日志</a></p>
|
100
|
+
|
101
|
+
<h3> 为什么Prettyprinting 对WordPress中的字符串没用?</h3>
|
102
|
+
<p>很显然,wordpress 在 "smart quoting" 时会改变关闭符号.
|
103
|
+
这使得关闭符号跟开始符号不配套.
|
104
|
+
<p>这和复制粘贴代码一样,破坏了美化作用. 去
|
105
|
+
<a href="http://wordpress.org/support/topic/125038"
|
106
|
+
>WordPress's help center</a> 查看更多关于如何关闭插入代码段时的"smart quoting"的信息.</p>
|
107
|
+
|
108
|
+
<h3>如何在我的代码中加入行号? (Out of date -- see <a href="README.html">English version</a>)</h3>
|
109
|
+
<p>你可以使用 <code>nocode</code> 类来标记 span 标记不是代码.
|
110
|
+
<pre><pre class=prettyprint>
|
111
|
+
<span class="<b>nocode</b>">1:</span> /* This is line 1 of my code
|
112
|
+
<span class="<b>nocode</b>">2:</span> * and here's line 2 */
|
113
|
+
<span class="<b>nocode</b>">3:</span> print("I'm line number 3");
|
114
|
+
</pre></pre>得到
|
115
|
+
<pre class=prettyprint>
|
116
|
+
<span class="nocode">1:</span> /* This is line 1 of my code
|
117
|
+
<span class="nocode">2:</span> * and here's line 2 */
|
118
|
+
<span class="nocode">3:</span> print("I'm line number 3");
|
119
|
+
</pre>
|
120
|
+
|
121
|
+
<p>查看一个更完整的例子: issue22
|
122
|
+
<a href="tests/prettify_test.html#issue22">testcase</a>.</p>
|
123
|
+
|
124
|
+
<h3>我得到了这样一条错误信息 "a is not a function" 或 "opt_whenDone is not a function"</h3>
|
125
|
+
<p>如果你通过事件句柄条用 <code>prettyPrint</code> , 把它隐藏到一个函数中. <br></p><p>不要这么写
|
126
|
+
</p><blockquote>
|
127
|
+
<code class="prettyprint lang-js"
|
128
|
+
>addEventListener('load', prettyPrint, false);</code>
|
129
|
+
</blockquote>而要这么写
|
130
|
+
<blockquote>
|
131
|
+
<code class="prettyprint lang-js"
|
132
|
+
>addEventListener('load', function (event) { prettyPrint() }, false);</code>
|
133
|
+
</blockquote>这样的话,浏览器就不会把时间对象传递给 <code>prettyPrint</code> ,事件对象会让它困惑的.
|
134
|
+
|
135
|
+
<br><br><br>
|
136
|
+
|
137
|
+
<div class="footer">
|
138
|
+
<!-- Created: Tue Oct 3 17:51:56 PDT 2006 -->
|
139
|
+
<!-- hhmts start -->
|
140
|
+
Last modified: Wed Jan 7 13:25:42 PST 2009<br><!-- hhmts end -->
|
141
|
+
</div>
|
142
|
+
</body>
|
143
|
+
</html>
|
@@ -0,0 +1,203 @@
|
|
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
|
+
<link href="prettify.css" type="text/css" rel="stylesheet" />
|
30
|
+
<script type="text/javascript" src="prettify.js"></script></pre>
|
31
|
+
<li>Add <code class="prettyprint lang-html">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><pre class="prettyprint">...</pre></tt>
|
39
|
+
or <tt><code class="prettyprint">...</code></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">Which languages does it work for?</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-css.js"
|
79
|
+
><code>CSS</code></a>,
|
80
|
+
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-hs.js"
|
81
|
+
><code>Haskell</code></a>,
|
82
|
+
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-lua.js"
|
83
|
+
><code>Lua</code></a>,
|
84
|
+
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-ml.js"
|
85
|
+
><code>OCAML, SML, F#</code></a>,
|
86
|
+
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-vb.js"
|
87
|
+
><code>Visual Basic</code></a>,
|
88
|
+
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-sql.js"
|
89
|
+
><code>SQL</code></a>,
|
90
|
+
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-proto.js"
|
91
|
+
><code>Protocol Buffers</code></a>, and
|
92
|
+
<a href="http://code.google.com/p/google-code-prettify/source/browse/trunk/src/lang-wiki.js"
|
93
|
+
><code>WikiText</code></a>..
|
94
|
+
|
95
|
+
<p>If you'd like to add an extension for your favorite language, please
|
96
|
+
look at <tt>src/lang-lisp.js</tt> and file an
|
97
|
+
<a href="http://code.google.com/p/google-code-prettify/issues/list"
|
98
|
+
>issue</a> including your language extension, and a testcase.</p>
|
99
|
+
|
100
|
+
<h3>How do I specify which language my code is in?</h3>
|
101
|
+
<p>You don't need to specify the language since <code>prettyprint()</code>
|
102
|
+
will guess. You can specify a language by specifying the language extension
|
103
|
+
along with the <code>prettyprint</code> class like so:</p>
|
104
|
+
<pre class="prettyprint lang-html"
|
105
|
+
><pre class="prettyprint <b>lang-html</b>">
|
106
|
+
The lang-* class specifies the language file extensions.
|
107
|
+
File extensions supported by default include
|
108
|
+
"bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
|
109
|
+
"java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
|
110
|
+
"xhtml", "xml", "xsl".
|
111
|
+
</pre></pre>
|
112
|
+
|
113
|
+
<h3>It doesn't work on <tt><obfuscated code sample></tt>?</h3>
|
114
|
+
<p>Yes. Prettifying obfuscated code is like putting lipstick on a pig
|
115
|
+
— i.e. outside the scope of this tool.</p>
|
116
|
+
|
117
|
+
<h3>Which browsers does it work with?</h3>
|
118
|
+
<p>It's been tested with IE 6, Firefox 1.5 & 2, and Safari 2.0.4.
|
119
|
+
Look at <a href="tests/prettify_test.html">the test page</a> to see if it
|
120
|
+
works in your browser.</p>
|
121
|
+
|
122
|
+
<h3>What's changed?</h3>
|
123
|
+
<p>See the <a href="CHANGES.html">change log</a></p>
|
124
|
+
|
125
|
+
<h3>Why doesn't Prettyprinting of strings work on WordPress?</h3>
|
126
|
+
<p>Apparently wordpress does "smart quoting" which changes close quotes.
|
127
|
+
This causes end quotes to not match up with open quotes.
|
128
|
+
<p>This breaks prettifying as well as copying and pasting of code samples.
|
129
|
+
See
|
130
|
+
<a href="http://wordpress.org/support/topic/125038"
|
131
|
+
>WordPress's help center</a> for info on how to stop smart quoting of code
|
132
|
+
snippets.</p>
|
133
|
+
|
134
|
+
<h3 id="linenums">How do I put line numbers in my code?</h3>
|
135
|
+
<p>You can use the <code>linenums</code> class to turn on line
|
136
|
+
numbering. If your code doesn't start at line number 1, you can
|
137
|
+
add a colon and a line number to the end of that class as in
|
138
|
+
<code>linenums:52</code>.
|
139
|
+
|
140
|
+
<p>For example
|
141
|
+
<pre class="prettyprint"><pre class="prettyprint linenums:<b>4</b>"
|
142
|
+
>// This is line 4.
|
143
|
+
foo();
|
144
|
+
bar();
|
145
|
+
baz();
|
146
|
+
boo();
|
147
|
+
far();
|
148
|
+
faz();
|
149
|
+
<pre></pre>
|
150
|
+
produces
|
151
|
+
<pre class="prettyprint linenums:4"
|
152
|
+
>// This is line 4.
|
153
|
+
foo();
|
154
|
+
bar();
|
155
|
+
baz();
|
156
|
+
boo();
|
157
|
+
far();
|
158
|
+
faz();
|
159
|
+
</pre>
|
160
|
+
|
161
|
+
<h3>How do I prevent a portion of markup from being marked as code?</h3>
|
162
|
+
<p>You can use the <code>nocode</code> class to identify a span of markup
|
163
|
+
that is not code.
|
164
|
+
<pre class="prettyprint"><pre class=prettyprint>
|
165
|
+
int x = foo(); /* This is a comment <span class="nocode">This is not code</span>
|
166
|
+
Continuation of comment */
|
167
|
+
int y = bar();
|
168
|
+
</pre></pre>
|
169
|
+
produces
|
170
|
+
<pre class="prettyprint">
|
171
|
+
int x = foo(); /* This is a comment <span class="nocode">This is not code</span>
|
172
|
+
Continuation of comment */
|
173
|
+
int y = bar();
|
174
|
+
</pre>
|
175
|
+
|
176
|
+
<p>For a more complete example see the issue22
|
177
|
+
<a href="tests/prettify_test.html#issue22">testcase</a>.</p>
|
178
|
+
|
179
|
+
<h3>I get an error message "a is not a function" or "opt_whenDone is not a function"</h3>
|
180
|
+
<p>If you are calling <code>prettyPrint</code> via an event handler, wrap it in a function.
|
181
|
+
Instead of doing
|
182
|
+
<blockquote>
|
183
|
+
<code class="prettyprint lang-js"
|
184
|
+
>addEventListener('load', prettyPrint, false);</code>
|
185
|
+
</blockquote>
|
186
|
+
wrap it in a closure like
|
187
|
+
<blockquote>
|
188
|
+
<code class="prettyprint lang-js"
|
189
|
+
>addEventListener('load', function (event) { prettyPrint() }, false);</code>
|
190
|
+
</blockquote>
|
191
|
+
so that the browser does not pass an event object to <code>prettyPrint</code> which
|
192
|
+
will confuse it.
|
193
|
+
|
194
|
+
<br><br><br>
|
195
|
+
|
196
|
+
<div class="footer">
|
197
|
+
<!-- Created: Tue Oct 3 17:51:56 PDT 2006 -->
|
198
|
+
<!-- hhmts start -->
|
199
|
+
Last modified: Wed Jul 19 13:56:00 PST 2010
|
200
|
+
<!-- hhmts end -->
|
201
|
+
</div>
|
202
|
+
</body>
|
203
|
+
</html>
|
@@ -0,0 +1,51 @@
|
|
1
|
+
// Copyright (C) 2009 Onno Hommes.
|
2
|
+
//
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
// you may not use this file except in compliance with the License.
|
5
|
+
// You may obtain a copy of the License at
|
6
|
+
//
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
//
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
// See the License for the specific language governing permissions and
|
13
|
+
// limitations under the License.
|
14
|
+
|
15
|
+
|
16
|
+
/**
|
17
|
+
* @fileoverview
|
18
|
+
* Registers a language handler for the AGC/AEA Assembly Language as described
|
19
|
+
* at http://virtualagc.googlecode.com
|
20
|
+
* <p>
|
21
|
+
* This file could be used by goodle code to allow syntax highlight for
|
22
|
+
* Virtual AGC SVN repository or if you don't want to commonize
|
23
|
+
* the header for the agc/aea html assembly listing.
|
24
|
+
*
|
25
|
+
* @author ohommes@alumni.cmu.edu
|
26
|
+
*/
|
27
|
+
|
28
|
+
PR.registerLangHandler(
|
29
|
+
PR.createSimpleLexer(
|
30
|
+
[
|
31
|
+
// A line comment that starts with ;
|
32
|
+
[PR.PR_COMMENT, /^#[^\r\n]*/, null, '#'],
|
33
|
+
// Whitespace
|
34
|
+
[PR.PR_PLAIN, /^[\t\n\r \xA0]+/, null, '\t\n\r \xA0'],
|
35
|
+
// A double quoted, possibly multi-line, string.
|
36
|
+
[PR.PR_STRING, /^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/, null, '"']
|
37
|
+
],
|
38
|
+
[
|
39
|
+
[PR.PR_KEYWORD, /^(?:ADS|AD|AUG|BZF|BZMF|CAE|CAF|CA|CCS|COM|CS|DAS|DCA|DCOM|DCS|DDOUBL|DIM|DOUBLE|DTCB|DTCF|DV|DXCH|EDRUPT|EXTEND|INCR|INDEX|NDX|INHINT|LXCH|MASK|MSK|MP|MSU|NOOP|OVSK|QXCH|RAND|READ|RELINT|RESUME|RETURN|ROR|RXOR|SQUARE|SU|TCR|TCAA|OVSK|TCF|TC|TS|WAND|WOR|WRITE|XCH|XLQ|XXALQ|ZL|ZQ|ADD|ADZ|SUB|SUZ|MPY|MPR|MPZ|DVP|COM|ABS|CLA|CLZ|LDQ|STO|STQ|ALS|LLS|LRS|TRA|TSQ|TMI|TOV|AXT|TIX|DLY|INP|OUT)\s/,null],
|
40
|
+
[PR.PR_TYPE, /^(?:-?GENADR|=MINUS|2BCADR|VN|BOF|MM|-?2CADR|-?[1-6]DNADR|ADRES|BBCON|[SE]?BANK\=?|BLOCK|BNKSUM|E?CADR|COUNT\*?|2?DEC\*?|-?DNCHAN|-?DNPTR|EQUALS|ERASE|MEMORY|2?OCT|REMADR|SETLOC|SUBRO|ORG|BSS|BES|SYN|EQU|DEFINE|END)\s/,null],
|
41
|
+
// A single quote possibly followed by a word that optionally ends with
|
42
|
+
// = ! or ?.
|
43
|
+
[PR.PR_LITERAL,
|
44
|
+
/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],
|
45
|
+
// Any word including labels that optionally ends with = ! or ?.
|
46
|
+
[PR.PR_PLAIN,
|
47
|
+
/^-*(?:[!-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],
|
48
|
+
// A printable non-space non-special character
|
49
|
+
[PR.PR_PUNCTUATION, /^[^\w\t\n\r \xA0()\"\\\';]+/]
|
50
|
+
]),
|
51
|
+
['apollo', 'agc', 'aea']);
|
@@ -0,0 +1,78 @@
|
|
1
|
+
// Copyright (C) 2009 Google Inc.
|
2
|
+
//
|
3
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
// you may not use this file except in compliance with the License.
|
5
|
+
// You may obtain a copy of the License at
|
6
|
+
//
|
7
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
//
|
9
|
+
// Unless required by applicable law or agreed to in writing, software
|
10
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
// See the License for the specific language governing permissions and
|
13
|
+
// limitations under the License.
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
/**
|
18
|
+
* @fileoverview
|
19
|
+
* Registers a language handler for CSS.
|
20
|
+
*
|
21
|
+
*
|
22
|
+
* To use, include prettify.js and this file in your HTML page.
|
23
|
+
* Then put your code in an HTML tag like
|
24
|
+
* <pre class="prettyprint lang-css"></pre>
|
25
|
+
*
|
26
|
+
*
|
27
|
+
* http://www.w3.org/TR/CSS21/grammar.html Section G2 defines the lexical
|
28
|
+
* grammar. This scheme does not recognize keywords containing escapes.
|
29
|
+
*
|
30
|
+
* @author mikesamuel@gmail.com
|
31
|
+
*/
|
32
|
+
|
33
|
+
PR.registerLangHandler(
|
34
|
+
PR.createSimpleLexer(
|
35
|
+
[
|
36
|
+
// The space production <s>
|
37
|
+
[PR.PR_PLAIN, /^[ \t\r\n\f]+/, null, ' \t\r\n\f']
|
38
|
+
],
|
39
|
+
[
|
40
|
+
// Quoted strings. <string1> and <string2>
|
41
|
+
[PR.PR_STRING,
|
42
|
+
/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/, null],
|
43
|
+
[PR.PR_STRING,
|
44
|
+
/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/, null],
|
45
|
+
['lang-css-str', /^url\(([^\)\"\']*)\)/i],
|
46
|
+
[PR.PR_KEYWORD,
|
47
|
+
/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,
|
48
|
+
null],
|
49
|
+
// A property name -- an identifier followed by a colon.
|
50
|
+
['lang-css-kw', /^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],
|
51
|
+
// A C style block comment. The <comment> production.
|
52
|
+
[PR.PR_COMMENT, /^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],
|
53
|
+
// Escaping text spans
|
54
|
+
[PR.PR_COMMENT, /^(?:<!--|-->)/],
|
55
|
+
// A number possibly containing a suffix.
|
56
|
+
[PR.PR_LITERAL, /^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],
|
57
|
+
// A hex color
|
58
|
+
[PR.PR_LITERAL, /^#(?:[0-9a-f]{3}){1,2}/i],
|
59
|
+
// An identifier
|
60
|
+
[PR.PR_PLAIN,
|
61
|
+
/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],
|
62
|
+
// A run of punctuation
|
63
|
+
[PR.PR_PUNCTUATION, /^[^\s\w\'\"]+/]
|
64
|
+
]),
|
65
|
+
['css']);
|
66
|
+
PR.registerLangHandler(
|
67
|
+
PR.createSimpleLexer([],
|
68
|
+
[
|
69
|
+
[PR.PR_KEYWORD,
|
70
|
+
/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]
|
71
|
+
]),
|
72
|
+
['css-kw']);
|
73
|
+
PR.registerLangHandler(
|
74
|
+
PR.createSimpleLexer([],
|
75
|
+
[
|
76
|
+
[PR.PR_STRING, /^[^\)\"\']+/]
|
77
|
+
]),
|
78
|
+
['css-str']);
|