Changeset 12601
- Timestamp:
- 02/21/08 18:01:30 (11 months ago)
- Location:
- util
- Files:
-
- 6 modified
-
branches/dev/jsdoc/INSTALL (modified) (1 diff)
-
branches/dev/jsdoc/jsdoc.css (modified) (1 diff)
-
branches/dev/jsdoc/jsdoc.install (modified) (2 diffs)
-
branches/dev/jsdoc/jsdoc.module (modified) (12 diffs)
-
trunk/docscripts/includes/dojo.inc (modified) (2 diffs)
-
trunk/docscripts/lib/parser/DojoObject.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
util/branches/dev/jsdoc/INSTALL
r10914 r12601 16 16 ===================== 17 17 18 http://drupal.org/node/70151 18 19 Drop the jsdoc folder into sites/all/modules 19 20 -
util/branches/dev/jsdoc/jsdoc.css
r11199 r12601 1 /** 2 * GeSHi Dynamically Generated Stylesheet 3 * -------------------------------------- 4 * Dynamically generated stylesheet for javascript 5 * CSS class: javascript, CSS id: 6 * GeSHi (C) 2004 - 2007 Nigel McNie (http://qbnz.com/highlighter) 7 */ 8 .javascript .de1, .javascript .de2 {font-family: 'Courier New', Courier, monospace; font-weight: normal;} 9 .javascript {} 10 .javascript .head {} 11 .javascript .foot {} 12 .javascript .imp {font-weight: bold; color: red;} 13 .javascript .ln-xtra {color: #cc0; background-color: #ffc;} 14 .javascript li {font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;} 15 .javascript li.li2 {font-weight: bold;} 16 .javascript .kw1 {color: #000066; font-weight: bold;} 17 .javascript .kw2 {color: #003366; font-weight: bold;} 1 /* GeSHi (c) Nigel McNie 2004 (http://qbnz.com/highlighter) */ 2 .javascript .de1, .javascript .de2 {font-weight:normal;background:transparent;color:#000; padding-left: 5px;} 3 .javascript .kw1 {color: #a1a100;} 4 .javascript .kw2 {color: #000; font-weight: bold;} 18 5 .javascript .kw3 {color: #000066;} 19 .javascript . co1 {color: #009900; font-style: italic;}20 .javascript .co MULTI {color: #009900; font-style: italic;}21 .javascript .es0 {color: #0000 99; font-weight: bold;}6 .javascript .kw4 {color: #f63333;} 7 .javascript .co1, .javascript .co2, .javascript .coMULTI {color: #808080;} 8 .javascript .es0 {color: #000033; font-weight: bold;} 22 9 .javascript .br0 {color: #66cc66;} 23 .javascript .st0 {color: #3366CC;} 24 .javascript .nu0 {color: #CC0000;} 25 .javascript .me1 {color: #006600;} 26 .javascript .sc0 {} 27 .javascript .sc1 {} 28 .javascript .sc2 {} 29 .javascript .sc3 {} 30 .javascript .re0 {color: #0066FF;} 31 /** 32 * GeSHi Dynamically Generated Stylesheet 33 * -------------------------------------- 34 * Dynamically generated stylesheet for javascript 35 * CSS class: javascript, CSS id: 36 * GeSHi (C) 2004 - 2007 Nigel McNie (http://qbnz.com/highlighter) 37 */ 38 .javascript .de1, .javascript .de2 {font-family: 'Courier New', Courier, monospace; font-weight: normal;} 39 .javascript {} 40 .javascript .head {} 41 .javascript .foot {} 42 .javascript .imp {font-weight: bold; color: red;} 43 .javascript .ln-xtra {color: #cc0; background-color: #ffc;} 44 .javascript li {font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;} 45 .javascript li.li2 {font-weight: bold;} 46 .javascript .kw1 {color: #000066; font-weight: bold;} 47 .javascript .kw2 {color: #003366; font-weight: bold;} 48 .javascript .kw3 {color: #000066;} 49 .javascript .kw4 {color: #600000;} 50 .javascript .co1 {color: #009900; font-style: italic;} 51 .javascript .coMULTI {color: #009900; font-style: italic;} 52 .javascript .es0 {color: #000099; font-weight: bold;} 53 .javascript .br0 {color: #66cc66;} 54 .javascript .st0 {color: #3366CC;} 55 .javascript .nu0 {color: #CC0000;} 56 .javascript .me1 {color: #006600;} 57 .javascript .sc0 {} 58 .javascript .sc1 {} 59 .javascript .sc2 {} 60 .javascript .sc3 {} 61 .javascript .re0 {color: #0066FF;} 62 /** 63 * GeSHi Dynamically Generated Stylesheet 64 * -------------------------------------- 65 * Dynamically generated stylesheet for javascript 66 * CSS class: javascript, CSS id: 67 * GeSHi (C) 2004 - 2007 Nigel McNie (http://qbnz.com/highlighter) 68 */ 69 .javascript .de1, .javascript .de2 {font-family: 'Courier New', Courier, monospace; font-weight: normal;} 70 .javascript {} 71 .javascript .head {} 72 .javascript .foot {} 73 .javascript .imp {font-weight: bold; color: red;} 74 .javascript .ln-xtra {color: #cc0; background-color: #ffc;} 75 .javascript li {font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;} 76 .javascript li.li2 {font-weight: bold;} 77 .javascript .kw1 {color: #000066; font-weight: bold;} 78 .javascript .kw2 {color: #003366; font-weight: bold;} 79 .javascript .kw3 {color: #000066;} 80 .javascript .co1 {color: #009900; font-style: italic;} 81 .javascript .coMULTI {color: #009900; font-style: italic;} 82 .javascript .es0 {color: #000099; font-weight: bold;} 83 .javascript .br0 {color: #66cc66;} 84 .javascript .st0 {color: #3366CC;} 85 .javascript .nu0 {color: #CC0000;} 86 .javascript .me1 {color: #006600;} 87 .javascript .sc0 {} 88 .javascript .sc1 {} 89 .javascript .sc2 {} 90 .javascript .sc3 {} 91 .javascript .re0 {color: #0066FF;} 92 /** 93 * GeSHi Dynamically Generated Stylesheet 94 * -------------------------------------- 95 * Dynamically generated stylesheet for javascript 96 * CSS class: javascript, CSS id: 97 * GeSHi (C) 2004 - 2007 Nigel McNie (http://qbnz.com/highlighter) 98 */ 99 .javascript .de1, .javascript .de2 {font-family: 'Courier New', Courier, monospace; font-weight: normal;} 100 .javascript {} 101 .javascript .head {} 102 .javascript .foot {} 103 .javascript .imp {font-weight: bold; color: red;} 104 .javascript .ln-xtra {color: #cc0; background-color: #ffc;} 105 .javascript li {font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;} 106 .javascript li.li2 {font-weight: bold;} 107 .javascript .kw1 {color: #000066; font-weight: bold;} 108 .javascript .kw2 {color: #003366; font-weight: bold;} 109 .javascript .kw3 {color: #000066;} 110 .javascript .co1 {color: #009900; font-style: italic;} 111 .javascript .coMULTI {color: #009900; font-style: italic;} 112 .javascript .es0 {color: #000099; font-weight: bold;} 113 .javascript .br0 {color: #66cc66;} 114 .javascript .st0 {color: #3366CC;} 115 .javascript .nu0 {color: #CC0000;} 116 .javascript .me1 {color: #006600;} 117 .javascript .sc0 {} 118 .javascript .sc1 {} 119 .javascript .sc2 {} 120 .javascript .sc3 {} 121 .javascript .re0 {color: #0066FF;} 10 .javascript .st0 {color: #ff0000;} 11 .javascript .nu0 {color: #ff33ff;} 12 .javascript .me0 {color: #006600;} 13 14 .html4strict .de1, .html4strict .de2 {font-weight:normal;background:transparent;color:#000; padding-left: 5px;} 15 .html4strict .kw1 {color: #a1a100;} 16 .html4strict .kw2 {color: #000; font-weight: bold;} 17 .html4strict .kw3 {color: #000066;} 18 .html4strict .kw4 {color: #f63333;} 19 .html4strict .co1, .html4strict .co2, .html4strict .coMULTI {color: #808080;} 20 .html4strict .es0 {color: #000033; font-weight: bold;} 21 .html4strict .br0 {color: #66cc66;} 22 .html4strict .st0 {color: #ff0000;} 23 .html4strict .nu0 {color: #ff33ff;} 24 .html4strict .me0 {color: #006600;} -
util/branches/dev/jsdoc/jsdoc.install
r11930 r12601 139 139 parent_vid integer NOT NULL REFERENCES {node_revisions} (vid), 140 140 parent_nid integer NOT NULL REFERENCES {node} (vid), -- node-type: jsdoc_variable 141 type enum('normal', ' prototype', 'instance', 'alias', 'chain', 'mixin'), -- The type of join141 type enum('normal', 'cascading', 'prototype', 'instance', 'alias', 'chain', 'mixin'), -- The type of join 142 142 subtype enum('call', 'prototype', '') DEFAULT '', -- The subtype of the join 143 143 version integer NOT NULL REFERENCES {node} (nid), -- node-type: jsdoc_version … … 180 180 weight integer NOT NULL, 181 181 example longtext NOT NULL, 182 markedup longtext NOT NULL, 182 183 PRIMARY KEY (vid, weight) 183 184 ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); -
util/branches/dev/jsdoc/jsdoc.module
r12599 r12601 407 407 else { 408 408 _jsdoc_init(); 409 410 $ignores = array(); 411 $query = db_query("SELECT parent.title FROM jsdoc_variable_hierarchy AS jvh JOIN node AS child ON (child.vid = jvh.vid) JOIN jsdoc_objects AS jschild ON (jschild.vid = jvh.nid) JOIN node AS parent ON (parent.vid = jvh.parent_vid) WHERE jvh.type NOT IN ('cascading', 'normal', 'alias') AND (parent.title LIKE 'dojo.%' OR parent.title LIKE 'dojox.%' OR parent.title LIKE 'dijit.%') AND jschild.private = 0 AND jschild.private_parent = 0 GROUP BY BINARY parent.title ORDER BY parent.title"); 412 while ($result = db_fetch_object($query)) { 413 $ignores[] = $result->title; 414 } 415 $namespaces = array(); 416 $query = db_query("SELECT parent.title FROM jsdoc_variable_hierarchy AS jvh JOIN node AS child ON (child.vid = jvh.vid) JOIN jsdoc_objects AS jschild ON (jschild.vid = jvh.nid) JOIN node AS parent ON (parent.vid = jvh.parent_vid) WHERE jvh.type = 'normal' AND (parent.title LIKE 'dojo.%' OR parent.title LIKE 'dojox.%' OR parent.title LIKE 'dijit.%') AND jschild.private = 0 AND jschild.private_parent = 0 GROUP BY BINARY parent.title ORDER BY parent.title"); 417 while ($result = db_fetch_object($query)) { 418 $found = false; 419 foreach ($ignores as $ignore) { 420 if (strpos($ignore, $result->title . '.') === 0 || $ignore == $result->title) { 421 $found = true; 422 break; 423 } 424 } 425 if (!$found) { 426 $namespaces[] = $result->title; 427 } 428 } 429 cache_set('jsdoc_namespaces', 'cache', serialize($namespaces)); 409 430 410 431 $timestamp = variable_get('jsdoc_cron_time', 0); … … 995 1016 if (is_array(jsdoc_get_examples($node))) { 996 1017 foreach (jsdoc_get_examples($node) as $weight => $example) { 997 $example = _jsdoc_markup_text($example, jsdoc_get_version($node)->nid);998 db_query("INSERT INTO {jsdoc_examples} (vid, nid, weight, example ) VALUES (%d, %d, %d, '%s')", $node->vid, $node->nid, $weight, $example);1018 $example = preg_replace('%^([\s]*)\n%', '', $example); 1019 db_query("INSERT INTO {jsdoc_examples} (vid, nid, weight, example, markedup) VALUES (%d, %d, %d, '%s', '%s')", $node->vid, $node->nid, $weight, $example, _jsdoc_markup_text($example, jsdoc_get_version($node)->nid)); 999 1020 } 1000 1021 } … … 1030 1051 if (is_array(jsdoc_get_examples($node))) { 1031 1052 foreach (jsdoc_get_examples($node) as $weight => $example) { 1032 $example = _jsdoc_markup_text($example, jsdoc_get_version($node)->nid);1033 db_query("INSERT INTO {jsdoc_examples} (vid, nid, weight, example ) VALUES (%d, %d, %d, '%s')", $node->vid, $node->nid, $weight, $example);1053 $example = preg_replace('%^([\s]*)\n%', '', $example); 1054 db_query("INSERT INTO {jsdoc_examples} (vid, nid, weight, example, markedup) VALUES (%d, %d, %d, '%s', '%s')", $node->vid, $node->nid, $weight, $example, _jsdoc_markup_text($example, jsdoc_get_version($node)->nid)); 1034 1055 } 1035 1056 } … … 1341 1362 } 1342 1363 1343 function jsdoc_get_examples(&$node ) {1364 function jsdoc_get_examples(&$node, $markedup=false) { 1344 1365 if (isset($node->jsdoc_examples)) { 1345 1366 return $node->jsdoc_examples; … … 1347 1368 1348 1369 $node->jsdoc_examples = array(); 1349 $query = db_query("SELECT example FROM {jsdoc_examples} WHERE vid = %d ORDER BY weight", $node->vid);1370 $query = db_query("SELECT example, markedup FROM {jsdoc_examples} WHERE vid = %d ORDER BY weight", $node->vid); 1350 1371 while ($example = db_fetch_object($query)) { 1351 $node->jsdoc_examples[] = $example->example;1372 $node->jsdoc_examples[] = ($markedup) ? $example->markedup : $example->example; 1352 1373 } 1353 1374 … … 2306 2327 } 2307 2328 } 2329 } 2330 2331 $examples = array(); 2332 foreach (jsdoc_get_examples($node, true) as $weight => $example) { 2333 $examples[] = theme('jsdoc_object_example', $example, $weight + 1); 2334 } 2335 if (!empty($examples)) { 2336 $form['examples'] = array( 2337 '#value' => theme('jsdoc_object_examples', $examples), 2338 '#weight' => 35 2339 ); 2308 2340 } 2309 2341 … … 2885 2917 db_query("INSERT INTO {jsdoc_variable_hierarchy} (vid, nid, parent_vid, parent_nid, type, version) VALUES (%d, %d, %d, %d, '%s', %d)", $node->vid, $node->nid, $parent->vid, $parent->nid, 'instance', jsdoc_get_version($node)->nid); 2886 2918 2887 // If object foo has function foo.bar and foo.bar uses the variable this.baz and is uninstantiated, 2888 // `this` would refer to foo, making baz a property of foo 2889 // So we create a normal join from foo.bar.baz to foo.baz by removing the second to last object section 2890 if (preg_match('%^([^.]+)\.[^.]+\.([^.]+)$%', $node->jsdoc_instance, $match)) { 2919 // If object foo has function foo.bar and foo.bar uses the variable 2920 // this.baz and is uninstantiated, `this` would refer to foo, 2921 // making baz a property of foo. So we create a normal join 2922 // from foo.bar.baz to foo.baz by removing the second to last object section 2923 if (preg_match('%^([^.]+)\.[^.]+\.([^.]+)$%', $node->title, $match)) { 2891 2924 $parent = _jsdoc_variable_get_or_create($match[1] . '.' . $match[2], jsdoc_get_project($node), false); 2892 db_query("INSERT INTO {jsdoc_variable_hierarchy} (vid, nid, parent_vid, parent_nid, type, version) VALUES (%d, %d, %d, %d, '%s', %d)", $node->vid, $node->nid, $parent->vid, $parent->nid, ' normal', jsdoc_get_version($node)->nid);2925 db_query("INSERT INTO {jsdoc_variable_hierarchy} (vid, nid, parent_vid, parent_nid, type, version) VALUES (%d, %d, %d, %d, '%s', %d)", $node->vid, $node->nid, $parent->vid, $parent->nid, 'cascading', jsdoc_get_version($node)->nid); 2893 2926 } 2894 2927 } … … 2920 2953 } 2921 2954 } 2922 } 2955 } 2923 2956 if ($node->jsdoc_chains) { 2924 2957 foreach ($node->jsdoc_chains as $subtype => $chain) { … … 3388 3421 3389 3422 _jsdoc_init(); 3390 $highlighter =& new GeSHi($text, 'javascript'); 3423 $language = 'javascript'; 3424 if (preg_match('%(^\W*<|>\W*$)%', $text)) { 3425 $language = 'html4strict'; 3426 print $language; 3427 } 3428 $highlighter =& new GeSHi($text, $language); 3391 3429 $highlighter->enable_classes(); 3430 $highlighter->enable_keyword_links(false); 3392 3431 $highlighter->set_overall_style('color: #666;', true); 3393 3432 $highlighter->set_tab_width(4); … … 3501 3540 $format = variable_get('jsdoc_input_format', 1); 3502 3541 } 3503 3542 3504 3543 $text = check_markup($text, $format, FALSE); 3505 if (preg_match_all('% <code>(.*?)</code>%s', $text, $matches, PREG_SET_ORDER)) {3544 if (preg_match_all('%(?:\s*(?:<pre>|<code>)\s*)+(.*?)(?:\s*(?:</pre>|</code>)\s*)+%s', $text, $matches, PREG_SET_ORDER)) { 3506 3545 foreach ($matches as $match) { 3546 $match[1] = str_replace('<', '<', str_replace('>', '>', $match[1])); 3507 3547 $text = str_replace($match[0], _jsdoc_markup_code($match[1], $version), $text); 3508 3548 } … … 3701 3741 function theme_jsdoc_function_parameters($parameters) { 3702 3742 $output = '<div class="jsdoc_function_parameters">'; 3703 $output .= '<fieldset class="collapsible">';3743 $output .= '<fieldset>'; 3704 3744 $output .= '<legend>' . 'Parameters' . '</legend>'; 3705 3745 $output .= '<div class="fieldset-wrapper">'; … … 3776 3816 return $summary . $description; 3777 3817 } 3818 3819 function theme_jsdoc_object_example($example, $weight) { 3820 return '<div class="form-item"><label>Example #' . $weight . '</label>' . $example . '</div>'; 3821 } 3822 3823 function theme_jsdoc_object_examples($examples) { 3824 $output = '<div class="jsdoc_object_examples">'; 3825 $output .= '<fieldset>'; 3826 $output .= '<legend>Examples</legend>'; 3827 $output .= '<div class="fieldset-wrapper">'; 3828 $output .= implode('', $examples); 3829 $output .= '</div></fieldset></div>'; 3830 return $output; 3831 } -
util/trunk/docscripts/includes/dojo.inc
r12444 r12601 225 225 $object->setName($name); 226 226 $object->setAnonymous(true); 227 $object->addBlockCommentKeySet('example'); 227 228 $values = $object->getValues(); 228 229 foreach ($values as $key => $value) { … … 246 247 $keys = $object->getBlockCommentKeys(); 247 248 foreach ($keys as $key) { 248 if ($key == 'summary') { 249 if ($key == 'example') { 250 $output[$name]['examples'] = $object->getBlockComment('example'); 251 } 252 elseif ($key == 'summary') { 249 253 $output[$name]['summary'] = $object->getBlockComment('summary'); 250 254 } -
util/trunk/docscripts/lib/parser/DojoObject.php
r12450 r12601 48 48 return $this->body->addBlockCommentKey($key); 49 49 } 50 50 51 public function addBlockCommentKeySet($key){ 52 return $this->body->addBlockCOmmentKeySet($key); 53 } 54 51 55 public function build(){ 52 56 if(!$this->start){