Changeset 12641

Show
Ignore:
Timestamp:
02/22/08 20:20:19 (11 months ago)
Author:
pottedmeat
Message:

Refs #5602. Add camelcase wordsplitting support

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • util/branches/dev/jsdoc/jsdoc.module

    r12639 r12641  
    254254    $node = _jsdoc_node_load($node->nid); 
    255255 
    256     $text = '<h1>'. str_replace('.', ' ', $node->title) .'</h1>'. $node->title . ' ' . jsdoc_get_teaser($node) . ' ' . jsdoc_get_body($node); 
     256    $text = '<h1>'. implode(' ', _jsdoc_build_terms($node->title)) . '</h1> ' . jsdoc_get_teaser($node) . ' ' . jsdoc_get_body($node); 
    257257 
    258258    // Fetch extra data normally not visible 
     
    305305      } 
    306306 
    307       $find = do_search('(' . str_replace('.', ' ', $keys) . ') OR (' . $keys . ')', 'jsdoc_' . $version_title); 
     307      $find = do_search('(' . implode('), (', _jsdoc_build_terms($keys)) . ')', 'jsdoc_' . $version_title); 
    308308      $results = array(); 
    309309      foreach ($find as $item) { 
    310310        $node = _jsdoc_node_load($item->sid); 
    311311        if ($version && jsdoc_get_version($node)->nid != $version->nid) { 
     312          continue; 
     313        } 
     314        if (!$private && jsdoc_is_private($node)) { 
    312315          continue; 
    313316        } 
     
    14881491 
    14891492function jsdoc_is_private(&$node) { 
    1490   return $node->jsdoc_private || $node->jsdoc_private_parent; 
     1493  $query = db_query("SELECT jo.private, jo.private_parent FROM {jsdoc_objects} jo JOIN {node} n ON (n.vid = jo.vid) WHERE n.title = '%s' AND BINARY n.title = '%s' AND jo.version = %d GROUP BY jo.private, jo.private_parent", $node->title, $node->title, jsdoc_get_version($node)->nid); 
     1494  if (db_num_rows($query) == 1) { 
     1495    $result = db_fetch_object($query); 
     1496    return $result->private || $result->private_parent; 
     1497  } 
    14911498} 
    14921499 
     
    32803287} 
    32813288 
     3289function _jsdoc_build_terms($title) { 
     3290  $output = array($title, array()); 
     3291  $parts = explode('.', $title); 
     3292  foreach ($parts as $part) { 
     3293    if (preg_match('%^[_.$]*([a-zA-Z][a-z0-9_.$]*(?:[A-Z][a-z0-9_.$]*)+)%', $part, $match)) { 
     3294      if (preg_match_all('%(^[a-zA-Z][a-z0-9_.$]*|[A-Z][a-z0-9_.$]*)%', $match[1], $cased)) { 
     3295        $output[1] = array_merge($output[1], $cased[0]); 
     3296      } 
     3297    } 
     3298  } 
     3299  $output[1] = implode(' ', $output[1]); 
     3300  $output[2] = implode(' ', $parts); 
     3301  return $output; 
     3302} 
     3303 
    32823304function _jsdoc_build_taxonomy($names, $vid, $parent = false) 
    32833305{