Skip to content

Commit 01156b4

Browse files
committed
Added CND syntax highlighter
1 parent 926e216 commit 01156b4

File tree

3 files changed

+81
-64
lines changed

3 files changed

+81
-64
lines changed

Diff for: _exts/phpcr/_test.cnd

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<acmeBlog = "http://example.org/basiccms/ns/1.0">
2+
3+
[acmeBlog:blog] > nt:base, mix:lastModified, mix:created
4+
- title
5+
+ * (acmeBlog:post)
6+
7+
[acmeBlog:post] > nt:base, mix:lastModified, mix:created
8+
- title (string) mandatory
9+
- date (date) mandatory
10+
- body (string) mandatory
11+
- tags (string) multiple
12+
+ * (acmeBlog:comment)
13+
14+
[acmeBlog:comment] > nt:base, mix:created
15+
- author (string) mandatory
16+
- comment (string) mandatory

Diff for: book/node_types.rst

+64-64
Original file line numberDiff line numberDiff line change
@@ -17,69 +17,7 @@ An Example
1717
As an example we will define the node types required by a canonical blog
1818
application.
1919

20-
.. configuration-block::
21-
22-
.. code-block:: php
23-
24-
<?php
25-
26-
use PHPCR\NodeType\NodeDefinitionInterface;
27-
use PHPCR\NodeType\NodeTypeDefinitionInterface;
28-
use PHPCR\NodeType\PropertyDefinitionInterface;
29-
30-
class AcmeBlogNodeType implements NodeTypeDefinitionInterface
31-
{
32-
public function getName()
33-
{
34-
return 'acmeBlog:blog';
35-
}
36-
37-
public function getDeclaredSupertypeNames()
38-
{
39-
return array(
40-
'nt:base'
41-
);
42-
}
43-
44-
public function isAbstract()
45-
{
46-
return false;
47-
}
48-
49-
public function isMixin()
50-
{
51-
return false;
52-
}
53-
54-
public function hasOrderableChildNodes()
55-
{
56-
return false;
57-
}
58-
59-
public function isQueryable()
60-
{
61-
return false;
62-
}
63-
64-
public function getPrimaryItemName()
65-
{
66-
return 'title';
67-
}
68-
69-
public function getDeclaredPropertyDefinitions()
70-
{
71-
return array(
72-
73-
);
74-
}
75-
76-
public function getDeclaredChildNodeDefinitions()
77-
{
78-
return array();
79-
}
80-
}
81-
82-
.. code-block:: cnd
20+
.. code-block:: cnd
8321
8422
<acmeBlog = "http://example.org/basiccms/ns/1.0">
8523
@@ -115,6 +53,69 @@ nt:file & nt:folder
11553

11654
TODO: List all built-in node types here
11755

56+
The Canonical Example
57+
---------------------
58+
59+
This has been copied directly from the `Jackrabbit Node Type Reference <http://jackrabbit.apache.org/node-type-notation.html>`_.
60+
61+
.. code-block:: cnd
62+
63+
/* An example node type definition */
64+
65+
// The namespace declaration
66+
<ns = 'http://namespace.com/ns'>
67+
68+
// Node type name
69+
[ns:NodeType]
70+
71+
// Supertypes
72+
> ns:ParentType1, ns:ParentType2
73+
74+
// This node type supports orderable child nodes
75+
orderable
76+
77+
// This is a mixin node type
78+
mixin
79+
80+
// Nodes of this node type have a property called 'ex:property' of type STRING
81+
- ex:property (string)
82+
83+
// The default values for this
84+
// (multi-value) property are...
85+
= 'default1', 'default2'
86+
87+
// This property is the primary item
88+
primary
89+
90+
// and it is...
91+
mandatory autocreated protected
92+
93+
// and multi-valued
94+
multiple
95+
96+
// It has an on-parent-version setting of ...
97+
version
98+
99+
// The constraint settings are...
100+
< 'constraint1', 'constraint2'
101+
102+
// Nodes of this node type have a child node called ns:node which must be of
103+
// at least the node types ns:reqType1 and ns:reqType2
104+
+ ns:node (ns:reqType1, ns:reqType2)
105+
106+
// and the default primary node type of the child node is...
107+
= ns:defaultType
108+
109+
// This child node is...
110+
mandatory autocreated protected
111+
112+
// and supports same name siblings
113+
multiple
114+
115+
// and has an on-parent-version setting of ...
116+
version
117+
118+
118119
Further Reading
119120
---------------
120121

@@ -124,4 +125,3 @@ Further Reading
124125
* If you need to store additional properties or children on existing node types like files, note that while a node can have only one primary type, every node can have any mixin types. Define a mixin type declaring your additional properties, register it with PHPCR and addMixin it to the nodes that need it.
125126

126127
You can define your own node types if you want the equivalent of a strictly defined database structure. See `JCR 2.0: 3.7 Node Types <http://www.day.com/specs/jcr/2.0/3_Repository_Model.html#3.7%20Node%20Types>`_ and `JCR 2.0: 19 Node Type Management <http://www.day.com/specs/jcr/2.0/19_Node_Type_Management.html>`_ / `PHPCR Node Type Namespace <http://phpcr.github.io/doc/html/index.html>`_.
127-

Diff for: conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232

3333
# why doesn't this work on readthedocs?
3434
# extensions = ['phpcr.sphinx.cnd']
35+
extensions = ['phpcr.sphinx.cnd']
3536

3637
# Add any paths that contain templates here, relative to this directory.
3738
templates_path = ['_templates']

0 commit comments

Comments
 (0)