forked from bitovi/documentjs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodeend.js
More file actions
62 lines (58 loc) · 1.41 KB
/
Copy pathcodeend.js
File metadata and controls
62 lines (58 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
steal.then(function() {
/**
* @class DocumentJS.tags.codeend
* @tag documentation
* @parent DocumentJS.tags
*
* Stops a code block.
*
* ###Example:
*
* @codestart
*
* /*
* * @codestart
* * /* @class
* * * Person represents a human with a name. Read about the
* * * animal class [Animal | here].
* * * @constructor
* * * You must pass in a name.
* * * @param {String} name A person's name
* * *|
* * Person = function(name){
* * this.name = name
* * Person.count ++;
* * }
* * /* @Static *|
* * steal.Object.extend(Person, {
* * /* Number of People *|
* * count: 0
* * })
* * /* @Prototype *|
* * Person.prototype = {
* * /* Returns a formal name
* * * @return {String} the name with "Mrs." added
* * *|
* * fancyName : function(){
* * return "Mrs. "+this.name;
* * }
* * }
* * @codeend
* *|
*
* @codeend
*/
DocumentJS.tags.codeend = {
add: function( line, data ) {
if (!data.lines ) {
print('you probably have a @codeend without a @codestart')
}
var joined = data.lines.join("\n");
if ( data.type == "javascript" ) { //convert comments
joined = joined.replace(/\*\|/g, "*/")
}
var out = "<pre><code class='" + data.type + "'>" + joined + "</code></pre>";
return ["pop", out];
}
};
})