diff options
author | Valerio Virgillito | 2012-07-17 11:28:39 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-07-17 11:28:39 -0700 |
commit | 4f737b24c19ddc02d20f9783b8b080fc6ef11142 (patch) | |
tree | 212d164c0f83d80394e34f1df532ea0461ad328d /imports/codemirror/mode/erlang/index.html | |
parent | 5146f224258929415adf4a8022e492454b4e2476 (diff) | |
parent | 0e04fff0ea80fa5cbe96b8354db38bd334aea83a (diff) | |
download | ninja-4f737b24c19ddc02d20f9783b8b080fc6ef11142.tar.gz |
Merge pull request #396 from ananyasen/codemirror2.3-upgrade
upgrade to codemirror 2.3
Diffstat (limited to 'imports/codemirror/mode/erlang/index.html')
-rw-r--r-- | imports/codemirror/mode/erlang/index.html | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/imports/codemirror/mode/erlang/index.html b/imports/codemirror/mode/erlang/index.html new file mode 100644 index 00000000..625491f2 --- /dev/null +++ b/imports/codemirror/mode/erlang/index.html | |||
@@ -0,0 +1,61 @@ | |||
1 | <!doctype html> | ||
2 | <html> | ||
3 | <head> | ||
4 | <title>CodeMirror: Erlang mode</title> | ||
5 | <link rel="stylesheet" href="../../lib/codemirror.css"> | ||
6 | <script src="../../lib/codemirror.js"></script> | ||
7 | <script src="erlang.js"></script> | ||
8 | <link rel="stylesheet" href="../../theme/erlang-dark.css"> | ||
9 | <style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style> | ||
10 | <link rel="stylesheet" href="../../doc/docs.css"> | ||
11 | </head> | ||
12 | <body> | ||
13 | <h1>CodeMirror: Erlang mode</h1> | ||
14 | |||
15 | <form><textarea id="code" name="code"> | ||
16 | %% -*- mode: erlang; erlang-indent-level: 2 -*- | ||
17 | %%% Created : 7 May 2012 by mats cronqvist <masse@klarna.com> | ||
18 | |||
19 | %% @doc | ||
20 | %% Demonstrates how to print a record. | ||
21 | %% @end | ||
22 | |||
23 | -module('ex'). | ||
24 | -author('mats cronqvist'). | ||
25 | -export([demo/0, | ||
26 | rec_info/1]). | ||
27 | |||
28 | -record(demo,{a="One",b="Two",c="Three",d="Four"}). | ||
29 | |||
30 | rec_info(demo) -> record_info(fields,demo). | ||
31 | |||
32 | demo() -> expand_recs(?MODULE,#demo{a="A",b="BB"}). | ||
33 | |||
34 | expand_recs(M,List) when is_list(List) -> | ||
35 | [expand_recs(M,L)||L<-List]; | ||
36 | expand_recs(M,Tup) when is_tuple(Tup) -> | ||
37 | case tuple_size(Tup) of | ||
38 | L when L < 1 -> Tup; | ||
39 | L -> | ||
40 | try Fields = M:rec_info(element(1,Tup)), | ||
41 | L = length(Fields)+1, | ||
42 | lists:zip(Fields,expand_recs(M,tl(tuple_to_list(Tup)))) | ||
43 | catch _:_ -> | ||
44 | list_to_tuple(expand_recs(M,tuple_to_list(Tup))) | ||
45 | end | ||
46 | end; | ||
47 | expand_recs(_,Term) -> | ||
48 | Term. | ||
49 | </textarea></form> | ||
50 | |||
51 | <script> | ||
52 | var editor = CodeMirror.fromTextArea(document.getElementById("code"), { | ||
53 | lineNumbers: true, | ||
54 | matchBrackets: true, | ||
55 | theme: "erlang-dark" | ||
56 | }); | ||
57 | </script> | ||
58 | |||
59 | <p><strong>MIME types defined:</strong> <code>text/x-erlang</code>.</p> | ||
60 | </body> | ||
61 | </html> | ||