Skip to content

Commit

Permalink
Merge branch 'master' of github.com:vincent-zurczak/highlight.js into…
Browse files Browse the repository at this point in the history
… vincent-zurczak-master

Conflicts:
	AUTHORS.en.txt
  • Loading branch information
Sannis committed Oct 27, 2014
2 parents 16debbb + 2060f36 commit 2e6549e
Show file tree
Hide file tree
Showing 8 changed files with 199 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ docs/_build
__pycache__
*.swp
node_modules
.project
1 change: 1 addition & 0 deletions AUTHORS.en.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,4 @@ Contributors:
- Mickael Delahaye <[email protected]>
- Hakan Özler <[email protected]>
- Trey Shugart <[email protected]>
- Vincent Zurczak <[email protected]>
1 change: 1 addition & 0 deletions AUTHORS.ru.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,4 @@ URL: https://highlightjs.org/
- Микаэль Делахэй <[email protected]>
- Хакан Озлер <[email protected]>
- Трей Шугарт <[email protected]>
- Винсен Зуржак <[email protected]>
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ New languages in this release:
- *XL* by [Christophe de Dinechin][]
- *LiveScript* by [Taneli Vatanen][] and [Jen Evers-Corvina][]
- *ERB* (Ruby in HTML) by [Lucas Mazza][]
- *Roboconf* by [Vincent Zurczak][]

[b]: http://highlightjs.readthedocs.org/en/latest/building-testing.html
[Jeremy Hull]: https://github.com/sourrust
Expand All @@ -53,6 +54,7 @@ New languages in this release:
[Taneli Vatanen]: https://github.com/Daiz-
[Jen Evers-Corvina]: https://github.com/sevvie
[Lucas Mazza]: https://github.com/lucasmazza
[Vincent Zurczak]: https://github.com/vincent-zurczak

## Version 8.2

Expand Down Expand Up @@ -259,6 +261,8 @@ Miscellaneous improvements:
- Big overhaul of relevance counting for a number of languages. Please do report
bugs about mis-detection of non-trivial code snippets!

[API reference]: http://highlightjs.readthedocs.org/en/latest/api.html

[cr]: http://highlightjs.readthedocs.org/en/latest/css-classes-reference.html
[api docs]: http://highlightjs.readthedocs.org/en/latest/api.html
[variants]: https://groups.google.com/d/topic/highlightjs/VoGC9-1p5vk/discussion
Expand Down
10 changes: 10 additions & 0 deletions docs/css-classes-reference.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1272,3 +1272,13 @@ XL ("xl", "tao")
* ``number``: Number values
* ``function``: Function or variable definition
* ``import``: Import clause

Roboconf ("graph", "instances")
------------------------------

* ``keyword``: keyword
* ``string``: names of imported variables
* ``comment``: comment
* ``facet``: a **facet** section
* ``component``: a **component** section
* ``instance-of``: an **instance** section
66 changes: 66 additions & 0 deletions src/languages/roboconf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
Language: Roboconf
Author: Vincent Zurczak <[email protected]>
Website: http://roboconf.net
Description: Syntax highlighting for Roboconf's DSL
*/

function(hljs) {
var IDENTIFIER = '[a-zA-Z-_][^\n{\r\n]+\\{';

return {
aliases: ['graph', 'instances'],
case_insensitive: true,
keywords: 'import',
contains: [
// Facet sections
{
className: 'facet',
begin: '^facet ' + IDENTIFIER,
end: '}',
keywords: 'facet installer exports children extends',
contains: [
hljs.HASH_COMMENT_MODE
]
},

// Instance sections
{
className: 'instance-of',
begin: '^instance of ' + IDENTIFIER,
end: '}',
keywords: 'name count channels instance-data instance-state instance of',
contains: [
// Instance overridden properties
{
className: 'keyword',
begin: '[a-zA-Z-_]+( |\t)*:'
},
hljs.HASH_COMMENT_MODE
]
},

// Component sections
{
className: 'component',
begin: '^' + IDENTIFIER,
end: '}',
lexemes: '\\(?[a-zA-Z]+\\)?',
keywords: 'installer exports children extends imports facets alias (optional)',
contains: [
// Imported component variables
{
className: 'string',
begin: '\\.[a-zA-Z-_]+',
end: '\\s|,|;',
excludeEnd: true
},
hljs.HASH_COMMENT_MODE
]
},

// Comments
hljs.HASH_COMMENT_MODE
]
};
}
62 changes: 62 additions & 0 deletions src/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -3974,6 +3974,68 @@ <h2>Automatically detected languages</h2>
rectangle 0, 0, 100000, 1154
</code></pre>

<tr>
<th>Roboconf</th>
<td class="roboconf">
<pre><code>
# This is a comment
import toto.graph;

##
# Facet
##
facet VM {
installer: iaas;
}

# Components
VM_ec2 {
facets: VM;
children: cluster-node, mysql;
}

VM_openstack {
facets: VM;
children: cluster-node, mysql;
}

cluster-node {
alias: a cluster node;
installer: puppet;
exports: ip, port, optional-property1, optional_property2;
imports: cluster-node.ip (optional), cluster-node.port (optional), mysql.ip, mysql.port;
}

mysql {
alias: a MySQL database;
installer: puppet;
exports: ip, port;
}

##
# Normally, instances are defined in another file...
##
instance of VM_ec2 {
name: VM_;
count: 3;
my-instance-property: whatever;

instance of cluster-node {
name: cluster node; # An in-line comment
}
}

instance of VM_openstack {
name: VM_database;

instance of mysql {
name: mysql;
}
}
</code></pre>
</td>
</tr>

</table>


Expand Down
54 changes: 54 additions & 0 deletions test/detect/roboconf/default.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# This is a comment
import toto.graph;

##
# Facet
##
facet VM {
installer: iaas;
}

# Components
VM_ec2 {
facets: VM;
children: cluster-node, mysql;
}

VM_openstack {
facets: VM;
children: cluster-node, mysql;
}

cluster-node {
alias: a cluster node;
installer: puppet;
exports: ip, port, optional-property1, optional_property2;
imports: cluster-node.ip (optional), cluster-node.port (optional), mysql.ip, mysql.port;
}

mysql {
alias: a MySQL database;
installer: puppet;
exports: ip, port;
}

##
# Normally, instances are defined in another file...
##
instance of VM_ec2 {
name: VM_;
count: 3;
my-instance-property: whatever;

instance of cluster-node {
name: cluster node; # An in-line comment
}
}

instance of VM_openstack {
name: VM_database;

instance of mysql {
name: mysql;
}
}

0 comments on commit 2e6549e

Please sign in to comment.