jekyll-theme-anc 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +1 -0
- data/_includes/disqus.html +42 -0
- data/_includes/facebook_share_btn.html +1 -0
- data/_includes/footer.html +79 -0
- data/_includes/go2top.html +22 -0
- data/_includes/google-analytics.html +11 -0
- data/_includes/head.html +50 -0
- data/_includes/header.html +13 -0
- data/_includes/jspdf.html +41 -0
- data/_includes/nav.html +25 -0
- data/_includes/pageloginpoper.html +59 -0
- data/_includes/post-categories.html +8 -0
- data/_includes/post_seo.html +59 -0
- data/_includes/youtube_video.html +11 -0
- data/_layouts/blog.html +33 -0
- data/_layouts/default.html +151 -0
- data/_layouts/home.html +26 -0
- data/_layouts/page.html +5 -0
- data/_layouts/post.html +83 -0
- data/_sass/anc.scss +9 -0
- data/_sass/anc/_base.scss +144 -0
- data/_sass/anc/_layout.scss +0 -0
- data/_sass/anc/_materialize.scss +38 -0
- data/_sass/anc/_syntax-highlighting.scss +78 -0
- data/_sass/anc/components/_variables.scss +343 -0
- data/_sass/materialize-css/components/_badges.scss +47 -0
- data/_sass/materialize-css/components/_buttons.scss +291 -0
- data/_sass/materialize-css/components/_cards.scss +196 -0
- data/_sass/materialize-css/components/_carousel.scss +90 -0
- data/_sass/materialize-css/components/_chips.scss +89 -0
- data/_sass/materialize-css/components/_collapsible.scss +84 -0
- data/_sass/materialize-css/components/_color.scss +412 -0
- data/_sass/materialize-css/components/_dropdown.scss +68 -0
- data/_sass/materialize-css/components/_global.scss +734 -0
- data/_sass/materialize-css/components/_grid.scss +156 -0
- data/_sass/materialize-css/components/_icons-material-design.scss +5 -0
- data/_sass/materialize-css/components/_materialbox.scss +43 -0
- data/_sass/materialize-css/components/_modal.scss +90 -0
- data/_sass/materialize-css/components/_navbar.scss +208 -0
- data/_sass/materialize-css/components/_normalize.scss +424 -0
- data/_sass/materialize-css/components/_preloader.scss +334 -0
- data/_sass/materialize-css/components/_pulse.scss +34 -0
- data/_sass/materialize-css/components/_roboto.scss +39 -0
- data/_sass/materialize-css/components/_sideNav.scss +214 -0
- data/_sass/materialize-css/components/_slider.scss +92 -0
- data/_sass/materialize-css/components/_table_of_contents.scss +33 -0
- data/_sass/materialize-css/components/_tabs.scss +93 -0
- data/_sass/materialize-css/components/_tapTarget.scss +103 -0
- data/_sass/materialize-css/components/_toast.scss +59 -0
- data/_sass/materialize-css/components/_tooltip.scss +31 -0
- data/_sass/materialize-css/components/_transitions.scss +13 -0
- data/_sass/materialize-css/components/_typography.scss +61 -0
- data/_sass/materialize-css/components/_variables.scss +343 -0
- data/_sass/materialize-css/components/_waves.scss +114 -0
- data/_sass/materialize-css/components/date_picker/_default.date.scss +456 -0
- data/_sass/materialize-css/components/date_picker/_default.scss +212 -0
- data/_sass/materialize-css/components/date_picker/_default.time.scss +267 -0
- data/_sass/materialize-css/components/forms/_checkboxes.scss +210 -0
- data/_sass/materialize-css/components/forms/_file-input.scss +44 -0
- data/_sass/materialize-css/components/forms/_forms.scss +22 -0
- data/_sass/materialize-css/components/forms/_input-fields.scss +333 -0
- data/_sass/materialize-css/components/forms/_radio-buttons.scss +115 -0
- data/_sass/materialize-css/components/forms/_range.scss +160 -0
- data/_sass/materialize-css/components/forms/_select.scss +182 -0
- data/_sass/materialize-css/components/forms/_switches.scss +89 -0
- data/_sass/materialize-css/materialize.scss +42 -0
- data/_sass/materialize/components/_badges.scss +47 -0
- data/_sass/materialize/components/_buttons.scss +291 -0
- data/_sass/materialize/components/_cards.scss +196 -0
- data/_sass/materialize/components/_carousel.scss +90 -0
- data/_sass/materialize/components/_chips.scss +89 -0
- data/_sass/materialize/components/_collapsible.scss +84 -0
- data/_sass/materialize/components/_color.scss +412 -0
- data/_sass/materialize/components/_dropdown.scss +68 -0
- data/_sass/materialize/components/_global.scss +734 -0
- data/_sass/materialize/components/_grid.scss +156 -0
- data/_sass/materialize/components/_icons-material-design.scss +5 -0
- data/_sass/materialize/components/_materialbox.scss +43 -0
- data/_sass/materialize/components/_modal.scss +90 -0
- data/_sass/materialize/components/_navbar.scss +208 -0
- data/_sass/materialize/components/_normalize.scss +424 -0
- data/_sass/materialize/components/_preloader.scss +334 -0
- data/_sass/materialize/components/_pulse.scss +34 -0
- data/_sass/materialize/components/_roboto.scss +39 -0
- data/_sass/materialize/components/_sideNav.scss +214 -0
- data/_sass/materialize/components/_slider.scss +92 -0
- data/_sass/materialize/components/_table_of_contents.scss +33 -0
- data/_sass/materialize/components/_tabs.scss +93 -0
- data/_sass/materialize/components/_tapTarget.scss +103 -0
- data/_sass/materialize/components/_toast.scss +59 -0
- data/_sass/materialize/components/_tooltip.scss +31 -0
- data/_sass/materialize/components/_transitions.scss +13 -0
- data/_sass/materialize/components/_typography.scss +61 -0
- data/_sass/materialize/components/_variables.scss +343 -0
- data/_sass/materialize/components/_waves.scss +114 -0
- data/_sass/materialize/components/date_picker/_default.date.scss +456 -0
- data/_sass/materialize/components/date_picker/_default.scss +212 -0
- data/_sass/materialize/components/date_picker/_default.time.scss +267 -0
- data/_sass/materialize/components/forms/_checkboxes.scss +210 -0
- data/_sass/materialize/components/forms/_file-input.scss +44 -0
- data/_sass/materialize/components/forms/_forms.scss +22 -0
- data/_sass/materialize/components/forms/_input-fields.scss +333 -0
- data/_sass/materialize/components/forms/_radio-buttons.scss +115 -0
- data/_sass/materialize/components/forms/_range.scss +160 -0
- data/_sass/materialize/components/forms/_select.scss +182 -0
- data/_sass/materialize/components/forms/_switches.scss +89 -0
- data/_sass/materialize/materialize.scss +42 -0
- data/assets/fonts/FontAwesome.otf +0 -0
- data/assets/fonts/fontawesome-webfont.eot +0 -0
- data/assets/fonts/fontawesome-webfont.svg +2671 -0
- data/assets/fonts/fontawesome-webfont.ttf +0 -0
- data/assets/fonts/fontawesome-webfont.woff +0 -0
- data/assets/fonts/fontawesome-webfont.woff2 +0 -0
- data/assets/fonts/roboto/Roboto-Bold.woff +0 -0
- data/assets/fonts/roboto/Roboto-Bold.woff2 +0 -0
- data/assets/fonts/roboto/Roboto-Light.woff +0 -0
- data/assets/fonts/roboto/Roboto-Light.woff2 +0 -0
- data/assets/fonts/roboto/Roboto-Medium.woff +0 -0
- data/assets/fonts/roboto/Roboto-Medium.woff2 +0 -0
- data/assets/fonts/roboto/Roboto-Regular.woff +0 -0
- data/assets/fonts/roboto/Roboto-Regular.woff2 +0 -0
- data/assets/fonts/roboto/Roboto-Thin.woff +0 -0
- data/assets/fonts/roboto/Roboto-Thin.woff2 +0 -0
- data/assets/images/close.png +0 -0
- data/assets/images/loader.gif +0 -0
- data/assets/img/icons/facebook-square.png +0 -0
- data/assets/img/icons/github-square.png +0 -0
- data/assets/img/icons/twitter-square.png +0 -0
- data/assets/img/icons/youtube-square.png +0 -0
- data/assets/img/jubayed11.37-16.jpg +0 -0
- data/assets/img/parallax1.jpg +0 -0
- data/assets/img/sample-1.jpg +0 -0
- data/assets/js/custom_script.js +200 -0
- data/assets/js/highlight.pack.js +2 -0
- data/assets/js/materialize.min.js +6 -0
- data/assets/js/mode/apl/apl.js +174 -0
- data/assets/js/mode/asciiarmor/asciiarmor.js +74 -0
- data/assets/js/mode/asn.1/asn.1.js +204 -0
- data/assets/js/mode/asterisk/asterisk.js +196 -0
- data/assets/js/mode/brainfuck/brainfuck.js +85 -0
- data/assets/js/mode/clike/clike.js +789 -0
- data/assets/js/mode/clojure/clojure.js +306 -0
- data/assets/js/mode/cmake/cmake.js +97 -0
- data/assets/js/mode/cobol/cobol.js +255 -0
- data/assets/js/mode/coffeescript/coffeescript.js +359 -0
- data/assets/js/mode/commonlisp/commonlisp.js +124 -0
- data/assets/js/mode/crystal/crystal.js +433 -0
- data/assets/js/mode/css/css.js +831 -0
- data/assets/js/mode/cypher/cypher.js +150 -0
- data/assets/js/mode/d/d.js +218 -0
- data/assets/js/mode/dart/dart.js +157 -0
- data/assets/js/mode/diff/diff.js +47 -0
- data/assets/js/mode/django/django.js +356 -0
- data/assets/js/mode/dockerfile/dockerfile.js +79 -0
- data/assets/js/mode/dtd/dtd.js +142 -0
- data/assets/js/mode/dylan/dylan.js +352 -0
- data/assets/js/mode/ebnf/ebnf.js +195 -0
- data/assets/js/mode/ecl/ecl.js +206 -0
- data/assets/js/mode/eiffel/eiffel.js +160 -0
- data/assets/js/mode/elm/elm.js +205 -0
- data/assets/js/mode/erlang/erlang.js +619 -0
- data/assets/js/mode/factor/factor.js +85 -0
- data/assets/js/mode/fcl/fcl.js +173 -0
- data/assets/js/mode/forth/forth.js +180 -0
- data/assets/js/mode/fortran/fortran.js +188 -0
- data/assets/js/mode/gas/gas.js +345 -0
- data/assets/js/mode/gfm/gfm.js +129 -0
- data/assets/js/mode/gherkin/gherkin.js +178 -0
- data/assets/js/mode/go/go.js +187 -0
- data/assets/js/mode/groovy/groovy.js +230 -0
- data/assets/js/mode/haml/haml.js +161 -0
- data/assets/js/mode/handlebars/handlebars.js +62 -0
- data/assets/js/mode/haskell-literate/haskell-literate.js +43 -0
- data/assets/js/mode/haskell/haskell.js +267 -0
- data/assets/js/mode/haxe/haxe.js +515 -0
- data/assets/js/mode/htmlembedded/htmlembedded.js +28 -0
- data/assets/js/mode/htmlmixed/htmlmixed.js +152 -0
- data/assets/js/mode/http/http.js +113 -0
- data/assets/js/mode/idl/idl.js +290 -0
- data/assets/js/mode/javascript/javascript.js +838 -0
- data/assets/js/mode/jinja2/jinja2.js +142 -0
- data/assets/js/mode/jsx/jsx.js +148 -0
- data/assets/js/mode/julia/julia.js +418 -0
- data/assets/js/mode/livescript/livescript.js +280 -0
- data/assets/js/mode/lua/lua.js +159 -0
- data/assets/js/mode/markdown/markdown.js +859 -0
- data/assets/js/mode/mathematica/mathematica.js +176 -0
- data/assets/js/mode/mbox/mbox.js +129 -0
- data/assets/js/mode/meta.js +215 -0
- data/assets/js/mode/mirc/mirc.js +193 -0
- data/assets/js/mode/mllike/mllike.js +208 -0
- data/assets/js/mode/modelica/modelica.js +245 -0
- data/assets/js/mode/mscgen/mscgen.js +175 -0
- data/assets/js/mode/mumps/mumps.js +148 -0
- data/assets/js/mode/nginx/nginx.js +178 -0
- data/assets/js/mode/nsis/nsis.js +95 -0
- data/assets/js/mode/ntriples/ntriples.js +195 -0
- data/assets/js/mode/octave/octave.js +139 -0
- data/assets/js/mode/oz/oz.js +252 -0
- data/assets/js/mode/pascal/pascal.js +109 -0
- data/assets/js/mode/pegjs/pegjs.js +114 -0
- data/assets/js/mode/perl/perl.js +837 -0
- data/assets/js/mode/php/php.js +234 -0
- data/assets/js/mode/pig/pig.js +178 -0
- data/assets/js/mode/powershell/powershell.js +398 -0
- data/assets/js/mode/properties/properties.js +78 -0
- data/assets/js/mode/protobuf/protobuf.js +68 -0
- data/assets/js/mode/pug/pug.js +591 -0
- data/assets/js/mode/puppet/puppet.js +220 -0
- data/assets/js/mode/python/python.js +334 -0
- data/assets/js/mode/q/q.js +139 -0
- data/assets/js/mode/r/r.js +183 -0
- data/assets/js/mode/rpm/changes/index.html +66 -0
- data/assets/js/mode/rpm/rpm.js +109 -0
- data/assets/js/mode/rst/rst.js +557 -0
- data/assets/js/mode/ruby/ruby.js +295 -0
- data/assets/js/mode/rust/rust.js +72 -0
- data/assets/js/mode/sas/sas.js +303 -0
- data/assets/js/mode/sass/sass.js +454 -0
- data/assets/js/mode/scheme/scheme.js +249 -0
- data/assets/js/mode/shell/shell.js +142 -0
- data/assets/js/mode/sieve/sieve.js +193 -0
- data/assets/js/mode/slim/slim.js +575 -0
- data/assets/js/mode/smalltalk/smalltalk.js +168 -0
- data/assets/js/mode/smarty/smarty.js +225 -0
- data/assets/js/mode/solr/solr.js +104 -0
- data/assets/js/mode/soy/soy.js +342 -0
- data/assets/js/mode/sparql/sparql.js +180 -0
- data/assets/js/mode/spreadsheet/spreadsheet.js +112 -0
- data/assets/js/mode/sql/sql.js +475 -0
- data/assets/js/mode/stex/stex.js +251 -0
- data/assets/js/mode/stylus/stylus.js +771 -0
- data/assets/js/mode/swift/swift.js +210 -0
- data/assets/js/mode/tcl/tcl.js +139 -0
- data/assets/js/mode/textile/textile.js +469 -0
- data/assets/js/mode/tiddlywiki/tiddlywiki.css +14 -0
- data/assets/js/mode/tiddlywiki/tiddlywiki.js +308 -0
- data/assets/js/mode/tiki/tiki.css +26 -0
- data/assets/js/mode/tiki/tiki.js +312 -0
- data/assets/js/mode/toml/toml.js +88 -0
- data/assets/js/mode/tornado/tornado.js +68 -0
- data/assets/js/mode/troff/troff.js +84 -0
- data/assets/js/mode/ttcn-cfg/ttcn-cfg.js +214 -0
- data/assets/js/mode/ttcn/ttcn.js +283 -0
- data/assets/js/mode/turtle/turtle.js +162 -0
- data/assets/js/mode/twig/twig.js +141 -0
- data/assets/js/mode/vb/vb.js +275 -0
- data/assets/js/mode/vbscript/vbscript.js +350 -0
- data/assets/js/mode/velocity/velocity.js +201 -0
- data/assets/js/mode/verilog/verilog.js +675 -0
- data/assets/js/mode/vhdl/vhdl.js +189 -0
- data/assets/js/mode/vue/vue.js +70 -0
- data/assets/js/mode/webidl/webidl.js +195 -0
- data/assets/js/mode/xml/xml.js +394 -0
- data/assets/js/mode/xquery/xquery.js +448 -0
- data/assets/js/mode/yacas/yacas.js +204 -0
- data/assets/js/mode/yaml-frontmatter/yaml-frontmatter.js +68 -0
- data/assets/js/mode/yaml/yaml.js +118 -0
- data/assets/js/mode/z80/z80.js +116 -0
- data/assets/main.scss +5 -0
- metadata +347 -0
@@ -0,0 +1,220 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
CodeMirror.defineMode("puppet", function () {
|
15
|
+
// Stores the words from the define method
|
16
|
+
var words = {};
|
17
|
+
// Taken, mostly, from the Puppet official variable standards regex
|
18
|
+
var variable_regex = /({)?([a-z][a-z0-9_]*)?((::[a-z][a-z0-9_]*)*::)?[a-zA-Z0-9_]+(})?/;
|
19
|
+
|
20
|
+
// Takes a string of words separated by spaces and adds them as
|
21
|
+
// keys with the value of the first argument 'style'
|
22
|
+
function define(style, string) {
|
23
|
+
var split = string.split(' ');
|
24
|
+
for (var i = 0; i < split.length; i++) {
|
25
|
+
words[split[i]] = style;
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
// Takes commonly known puppet types/words and classifies them to a style
|
30
|
+
define('keyword', 'class define site node include import inherits');
|
31
|
+
define('keyword', 'case if else in and elsif default or');
|
32
|
+
define('atom', 'false true running present absent file directory undef');
|
33
|
+
define('builtin', 'action augeas burst chain computer cron destination dport exec ' +
|
34
|
+
'file filebucket group host icmp iniface interface jump k5login limit log_level ' +
|
35
|
+
'log_prefix macauthorization mailalias maillist mcx mount nagios_command ' +
|
36
|
+
'nagios_contact nagios_contactgroup nagios_host nagios_hostdependency ' +
|
37
|
+
'nagios_hostescalation nagios_hostextinfo nagios_hostgroup nagios_service ' +
|
38
|
+
'nagios_servicedependency nagios_serviceescalation nagios_serviceextinfo ' +
|
39
|
+
'nagios_servicegroup nagios_timeperiod name notify outiface package proto reject ' +
|
40
|
+
'resources router schedule scheduled_task selboolean selmodule service source ' +
|
41
|
+
'sport ssh_authorized_key sshkey stage state table tidy todest toports tosource ' +
|
42
|
+
'user vlan yumrepo zfs zone zpool');
|
43
|
+
|
44
|
+
// After finding a start of a string ('|") this function attempts to find the end;
|
45
|
+
// If a variable is encountered along the way, we display it differently when it
|
46
|
+
// is encapsulated in a double-quoted string.
|
47
|
+
function tokenString(stream, state) {
|
48
|
+
var current, prev, found_var = false;
|
49
|
+
while (!stream.eol() && (current = stream.next()) != state.pending) {
|
50
|
+
if (current === '$' && prev != '\\' && state.pending == '"') {
|
51
|
+
found_var = true;
|
52
|
+
break;
|
53
|
+
}
|
54
|
+
prev = current;
|
55
|
+
}
|
56
|
+
if (found_var) {
|
57
|
+
stream.backUp(1);
|
58
|
+
}
|
59
|
+
if (current == state.pending) {
|
60
|
+
state.continueString = false;
|
61
|
+
} else {
|
62
|
+
state.continueString = true;
|
63
|
+
}
|
64
|
+
return "string";
|
65
|
+
}
|
66
|
+
|
67
|
+
// Main function
|
68
|
+
function tokenize(stream, state) {
|
69
|
+
// Matches one whole word
|
70
|
+
var word = stream.match(/[\w]+/, false);
|
71
|
+
// Matches attributes (i.e. ensure => present ; 'ensure' would be matched)
|
72
|
+
var attribute = stream.match(/(\s+)?\w+\s+=>.*/, false);
|
73
|
+
// Matches non-builtin resource declarations
|
74
|
+
// (i.e. "apache::vhost {" or "mycustomclasss {" would be matched)
|
75
|
+
var resource = stream.match(/(\s+)?[\w:_]+(\s+)?{/, false);
|
76
|
+
// Matches virtual and exported resources (i.e. @@user { ; and the like)
|
77
|
+
var special_resource = stream.match(/(\s+)?[@]{1,2}[\w:_]+(\s+)?{/, false);
|
78
|
+
|
79
|
+
// Finally advance the stream
|
80
|
+
var ch = stream.next();
|
81
|
+
|
82
|
+
// Have we found a variable?
|
83
|
+
if (ch === '$') {
|
84
|
+
if (stream.match(variable_regex)) {
|
85
|
+
// If so, and its in a string, assign it a different color
|
86
|
+
return state.continueString ? 'variable-2' : 'variable';
|
87
|
+
}
|
88
|
+
// Otherwise return an invalid variable
|
89
|
+
return "error";
|
90
|
+
}
|
91
|
+
// Should we still be looking for the end of a string?
|
92
|
+
if (state.continueString) {
|
93
|
+
// If so, go through the loop again
|
94
|
+
stream.backUp(1);
|
95
|
+
return tokenString(stream, state);
|
96
|
+
}
|
97
|
+
// Are we in a definition (class, node, define)?
|
98
|
+
if (state.inDefinition) {
|
99
|
+
// If so, return def (i.e. for 'class myclass {' ; 'myclass' would be matched)
|
100
|
+
if (stream.match(/(\s+)?[\w:_]+(\s+)?/)) {
|
101
|
+
return 'def';
|
102
|
+
}
|
103
|
+
// Match the rest it the next time around
|
104
|
+
stream.match(/\s+{/);
|
105
|
+
state.inDefinition = false;
|
106
|
+
}
|
107
|
+
// Are we in an 'include' statement?
|
108
|
+
if (state.inInclude) {
|
109
|
+
// Match and return the included class
|
110
|
+
stream.match(/(\s+)?\S+(\s+)?/);
|
111
|
+
state.inInclude = false;
|
112
|
+
return 'def';
|
113
|
+
}
|
114
|
+
// Do we just have a function on our hands?
|
115
|
+
// In 'ensure_resource("myclass")', 'ensure_resource' is matched
|
116
|
+
if (stream.match(/(\s+)?\w+\(/)) {
|
117
|
+
stream.backUp(1);
|
118
|
+
return 'def';
|
119
|
+
}
|
120
|
+
// Have we matched the prior attribute regex?
|
121
|
+
if (attribute) {
|
122
|
+
stream.match(/(\s+)?\w+/);
|
123
|
+
return 'tag';
|
124
|
+
}
|
125
|
+
// Do we have Puppet specific words?
|
126
|
+
if (word && words.hasOwnProperty(word)) {
|
127
|
+
// Negates the initial next()
|
128
|
+
stream.backUp(1);
|
129
|
+
// rs move the stream
|
130
|
+
stream.match(/[\w]+/);
|
131
|
+
// We want to process these words differently
|
132
|
+
// do to the importance they have in Puppet
|
133
|
+
if (stream.match(/\s+\S+\s+{/, false)) {
|
134
|
+
state.inDefinition = true;
|
135
|
+
}
|
136
|
+
if (word == 'include') {
|
137
|
+
state.inInclude = true;
|
138
|
+
}
|
139
|
+
// Returns their value as state in the prior define methods
|
140
|
+
return words[word];
|
141
|
+
}
|
142
|
+
// Is there a match on a reference?
|
143
|
+
if (/(^|\s+)[A-Z][\w:_]+/.test(word)) {
|
144
|
+
// Negate the next()
|
145
|
+
stream.backUp(1);
|
146
|
+
// Match the full reference
|
147
|
+
stream.match(/(^|\s+)[A-Z][\w:_]+/);
|
148
|
+
return 'def';
|
149
|
+
}
|
150
|
+
// Have we matched the prior resource regex?
|
151
|
+
if (resource) {
|
152
|
+
stream.match(/(\s+)?[\w:_]+/);
|
153
|
+
return 'def';
|
154
|
+
}
|
155
|
+
// Have we matched the prior special_resource regex?
|
156
|
+
if (special_resource) {
|
157
|
+
stream.match(/(\s+)?[@]{1,2}/);
|
158
|
+
return 'special';
|
159
|
+
}
|
160
|
+
// Match all the comments. All of them.
|
161
|
+
if (ch == "#") {
|
162
|
+
stream.skipToEnd();
|
163
|
+
return "comment";
|
164
|
+
}
|
165
|
+
// Have we found a string?
|
166
|
+
if (ch == "'" || ch == '"') {
|
167
|
+
// Store the type (single or double)
|
168
|
+
state.pending = ch;
|
169
|
+
// Perform the looping function to find the end
|
170
|
+
return tokenString(stream, state);
|
171
|
+
}
|
172
|
+
// Match all the brackets
|
173
|
+
if (ch == '{' || ch == '}') {
|
174
|
+
return 'bracket';
|
175
|
+
}
|
176
|
+
// Match characters that we are going to assume
|
177
|
+
// are trying to be regex
|
178
|
+
if (ch == '/') {
|
179
|
+
stream.match(/.*?\//);
|
180
|
+
return 'variable-3';
|
181
|
+
}
|
182
|
+
// Match all the numbers
|
183
|
+
if (ch.match(/[0-9]/)) {
|
184
|
+
stream.eatWhile(/[0-9]+/);
|
185
|
+
return 'number';
|
186
|
+
}
|
187
|
+
// Match the '=' and '=>' operators
|
188
|
+
if (ch == '=') {
|
189
|
+
if (stream.peek() == '>') {
|
190
|
+
stream.next();
|
191
|
+
}
|
192
|
+
return "operator";
|
193
|
+
}
|
194
|
+
// Keep advancing through all the rest
|
195
|
+
stream.eatWhile(/[\w-]/);
|
196
|
+
// Return a blank line for everything else
|
197
|
+
return null;
|
198
|
+
}
|
199
|
+
// Start it all
|
200
|
+
return {
|
201
|
+
startState: function () {
|
202
|
+
var state = {};
|
203
|
+
state.inDefinition = false;
|
204
|
+
state.inInclude = false;
|
205
|
+
state.continueString = false;
|
206
|
+
state.pending = false;
|
207
|
+
return state;
|
208
|
+
},
|
209
|
+
token: function (stream, state) {
|
210
|
+
// Strip the spaces, but regex will account for them eitherway
|
211
|
+
if (stream.eatSpace()) return null;
|
212
|
+
// Go through the main process
|
213
|
+
return tokenize(stream, state);
|
214
|
+
}
|
215
|
+
};
|
216
|
+
});
|
217
|
+
|
218
|
+
CodeMirror.defineMIME("text/x-puppet", "puppet");
|
219
|
+
|
220
|
+
});
|
@@ -0,0 +1,334 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: http://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
function wordRegexp(words) {
|
15
|
+
return new RegExp("^((" + words.join(")|(") + "))\\b");
|
16
|
+
}
|
17
|
+
|
18
|
+
var wordOperators = wordRegexp(["and", "or", "not", "is"]);
|
19
|
+
var commonKeywords = ["as", "assert", "break", "class", "continue",
|
20
|
+
"def", "del", "elif", "else", "except", "finally",
|
21
|
+
"for", "from", "global", "if", "import",
|
22
|
+
"lambda", "pass", "raise", "return",
|
23
|
+
"try", "while", "with", "yield", "in"];
|
24
|
+
var commonBuiltins = ["abs", "all", "any", "bin", "bool", "bytearray", "callable", "chr",
|
25
|
+
"classmethod", "compile", "complex", "delattr", "dict", "dir", "divmod",
|
26
|
+
"enumerate", "eval", "filter", "float", "format", "frozenset",
|
27
|
+
"getattr", "globals", "hasattr", "hash", "help", "hex", "id",
|
28
|
+
"input", "int", "isinstance", "issubclass", "iter", "len",
|
29
|
+
"list", "locals", "map", "max", "memoryview", "min", "next",
|
30
|
+
"object", "oct", "open", "ord", "pow", "property", "range",
|
31
|
+
"repr", "reversed", "round", "set", "setattr", "slice",
|
32
|
+
"sorted", "staticmethod", "str", "sum", "super", "tuple",
|
33
|
+
"type", "vars", "zip", "__import__", "NotImplemented",
|
34
|
+
"Ellipsis", "__debug__"];
|
35
|
+
CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins));
|
36
|
+
|
37
|
+
function top(state) {
|
38
|
+
return state.scopes[state.scopes.length - 1];
|
39
|
+
}
|
40
|
+
|
41
|
+
CodeMirror.defineMode("python", function(conf, parserConf) {
|
42
|
+
var ERRORCLASS = "error";
|
43
|
+
|
44
|
+
var delimiters = parserConf.delimiters || parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.]/;
|
45
|
+
// (Backwards-compatiblity with old, cumbersome config system)
|
46
|
+
var operators = [parserConf.singleOperators, parserConf.doubleOperators, parserConf.doubleDelimiters, parserConf.tripleDelimiters,
|
47
|
+
parserConf.operators || /^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@])/]
|
48
|
+
for (var i = 0; i < operators.length; i++) if (!operators[i]) operators.splice(i--, 1)
|
49
|
+
|
50
|
+
var hangingIndent = parserConf.hangingIndent || conf.indentUnit;
|
51
|
+
|
52
|
+
var myKeywords = commonKeywords, myBuiltins = commonBuiltins;
|
53
|
+
if (parserConf.extra_keywords != undefined)
|
54
|
+
myKeywords = myKeywords.concat(parserConf.extra_keywords);
|
55
|
+
|
56
|
+
if (parserConf.extra_builtins != undefined)
|
57
|
+
myBuiltins = myBuiltins.concat(parserConf.extra_builtins);
|
58
|
+
|
59
|
+
var py3 = !(parserConf.version && Number(parserConf.version) < 3)
|
60
|
+
if (py3) {
|
61
|
+
// since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator
|
62
|
+
var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;
|
63
|
+
myKeywords = myKeywords.concat(["nonlocal", "False", "True", "None", "async", "await"]);
|
64
|
+
myBuiltins = myBuiltins.concat(["ascii", "bytes", "exec", "print"]);
|
65
|
+
var stringPrefixes = new RegExp("^(([rbuf]|(br))?('{3}|\"{3}|['\"]))", "i");
|
66
|
+
} else {
|
67
|
+
var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*/;
|
68
|
+
myKeywords = myKeywords.concat(["exec", "print"]);
|
69
|
+
myBuiltins = myBuiltins.concat(["apply", "basestring", "buffer", "cmp", "coerce", "execfile",
|
70
|
+
"file", "intern", "long", "raw_input", "reduce", "reload",
|
71
|
+
"unichr", "unicode", "xrange", "False", "True", "None"]);
|
72
|
+
var stringPrefixes = new RegExp("^(([rubf]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
|
73
|
+
}
|
74
|
+
var keywords = wordRegexp(myKeywords);
|
75
|
+
var builtins = wordRegexp(myBuiltins);
|
76
|
+
|
77
|
+
// tokenizers
|
78
|
+
function tokenBase(stream, state) {
|
79
|
+
if (stream.sol()) state.indent = stream.indentation()
|
80
|
+
// Handle scope changes
|
81
|
+
if (stream.sol() && top(state).type == "py") {
|
82
|
+
var scopeOffset = top(state).offset;
|
83
|
+
if (stream.eatSpace()) {
|
84
|
+
var lineOffset = stream.indentation();
|
85
|
+
if (lineOffset > scopeOffset)
|
86
|
+
pushPyScope(state);
|
87
|
+
else if (lineOffset < scopeOffset && dedent(stream, state) && stream.peek() != "#")
|
88
|
+
state.errorToken = true;
|
89
|
+
return null;
|
90
|
+
} else {
|
91
|
+
var style = tokenBaseInner(stream, state);
|
92
|
+
if (scopeOffset > 0 && dedent(stream, state))
|
93
|
+
style += " " + ERRORCLASS;
|
94
|
+
return style;
|
95
|
+
}
|
96
|
+
}
|
97
|
+
return tokenBaseInner(stream, state);
|
98
|
+
}
|
99
|
+
|
100
|
+
function tokenBaseInner(stream, state) {
|
101
|
+
if (stream.eatSpace()) return null;
|
102
|
+
|
103
|
+
var ch = stream.peek();
|
104
|
+
|
105
|
+
// Handle Comments
|
106
|
+
if (ch == "#") {
|
107
|
+
stream.skipToEnd();
|
108
|
+
return "comment";
|
109
|
+
}
|
110
|
+
|
111
|
+
// Handle Number Literals
|
112
|
+
if (stream.match(/^[0-9\.]/, false)) {
|
113
|
+
var floatLiteral = false;
|
114
|
+
// Floats
|
115
|
+
if (stream.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
|
116
|
+
if (stream.match(/^[\d_]+\.\d*/)) { floatLiteral = true; }
|
117
|
+
if (stream.match(/^\.\d+/)) { floatLiteral = true; }
|
118
|
+
if (floatLiteral) {
|
119
|
+
// Float literals may be "imaginary"
|
120
|
+
stream.eat(/J/i);
|
121
|
+
return "number";
|
122
|
+
}
|
123
|
+
// Integers
|
124
|
+
var intLiteral = false;
|
125
|
+
// Hex
|
126
|
+
if (stream.match(/^0x[0-9a-f_]+/i)) intLiteral = true;
|
127
|
+
// Binary
|
128
|
+
if (stream.match(/^0b[01_]+/i)) intLiteral = true;
|
129
|
+
// Octal
|
130
|
+
if (stream.match(/^0o[0-7_]+/i)) intLiteral = true;
|
131
|
+
// Decimal
|
132
|
+
if (stream.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)) {
|
133
|
+
// Decimal literals may be "imaginary"
|
134
|
+
stream.eat(/J/i);
|
135
|
+
// TODO - Can you have imaginary longs?
|
136
|
+
intLiteral = true;
|
137
|
+
}
|
138
|
+
// Zero by itself with no other piece of number.
|
139
|
+
if (stream.match(/^0(?![\dx])/i)) intLiteral = true;
|
140
|
+
if (intLiteral) {
|
141
|
+
// Integer literals may be "long"
|
142
|
+
stream.eat(/L/i);
|
143
|
+
return "number";
|
144
|
+
}
|
145
|
+
}
|
146
|
+
|
147
|
+
// Handle Strings
|
148
|
+
if (stream.match(stringPrefixes)) {
|
149
|
+
state.tokenize = tokenStringFactory(stream.current());
|
150
|
+
return state.tokenize(stream, state);
|
151
|
+
}
|
152
|
+
|
153
|
+
for (var i = 0; i < operators.length; i++)
|
154
|
+
if (stream.match(operators[i])) return "operator"
|
155
|
+
|
156
|
+
if (stream.match(delimiters)) return "punctuation";
|
157
|
+
|
158
|
+
if (state.lastToken == "." && stream.match(identifiers))
|
159
|
+
return "property";
|
160
|
+
|
161
|
+
if (stream.match(keywords) || stream.match(wordOperators))
|
162
|
+
return "keyword";
|
163
|
+
|
164
|
+
if (stream.match(builtins))
|
165
|
+
return "builtin";
|
166
|
+
|
167
|
+
if (stream.match(/^(self|cls)\b/))
|
168
|
+
return "variable-2";
|
169
|
+
|
170
|
+
if (stream.match(identifiers)) {
|
171
|
+
if (state.lastToken == "def" || state.lastToken == "class")
|
172
|
+
return "def";
|
173
|
+
return "variable";
|
174
|
+
}
|
175
|
+
|
176
|
+
// Handle non-detected items
|
177
|
+
stream.next();
|
178
|
+
return ERRORCLASS;
|
179
|
+
}
|
180
|
+
|
181
|
+
function tokenStringFactory(delimiter) {
|
182
|
+
while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
|
183
|
+
delimiter = delimiter.substr(1);
|
184
|
+
|
185
|
+
var singleline = delimiter.length == 1;
|
186
|
+
var OUTCLASS = "string";
|
187
|
+
|
188
|
+
function tokenString(stream, state) {
|
189
|
+
while (!stream.eol()) {
|
190
|
+
stream.eatWhile(/[^'"\\]/);
|
191
|
+
if (stream.eat("\\")) {
|
192
|
+
stream.next();
|
193
|
+
if (singleline && stream.eol())
|
194
|
+
return OUTCLASS;
|
195
|
+
} else if (stream.match(delimiter)) {
|
196
|
+
state.tokenize = tokenBase;
|
197
|
+
return OUTCLASS;
|
198
|
+
} else {
|
199
|
+
stream.eat(/['"]/);
|
200
|
+
}
|
201
|
+
}
|
202
|
+
if (singleline) {
|
203
|
+
if (parserConf.singleLineStringErrors)
|
204
|
+
return ERRORCLASS;
|
205
|
+
else
|
206
|
+
state.tokenize = tokenBase;
|
207
|
+
}
|
208
|
+
return OUTCLASS;
|
209
|
+
}
|
210
|
+
tokenString.isString = true;
|
211
|
+
return tokenString;
|
212
|
+
}
|
213
|
+
|
214
|
+
function pushPyScope(state) {
|
215
|
+
while (top(state).type != "py") state.scopes.pop()
|
216
|
+
state.scopes.push({offset: top(state).offset + conf.indentUnit,
|
217
|
+
type: "py",
|
218
|
+
align: null})
|
219
|
+
}
|
220
|
+
|
221
|
+
function pushBracketScope(stream, state, type) {
|
222
|
+
var align = stream.match(/^([\s\[\{\(]|#.*)*$/, false) ? null : stream.column() + 1
|
223
|
+
state.scopes.push({offset: state.indent + hangingIndent,
|
224
|
+
type: type,
|
225
|
+
align: align})
|
226
|
+
}
|
227
|
+
|
228
|
+
function dedent(stream, state) {
|
229
|
+
var indented = stream.indentation();
|
230
|
+
while (state.scopes.length > 1 && top(state).offset > indented) {
|
231
|
+
if (top(state).type != "py") return true;
|
232
|
+
state.scopes.pop();
|
233
|
+
}
|
234
|
+
return top(state).offset != indented;
|
235
|
+
}
|
236
|
+
|
237
|
+
function tokenLexer(stream, state) {
|
238
|
+
if (stream.sol()) state.beginningOfLine = true;
|
239
|
+
|
240
|
+
var style = state.tokenize(stream, state);
|
241
|
+
var current = stream.current();
|
242
|
+
|
243
|
+
// Handle decorators
|
244
|
+
if (state.beginningOfLine && current == "@")
|
245
|
+
return stream.match(identifiers, false) ? "meta" : py3 ? "operator" : ERRORCLASS;
|
246
|
+
|
247
|
+
if (/\S/.test(current)) state.beginningOfLine = false;
|
248
|
+
|
249
|
+
if ((style == "variable" || style == "builtin")
|
250
|
+
&& state.lastToken == "meta")
|
251
|
+
style = "meta";
|
252
|
+
|
253
|
+
// Handle scope changes.
|
254
|
+
if (current == "pass" || current == "return")
|
255
|
+
state.dedent += 1;
|
256
|
+
|
257
|
+
if (current == "lambda") state.lambda = true;
|
258
|
+
if (current == ":" && !state.lambda && top(state).type == "py")
|
259
|
+
pushPyScope(state);
|
260
|
+
|
261
|
+
var delimiter_index = current.length == 1 ? "[({".indexOf(current) : -1;
|
262
|
+
if (delimiter_index != -1)
|
263
|
+
pushBracketScope(stream, state, "])}".slice(delimiter_index, delimiter_index+1));
|
264
|
+
|
265
|
+
delimiter_index = "])}".indexOf(current);
|
266
|
+
if (delimiter_index != -1) {
|
267
|
+
if (top(state).type == current) state.indent = state.scopes.pop().offset - hangingIndent
|
268
|
+
else return ERRORCLASS;
|
269
|
+
}
|
270
|
+
if (state.dedent > 0 && stream.eol() && top(state).type == "py") {
|
271
|
+
if (state.scopes.length > 1) state.scopes.pop();
|
272
|
+
state.dedent -= 1;
|
273
|
+
}
|
274
|
+
|
275
|
+
return style;
|
276
|
+
}
|
277
|
+
|
278
|
+
var external = {
|
279
|
+
startState: function(basecolumn) {
|
280
|
+
return {
|
281
|
+
tokenize: tokenBase,
|
282
|
+
scopes: [{offset: basecolumn || 0, type: "py", align: null}],
|
283
|
+
indent: basecolumn || 0,
|
284
|
+
lastToken: null,
|
285
|
+
lambda: false,
|
286
|
+
dedent: 0
|
287
|
+
};
|
288
|
+
},
|
289
|
+
|
290
|
+
token: function(stream, state) {
|
291
|
+
var addErr = state.errorToken;
|
292
|
+
if (addErr) state.errorToken = false;
|
293
|
+
var style = tokenLexer(stream, state);
|
294
|
+
|
295
|
+
if (style && style != "comment")
|
296
|
+
state.lastToken = (style == "keyword" || style == "punctuation") ? stream.current() : style;
|
297
|
+
if (style == "punctuation") style = null;
|
298
|
+
|
299
|
+
if (stream.eol() && state.lambda)
|
300
|
+
state.lambda = false;
|
301
|
+
return addErr ? style + " " + ERRORCLASS : style;
|
302
|
+
},
|
303
|
+
|
304
|
+
indent: function(state, textAfter) {
|
305
|
+
if (state.tokenize != tokenBase)
|
306
|
+
return state.tokenize.isString ? CodeMirror.Pass : 0;
|
307
|
+
|
308
|
+
var scope = top(state), closing = scope.type == textAfter.charAt(0)
|
309
|
+
if (scope.align != null)
|
310
|
+
return scope.align - (closing ? 1 : 0)
|
311
|
+
else
|
312
|
+
return scope.offset - (closing ? hangingIndent : 0)
|
313
|
+
},
|
314
|
+
|
315
|
+
electricInput: /^\s*[\}\]\)]$/,
|
316
|
+
closeBrackets: {triples: "'\""},
|
317
|
+
lineComment: "#",
|
318
|
+
fold: "indent"
|
319
|
+
};
|
320
|
+
return external;
|
321
|
+
});
|
322
|
+
|
323
|
+
CodeMirror.defineMIME("text/x-python", "python");
|
324
|
+
|
325
|
+
var words = function(str) { return str.split(" "); };
|
326
|
+
|
327
|
+
CodeMirror.defineMIME("text/x-cython", {
|
328
|
+
name: "python",
|
329
|
+
extra_keywords: words("by cdef cimport cpdef ctypedef enum except "+
|
330
|
+
"extern gil include nogil property public "+
|
331
|
+
"readonly struct union DEF IF ELIF ELSE")
|
332
|
+
});
|
333
|
+
|
334
|
+
});
|