Skip to content

Commit 5d182c7

Browse files
author
José Valim
committed
Syntax highlight.
1 parent bb63a9c commit 5d182c7

File tree

4 files changed

+75
-14
lines changed

4 files changed

+75
-14
lines changed

_includes/top.html

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
66
<title>{% if page.title %}{{ page.title }} - {% endif %}Elixir</title>
77
<link rel="stylesheet" type="text/css" href="/css/style.css">
8+
<link rel="stylesheet" type="text/css" href="/css/syntax.css">
89
<link rel="shortcut icon" href="/images/logo/drop.png">
910
<meta name="viewport" content="width=device-width,initial-scale=1">
1011
<link rel="stylesheet" id="font-bitter-css" href="http://fonts.googleapis.com/css?family=Bitter&amp;ver=1" type="text/css" media="screen">

_posts/2012-04-17-what-s-new-in-elixir-1.markdown

+8-8
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Last week Elixir has seen a lot of new features, improvements, and bug fixes. In
1010

1111
* Access protocol has been added for tuples, lists, strings, and whatnot. It allows us to easily access elements of a collection. We can also use a regex to find the first match in a string or a list. Examples follow:
1212

13-
```elixir
13+
{% highlight elixir %}
1414
dict = [a: 1, b: 2, c: 3]
1515
dict[:a] #=> 1
1616
dict[:d] #=> nil
@@ -24,11 +24,11 @@ defrecord TestRec, red: 0, green: 0, blue: 0
2424
r = TestRec[red: 255, blue: 80] #=> new record
2525
s = "The quick brown fox jumps over the lazy dog."
2626
s[%r/[a-z]+o[a-z]+/] #=> "brown"
27-
```
27+
{% endhighlight %}
2828

2929
* Access protocol also makes it possible to pattern-match records:
3030

31-
```elixir
31+
{% highlight elixir %}
3232
defrecord TestRec, red: 0, green: 0, blue: 0
3333
r = TestRec[red: 255, blue: 80] #=> new record
3434
case r do
@@ -39,7 +39,7 @@ match: TestRec[red: red, blue: 80]
3939
end
4040
#=> :ok
4141
red === 255 #=> true
42-
```
42+
{% endhighlight %}
4343

4444
* The `Orddict` module is no longer with us, it has been renamed to `Keyword`. The new module only allows atoms to be used as keys. A general purpose module for dicts will be added sooner or later.
4545

@@ -49,7 +49,7 @@ red === 255 #=> true
4949

5050
* Support for nested modules has been added.
5151

52-
```elixir
52+
{% highlight elixir %}
5353
defmodule Father do
5454
defmodule Child do
5555
def child_fun(str) do
@@ -61,16 +61,16 @@ defmodule Father do
6161
end
6262
end
6363
Father.Child.child_fun "hello!"
64-
```
64+
{% endhighlight %}
6565

6666
* The `Regex` module has received new functions, namely, `source` and `opts`. It can also be `inspect`ed now.
6767

68-
```elixir
68+
{% highlight elixir %}
6969
reg = %r/[a-z]+o[a-z]+/im
7070
Regex.source reg #=> "[a-z]+o[a-z]+"
7171
Regex.opts reg #=> "im"
7272
inspect reg #=> "%r\"[a-z]+o[a-z]+\"im"
73-
```
73+
{% endhighlight %}
7474

