docjs 0.1.5 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.md +11 -14
- data/README.md +27 -18
- data/docjs.gemspec +3 -3
- data/docs/PATTERNS.md +2 -2
- data/docs/guides/CUSTOMIZE.md +125 -28
- data/docs/guides/TRY.md +2 -1
- data/docs/guides/USE.md +139 -89
- data/lib/code_object/base.rb +0 -10
- data/lib/code_object/converter.rb +3 -3
- data/lib/dom/dom.rb +24 -21
- data/lib/dom/no_doc.rb +2 -2
- data/lib/dom/node.rb +25 -26
- data/lib/helper/helper.rb +161 -36
- data/lib/helper/linker.rb +47 -11
- data/lib/parser/comment.rb +9 -8
- data/lib/parser/comment_parser.rb +9 -10
- data/lib/parser/parser.rb +4 -6
- data/lib/processor.rb +1 -1
- data/lib/token/handler.rb +13 -0
- data/lib/token/token.rb +3 -4
- data/templates/generators/api_pages_generator.rb +0 -4
- data/templates/generators/docs_generator.rb +1 -2
- data/templates/resources/css/application.css +92 -17
- data/templates/resources/js/jcore.js +37 -2
- data/templates/resources/scss/_header.scss +4 -5
- data/templates/resources/scss/_helpers.scss +6 -0
- data/templates/resources/scss/_highlighter.scss +5 -8
- data/templates/resources/scss/_tooltip.scss +2 -2
- data/templates/resources/scss/application.scss +6 -4
- data/templates/tokens/tokens.rb +47 -9
- data/templates/types/function.rb +19 -57
- data/templates/types/object.rb +3 -10
- data/templates/types/prototype.rb +1 -1
- data/test/docs/README.md +35 -14
- metadata +3 -7
- data/docs/ARCHITECTURE.md +0 -0
- data/docs/CONCEPT.md +0 -80
- data/docs/DOCUMENTATION.md +0 -39
- data/templates/views/index.html.erb +0 -0
data/docs/ARCHITECTURE.md
DELETED
File without changes
|
data/docs/CONCEPT.md
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
Concept of the Documententation
|
2
|
-
===============================
|
3
|
-
|
4
|
-
There are only two build-in types, we want to pay attention to:
|
5
|
-
|
6
|
-
1. Objects
|
7
|
-
2. Functions
|
8
|
-
|
9
|
-
|
10
|
-
Object
|
11
|
-
------
|
12
|
-
By **Objects** we mean all kind of *things*, that can contain other things. Those containted ones, we call **properties** of the Object.
|
13
|
-
|
14
|
-
In JavaScript this may look like:
|
15
|
-
|
16
|
-
var obj = {
|
17
|
-
property_one: function() { ... },
|
18
|
-
property_two: {
|
19
|
-
// another object
|
20
|
-
},
|
21
|
-
property_three: 3
|
22
|
-
}
|
23
|
-
|
24
|
-
|
25
|
-
Function
|
26
|
-
--------
|
27
|
-
**Functions** are *things*, that can be executed. They can have **parameters** and **return-values** There are two types of Functions: plain functions and **constructors**.
|
28
|
-
|
29
|
-
Example for a plain function:
|
30
|
-
|
31
|
-
function my_func(param) {
|
32
|
-
return "Hello world!";
|
33
|
-
}
|
34
|
-
|
35
|
-
Example for a function as a constructor
|
36
|
-
|
37
|
-
function my_constructor() {
|
38
|
-
this.message = "Hello world!";
|
39
|
-
}
|
40
|
-
|
41
|
-
|
42
|
-
Remember: any return-value of a constructor-function will be ignored and replaced by this
|
43
|
-
|
44
|
-
But a function can be an object at the same time. For example:
|
45
|
-
|
46
|
-
function my_func_two() {
|
47
|
-
return "fancy function";
|
48
|
-
}
|
49
|
-
my_func_two.message = "Say hello to Mr. Foo";
|
50
|
-
|
51
|
-
Most important a function can contain one special property **prototype**.
|
52
|
-
|
53
|
-
Remember: In this case the function has to be a constructor. Otherwise prototype would be useless, because it is only used when creating instances of the function using new. After creating an instance the prototype-object is accessible in the this-context of the instance.
|
54
|
-
|
55
|
-
function my_constructor() {
|
56
|
-
this.message = "Hello world!";
|
57
|
-
}
|
58
|
-
my_constructor.prop1 = 456;
|
59
|
-
my_constructor.prototype = {
|
60
|
-
some_proto_prop: 123
|
61
|
-
}
|
62
|
-
|
63
|
-
Revealing Module Pattern
|
64
|
-
------------------------
|
65
|
-
But what about revealing modules?
|
66
|
-
|
67
|
-
function my_module() {
|
68
|
-
|
69
|
-
// some private stuff here
|
70
|
-
|
71
|
-
return {
|
72
|
-
property_of_the: "returned object"
|
73
|
-
};
|
74
|
-
}
|
75
|
-
|
76
|
-
One should pay attention to this pattern while creating a documentation tool.
|
77
|
-
|
78
|
-
Conclusion
|
79
|
-
----------
|
80
|
-
So we can break it down to Functions and Objects. Objects can have properties. Functions can, at the same time, be Objects. There are special functions, called *constructors*, which in turn have one special property called *prototype*. This property has to be handled special in documentation.
|
data/docs/DOCUMENTATION.md
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
Fullqualifier
|
2
|
-
-------------
|
3
|
-
Like an absolute path (/etc/init.d/apache2) we use `FOO.bar` as fullqualifier to
|
4
|
-
an object or function.
|
5
|
-
|
6
|
-
A leading dot suggests filling the empty leading space with the current parsing-context.
|
7
|
-
As such `.something_else` would be resolved to `FOO.bar.something_else` in the current context.
|
8
|
-
|
9
|
-
Examplecode:
|
10
|
-
|
11
|
-
/**
|
12
|
-
* @function my_module
|
13
|
-
* @return [my_module.object]
|
14
|
-
*/
|
15
|
-
function my_module() {
|
16
|
-
|
17
|
-
// some private stuff here
|
18
|
-
|
19
|
-
|
20
|
-
/**
|
21
|
-
* @property .foo
|
22
|
-
*/
|
23
|
-
my_module.foo = 123;
|
24
|
-
|
25
|
-
|
26
|
-
/**
|
27
|
-
* @property .foo_bar
|
28
|
-
*/
|
29
|
-
my_module.foo_bar = 789;
|
30
|
-
|
31
|
-
|
32
|
-
/**
|
33
|
-
* @object .object
|
34
|
-
*/
|
35
|
-
return {
|
36
|
-
/* @property .object.property_of_the */
|
37
|
-
property_of_the: "returned object"
|
38
|
-
};
|
39
|
-
}
|
File without changes
|