Skip to content

Commit d9f35c6

Browse files
committed
Fix diff styling, tidy up examples.
1 parent ef806be commit d9f35c6

20 files changed

+95
-250
lines changed

Rakefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ task :update_aliases do
3535

3636
code.puts "// Brush Aliases"
3737

38-
Dir["jquery.syntax.brush.*.js"].each do |path|
38+
Dir["jquery.syntax.brush.*.js"].sort.each do |path|
3939
File.open(path, "r") do |f|
4040
first_line = f.readline rescue ""
4141

@@ -46,7 +46,7 @@ task :update_aliases do
4646
end
4747

4848
styles = {}
49-
Dir["**/jquery.syntax.*.css"].each do |path|
49+
Dir["**/jquery.syntax.*.css"].sort.each do |path|
5050
basename = File.basename(path, ".css")
5151
styles[basename] ||= []
5252
styles[basename] << path
@@ -60,7 +60,7 @@ task :update_aliases do
6060

6161
code.puts
6262
code.puts "// Theme Configuration"
63-
Dir["**/theme.js"].each do |path|
63+
Dir["**/theme.js"].sort.each do |path|
6464
code.write File.read(path)
6565
end
6666

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
.syntax-theme-base .syntax .add {
1+
.syntax-theme-base .add {
22
color: green; }
3-
.syntax-theme-base .syntax .del {
3+
.syntax-theme-base .del {
44
color: red; }
5-
.syntax-theme-base .syntax .insert {
5+
.syntax-theme-base .insert {
66
color: green; }
7-
.syntax-theme-base .syntax .insert-line {
7+
.syntax-theme-base .insert-line {
88
background-color: #cfc !important; }
9-
.syntax-theme-base .syntax .remove {
9+
.syntax-theme-base .remove {
1010
color: red; }
11-
.syntax-theme-base .syntax .remove-line {
11+
.syntax-theme-base .remove-line {
1212
background-color: #fcc !important; }
13-
.syntax-theme-base .syntax .offset {
13+
.syntax-theme-base .offset {
1414
color: blue; }
15-
.syntax-theme-base .syntax .offset-line {
15+
.syntax-theme-base .offset-line {
1616
background-color: #ccf !important; }

dist/jquery.syntax.core.js

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1040,15 +1040,6 @@ Syntax.extractBrushName = function (className) {
10401040
return null;
10411041
}
10421042

1043-
Syntax.extractTextBrushName = function (text) {
1044-
var match = text.match(/-\*- mode: (.+?);(.*?)-\*-/i);
1045-
var endOfSecondLine = text.indexOf("\n", text.indexOf("\n") + 1);
1046-
1047-
if (match && match.index < endOfSecondLine) {
1048-
return brush;
1049-
}
1050-
}
1051-
10521043
// Highlight a given set of elements with a set of options.
10531044
// Callback will be called once per element with (options, highlighted_html, original_container)
10541045
Syntax.highlight = function (elements, options, callback) {

examples/ex.applescript.html

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<script src="../dist/jquery.syntax.cache.js" type="text/javascript"></script>
99

1010
<script type="text/javascript">
11-
$(function() {
12-
jQuery.syntax();
11+
jQuery(function($) {
12+
$.syntax();
1313
});
1414
</script>
1515

@@ -19,9 +19,7 @@ <h1>Syntax: AppleScript</h1>
1919

2020
<h2>Hello World &amp; Mode-line Support</h2>
2121

22-
<p>The following example does not have a class specifying the brush to use. This is extracted from the mode-line. This line also specifies other options, in this case the tab-width.</p>
23-
24-
<pre class="syntax">(* -*- mode: applescript; tab-width: 4; -*-
22+
<pre><code class="syntax applescript">(*
2523
Copyright (C) 2009 Orion Transfer Ltd. All Rights Reserved. See http://www.oriontransfer.co.nz/ for more information.
2624
Drop files on top of this application to produce a zip archive on the desktop containing compressed JPEGs at a maximum size of 800px.
2725
*)
@@ -117,6 +115,6 @@ <h2>Hello World &amp; Mode-line Support</h2>
117115
end if
118116
end tell
119117
end resize_and_save
120-
</pre>
118+
</code></pre>
121119
</body>
122120
</html>

examples/ex.asm.html

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,40 +8,36 @@
88
<script src="../dist/jquery.syntax.cache.js" type="text/javascript"></script>
99

1010
<script type="text/javascript">
11-
$(function() {
12-
jQuery.syntax();
11+
jQuery(function($) {
12+
$.syntax();
1313
});
1414
</script>
1515

1616
</head>
1717
<body>
1818
<h1>Syntax: Assembler</h1>
1919

20-
<h2>Hello World &amp; Mode-line Support</h2>
21-
22-
<p>The following example does not have a class specifying the brush to use. This is extracted from the mode-line. This line also specifies other options, in this case the tab-width.</p>
23-
24-
<pre class="syntax"># -*- mode: asm; tab-width: 4; -*-
20+
<pre style="tab-size: 4"><code class="syntax language-asm">
2521
.text
2622
.global _start
2723

2824
_start:
2925
# ssize_t sys_write(unsigned int fd, const char __user * buf, size_t count)
30-
movl $len, %edx # size_t count
31-
movl $msg, %ecx # const char __user * buf
32-
movl $1, %ebx # unsigned int fd
33-
movl $4, %eax # system call number (sys_write)
34-
int $0x80 # call kernel
26+
movl $len, %edx # size_t count
27+
movl $msg, %ecx # const char __user * buf
28+
movl $1, %ebx # unsigned int fd
29+
movl $4, %eax # system call number (sys_write)
30+
int $0x80 # call kernel
3531

3632
# void _exit(int status);
37-
movl $0, %ebx # int status
38-
movl $1, %eax # system call number (sys_exit)
39-
int $0x80 # call kernel
33+
movl $0, %ebx # int status
34+
movl $1, %eax # system call number (sys_exit)
35+
int $0x80 # call kernel
4036

41-
.data # section declaration
37+
.data
4238

4339
msg:
44-
.ascii "Hello, world!\n"
45-
len = . - msg</pre>
40+
.ascii "Hello, world!\n"
41+
len = . - msg</code></pre>
4642
</body>
4743
</html>

examples/ex.bash.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<script src="../dist/jquery.syntax.cache.js" type="text/javascript"></script>
99

1010
<script type="text/javascript">
11-
$(function() {
12-
jQuery.syntax();
11+
jQuery(function($) {
12+
$.syntax();
1313
});
1414
</script>
1515

@@ -19,7 +19,7 @@ <h1>Syntax: Bash</h1>
1919

2020
<p>Bash is context-sensitive - a script could mean different things depending on what is defined in the environment. Thus, to present Bash code clearly, you will need to use inline markup, such as the last example on this page.</p>
2121

22-
<pre class="syntax brush-bash-script">#!/bin/bash
22+
<pre><code class="syntax language-bash-script">#!/bin/bash
2323
# Counting to 11 in 10 different ways.
2424

2525
n=1; echo -n &quot;$n &quot;
@@ -70,11 +70,11 @@ <h1>Syntax: Bash</h1>
7070

7171
echo
7272

73-
exit 0</pre>
73+
exit 0</code></pre>
7474

7575
<p>
7676

77-
<pre class="syntax bash-script">#!/bin/bash
77+
<pre><code class="syntax bash-script">#!/bin/bash
7878

7979
svc_cluster_ip=10.0.0.10
8080
svc_priv_dsa=~/.ssh/id_dsa
@@ -116,16 +116,16 @@ <h1>Syntax: Bash</h1>
116116
done | grep $WWPN
117117

118118
#set +x
119-
</pre>
119+
</code></pre>
120120

121121
<p>This next example uses inline HTML to markup and highlight <code class="syntax bash-script">rd-resolve-test bob</code>.</p>
122122

123-
<pre id="ex2" class="syntax brush-bash">samuel@ayako:~$ which git
123+
<pre id="ex2"><code class="syntax brush-bash">samuel@ayako:~$ which git
124124
/usr/bin/git
125125
samuel@ayako:~$ ls -lah
126126
getconf getent getopt getopts gettext gettext.sh gettextize
127127
samuel@ayako:~# sudo <span class="highlight"><span class="function">rd-resolve-test</span> bob</span>
128-
/home/samuel</pre>
128+
/home/samuel</code></pre>
129129

130130
<p>Here is the HTML of the above <code class="syntax html">&lt;pre&gt;</code>:</p>
131131

examples/ex.clang.html

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<script src="../dist/jquery.syntax.cache.js" type="text/javascript"></script>
99

1010
<script type="text/javascript">
11-
$(function() {
12-
jQuery.syntax();
11+
jQuery(function($) {
12+
$.syntax();
1313
});
1414
</script>
1515

@@ -19,7 +19,7 @@ <h1>Syntax: C, C++, Objective-C</h1>
1919

2020
<h2>C++</h2>
2121

22-
<pre class="syntax brush-clang">#include &lt;iostream&gt;
22+
<pre><code class="syntax brush-clang">#include &lt;iostream&gt;
2323

2424
// If we increase row by 1, the offset will increase by sz (number of elements per row i.e. number of columns)
2525
// If we increase col by 1, the offset will increase by 1
@@ -142,11 +142,11 @@ <h2>C++</h2>
142142
transposedMatrix.debug();
143143

144144
return 0;
145-
}</pre>
145+
}</code></pre>
146146

147147
<h2>Objective-C Header</h2>
148148

149-
<pre class="syntax brush-clang">//
149+
<pre><code class="syntax brush-clang">//
150150
// GHInventoryEditor.h
151151
// Goblin Hacker
152152
//
@@ -217,11 +217,11 @@ <h2>Objective-C Header</h2>
217217

218218
- (IBAction)avatarJewelry: (id)sender;
219219

220-
@end</pre>
220+
@end</code></pre>
221221

222222
<h2>Objective-C Implementation</h2>
223223

224-
<pre class="syntax brush-clang">//
224+
<pre><code class="syntax brush-clang">//
225225
// GPointSet.m
226226
// Gocoa
227227
//
@@ -307,17 +307,17 @@ <h2>Objective-C Implementation</h2>
307307
return result;
308308
}
309309

310-
@end</pre>
310+
@end</code></pre>
311311

312312
<h2>Strings with embedded escapes</h2>
313313

314-
<pre class="syntax brush-clang">
314+
<pre><code class="syntax brush-clang">
315315
const char * text = "The elephant\n was in the room.";
316-
</pre>
316+
</code></pre>
317317

318318
<h2>Types and Functions</h2>
319319

320-
<pre class="syntax c++">
320+
<pre><code class="syntax c++">
321321
int pthread_setcancelstate(int, int *);
322322
int pthread_setcanceltype(int, int *);
323323
int pthread_setconcurrency(int);
@@ -331,7 +331,7 @@ <h2>Types and Functions</h2>
331331

332332
}
333333
}
334-
</pre>
334+
</code></pre>
335335

336336
</body>
337337
</html>

examples/ex.css.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<script src="../dist/jquery.syntax.cache.js" type="text/javascript"></script>
99

1010
<script type="text/javascript">
11-
$(function() {
12-
jQuery.syntax();
11+
jQuery(function($) {
12+
$.syntax();
1313
});
1414
</script>
1515

@@ -21,7 +21,7 @@ <h2>Special Example</h2>
2121

2222
<p>This example extracts definitions and creates example elements on the right hand side.</p>
2323

24-
<pre class="syntax brush-css">
24+
<pre><code class="syntax brush-css">
2525
p {
2626
background-color: #ccc;
2727
border: 1px solid black;
@@ -43,6 +43,6 @@ <h2>Special Example</h2>
4343

4444
border-color:#ff0000 #0000ff;
4545
}
46-
</pre>
46+
</code></pre>
4747
</body>
4848
</html>

examples/ex.diff.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
<script src="../dist/jquery.syntax.cache.js" type="text/javascript"></script>
99

1010
<script type="text/javascript">
11-
$(function() {
12-
jQuery.syntax();
11+
jQuery(function($) {
12+
$.syntax();
1313
});
1414
</script>
1515

@@ -19,7 +19,7 @@ <h1>Syntax: Diff</h1>
1919

2020
<h2>jQuery.Syntax Diff</h2>
2121

22-
<pre class="syntax brush-diff">
22+
<pre><code class="syntax brush-diff">
2323
diff --git a/ex.ruby.html b/ex.ruby.html
2424
index a02a04e..7d42db0 100644
2525
--- a/ex.ruby.html
@@ -1220,7 +1220,7 @@ <h2>jQuery.Syntax Diff</h2>
12201220
+
12211221
+Syntax.layouts.table = Syntax.layouts.tableDOM
12221222
\ No newline at end of file
1223-
</pre>
1223+
</code></pre>
12241224

12251225
</body>
12261226
</html>

examples/ex.editor.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ <h1>Syntax Editor</h1>
1919

2020
<h2>Ruby Editor</h2>
2121

22-
<pre class="syntax clang">/* Foo Bar */
22+
<pre><code class="syntax clang">/* Foo Bar */
2323
namespace x {
2424

2525
}

0 commit comments

Comments
 (0)