7575
* A new `read_info` function has been added to the [`File` module](https://github.com/elixir-lang/elixir/blob/35b22c598defd8be07d46d2e7e8fc0ddf9ec4e80/lib/file.ex) allowing
7676
users to query for file attributes.

_posts/2012-04-17-what-s-new-in-elixir-2.markdown

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ Let's get started with our usual overview. I'm using the latest master (`2851da4
1111

1212
* Literal support for hexadecimal, octal and binary numbers has been added.
1313

14-
```elixir
14+
{% highlight elixir %}
1515
0xFF #=> 255
1616
0o10 #=> 8
1717
0b1010 #=> 10
18-
```
18+
{% endhighlight %}
1919

2020
* New functions in the [List module](https://github.com/elixir-lang/elixir/blob/master/lib/list.ex): `sort`, `zip`, `unzip`.
2121

22-
```elixir
22+
{% highlight elixir %}
2323
# Charlists are sorted in lexicographic order
2424
List.sort ['10', '2', '4', '1', '21']
2525
#=> ['1', '10', '2', '21', '4']
@@ -34,11 +34,11 @@ end
3434

3535
List.zip [[1, 2], [:a, :b], ["one", "two"]]
3636
#=> [{1,:a,"one"},{2,:b,"two"}]
37-
```
37+
{% endhighlight %}
3838

3939
* The [System module](https://github.com/elixir-lang/elixir/blob/master/lib/system.ex) has been merged into master. It provides functions for communicating with OS environment, running external commands, getting the stacktrace, etc.
4040

41-
```elixir
41+
{% highlight elixir %}
4242
System.pwd
4343
#=> "/Users/alco/Documents/git/elixir"
4444

@@ -50,7 +50,7 @@ System.cmd 'date'
5050

5151
System.stacktrace
5252
#=> (usually long output)
53-
```
53+
{% endhighlight %}
5454

5555
* In other news, we're getting closer to having a dedicated site for documentation, JSON parsing/serialization is currently in the works, and there's also work being done on bringing dicts back into Elixir.
5656

css/syntax.css

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
.highlight { background: #ffffff; }
2+
.highlight .c { color: #999988; font-style: italic } /* Comment */
3+
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
4+
.highlight .k { font-weight: bold } /* Keyword */
5+
.highlight .o { font-weight: bold } /* Operator */
6+
.highlight .cm { color: #999988; font-style: italic } /* Comment.Multiline */
7+
.highlight .cp { color: #999999; font-weight: bold } /* Comment.Preproc */
8+
.highlight .c1 { color: #999988; font-style: italic } /* Comment.Single */
9+
.highlight .cs { color: #999999; font-weight: bold; font-style: italic } /* Comment.Special */
10+
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
11+
.highlight .gd .x { color: #000000; background-color: #ffaaaa } /* Generic.Deleted.Specific */
12+
.highlight .ge { font-style: italic } /* Generic.Emph */
13+
.highlight .gr { color: #aa0000 } /* Generic.Error */
14+
.highlight .gh { color: #999999 } /* Generic.Heading */
15+
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
16+
.highlight .gi .x { color: #000000; background-color: #aaffaa } /* Generic.Inserted.Specific */
17+
.highlight .go { color: #888888 } /* Generic.Output */
18+
.highlight .gp { color: #555555 } /* Generic.Prompt */
19+
.highlight .gs { font-weight: bold } /* Generic.Strong */
20+
.highlight .gu { color: #aaaaaa } /* Generic.Subheading */
21+
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
22+
.highlight .kc { font-weight: bold } /* Keyword.Constant */
23+
.highlight .kd { font-weight: bold } /* Keyword.Declaration */
24+
.highlight .kp { font-weight: bold } /* Keyword.Pseudo */
25+
.highlight .kr { font-weight: bold } /* Keyword.Reserved */
26+
.highlight .kt { color: #445588; font-weight: bold } /* Keyword.Type */
27+
.highlight .m { color: #009999 } /* Literal.Number */
28+
.highlight .s { color: #d14 } /* Literal.String */
29+
.highlight .na { color: #008080 } /* Name.Attribute */
30+
.highlight .nb { color: #0086B3 } /* Name.Builtin */
31+
.highlight .nc { color: #445588; font-weight: bold } /* Name.Class */
32+
.highlight .no { color: #008080 } /* Name.Constant */
33+
.highlight .ni { color: #800080 } /* Name.Entity */
34+
.highlight .ne { color: #990000; font-weight: bold } /* Name.Exception */
35+
.highlight .nf { color: #990000; font-weight: bold } /* Name.Function */
36+
.highlight .nn { color: #555555 } /* Name.Namespace */
37+
.highlight .nt { color: #000080 } /* Name.Tag */
38+
.highlight .nv { color: #008080 } /* Name.Variable */
39+
.highlight .ow { font-weight: bold } /* Operator.Word */
40+
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
41+
.highlight .mf { color: #009999 } /* Literal.Number.Float */
42+
.highlight .mh { color: #009999 } /* Literal.Number.Hex */
43+
.highlight .mi { color: #009999 } /* Literal.Number.Integer */
44+
.highlight .mo { color: #009999 } /* Literal.Number.Oct */
45+
.highlight .sb { color: #d14 } /* Literal.String.Backtick */
46+
.highlight .sc { color: #d14 } /* Literal.String.Char */
47+
.highlight .sd { color: #d14 } /* Literal.String.Doc */
48+
.highlight .s2 { color: #d14 } /* Literal.String.Double */
49+
.highlight .se { color: #d14 } /* Literal.String.Escape */
50+
.highlight .sh { color: #d14 } /* Literal.String.Heredoc */
51+
.highlight .si { color: #d14 } /* Literal.String.Interpol */
52+
.highlight .sx { color: #d14 } /* Literal.String.Other */
53+
.highlight .sr { color: #009926 } /* Literal.String.Regex */
54+
.highlight .s1 { color: #d14 } /* Literal.String.Single */
55+
.highlight .ss { color: #990073 } /* Literal.String.Symbol */
56+
.highlight .bp { color: #999999 } /* Name.Builtin.Pseudo */
57+
.highlight .vc { color: #008080 } /* Name.Variable.Class */
58+
.highlight .vg { color: #008080 } /* Name.Variable.Global */
59+
.highlight .vi { color: #008080 } /* Name.Variable.Instance */
60+
.highlight .il { color: #009999 } /* Literal.Number.Integer.Long */

0 commit comments

Comments
 (0)