Skip to content

Commit

Permalink
2009 -> 2010
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Moore committed Jan 6, 2010
1 parent 99e77a8 commit cf62eeb
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 26 deletions.
2 changes: 1 addition & 1 deletion bin/const.py
@@ -1,5 +1,5 @@
'''
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.html
version: 1.0.0b1
Expand Down
2 changes: 1 addition & 1 deletion bin/yuidoc.py
Expand Up @@ -3,7 +3,7 @@
# vim: et sw=4 ts=4

'''
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.html
version: 1.0.0b1
Expand Down
63 changes: 56 additions & 7 deletions bin/yuidoc_generate.py
Expand Up @@ -3,7 +3,7 @@
# vim: et sw=4 ts=4

'''
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.html
version: 1.0.0b1
Expand Down Expand Up @@ -103,6 +103,8 @@ def _mkdir(newdir):
self.classnames = ""
self.filenames = ""
self.allprops = []
self.allprops_ext = []


def cleanseStr(self, strg):
cleanregex= re.compile(r"[^\w\-]")
Expand Down Expand Up @@ -274,6 +276,31 @@ def allprop_sort(x, y):
cy = pat.sub('', cy)
return cmp(cx, cy)

def completeProp(main, ext):
data = main.copy()
if DESCRIPTION in ext:
data[DESCRIPTION] = ext[DESCRIPTION]
else:
data[DESCRIPTION] = ''

if PARAMS in ext:
params = ext[PARAMS]
count = 0
result = []
itemtemplate = '%s <%s> %s'
for p in params:
if count > 0:
result.append(', ')
result.append(itemtemplate % (p[NAME] or 'unknown', p[TYPE] or 'Object', p[DESCRIPTION] or ''))
count+=1

data[PARAMS] = ''.join(result)
else:
data[PARAMS] = ''

return data


log.info("-------------------------------------------------------")

# copy the json file
Expand Down Expand Up @@ -391,14 +418,21 @@ def allprop_sort(x, y):
for propertykey in keys:
prop = c[PROPERTIES][propertykey]
if self.showprivate or PRIVATE not in prop:
propdata = {NAME: propertykey, HOST: i, TYPE: 'property', URL:getUrl(i, propertykey, PROPERTY)}

propdata = {
NAME: propertykey,
HOST: i,
TYPE: 'property',
URL: getUrl(i, propertykey, PROPERTY)
}

transferToDict( ACCESS, prop, propdata )
if PRIVATE in prop: propdata[ACCESS] = PRIVATE
elif PROTECTED in prop: propdata[ACCESS] = PROTECTED

self.allprops.append(propdata.copy())
# completeProp(propdata, prop)
self.allprops_ext.append(completeProp(propdata, prop))

moduleprops.append(propdata.copy())

transferToDict( TYPE, prop, propdata, OBJECT )
Expand Down Expand Up @@ -428,6 +462,8 @@ def allprop_sort(x, y):
elif PROTECTED in method: methoddata[ACCESS] = PROTECTED

self.allprops.append(methoddata.copy())
# completeProp(methodData, method)
self.allprops_ext.append(completeProp(methoddata, method))
moduleprops.append(methoddata.copy())

transferToDict( DESCRIPTION, method, methoddata )
Expand Down Expand Up @@ -466,13 +502,21 @@ def allprop_sort(x, y):
for eventkey in keys:
event = c[EVENTS][eventkey]
if self.showprivate or PRIVATE not in event:
eventdata = {NAME: eventkey, HOST: i, TYPE: 'event', URL:getUrl(i, eventkey, EVENT)}
eventdata = {
NAME: eventkey,
HOST: i,
TYPE: 'event',
URL: getUrl(i, eventkey, EVENT)
}

transferToDict( ACCESS, event, eventdata )
if PRIVATE in event: eventdata[ACCESS] = PRIVATE
elif PROTECTED in event: eventdata[ACCESS] = PROTECTED

self.allprops.append(eventdata.copy())
# completeProp(eventdata, event)
self.allprops_ext.append(completeProp(eventdata, event))

moduleprops.append(eventdata.copy())

transferToDict( DESCRIPTION, event, eventdata )
Expand All @@ -495,8 +539,6 @@ def allprop_sort(x, y):
transferToDict( CANCELABLE, event, eventdata )
if CANCELABLE in event: eventdata[CANCELABLE] = CANCELABLE



params = eventdata[PARAMS] = []
if PARAMS in event:
mp = event[PARAMS]
Expand Down Expand Up @@ -524,6 +566,10 @@ def allprop_sort(x, y):
elif PROTECTED in config: configdata[ACCESS] = PROTECTED

self.allprops.append(configdata.copy())

# completeProp(configdata, config)
self.allprops_ext.append(completeProp(configdata, config))

moduleprops.append(configdata.copy())

transferToDict( TYPE, config, configdata, OBJECT )
Expand Down Expand Up @@ -626,13 +672,16 @@ def allprop_sort(x, y):
#remove dups
allprops = []
propmap = {}
for i in self.allprops:
# for i in self.allprops:
for i in self.allprops_ext:
url = i[URL]
if url not in propmap:
allprops.append(i)
propmap[url] = True

allprops.sort(allprop_sort)

# self.allprops_ext.sort(allprop_sort)

allprops_json = simplejson.dumps(allprops, ensure_ascii=False)
self.write("index.json", allprops_json, False)
Expand Down
2 changes: 1 addition & 1 deletion bin/yuidoc_highlight.py
Expand Up @@ -3,7 +3,7 @@
# vim: et sw=4 ts=4

'''
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.html
version: 1.0.0b1
Expand Down
2 changes: 1 addition & 1 deletion bin/yuidoc_parse.py
Expand Up @@ -3,7 +3,7 @@
# vim: et sw=4 ts=4

'''
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.html
version: 1.0.0b1
Expand Down
2 changes: 1 addition & 1 deletion license.txt
@@ -1,4 +1,4 @@
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:

Redistribution and use of this software in source and binary forms, with or
Expand Down
34 changes: 21 additions & 13 deletions template/assets/ac-js
Expand Up @@ -12,13 +12,22 @@
ITEM_TEMPLATE = '<em>{host}</em> <span>{name}</span>',
// ITEM_TEMPLATE = '<em>{host}</em> <span>{params}</span> <span>{name}</span>',
// ITEM_TEMPLATE = '<em>{host}</em> <span>{params}</span> <span>{name}</span><div>{description}</div>',
yuidoc = YAHOO.namespace('yuidoc');

yuidoc.init = function() {
yuidoc = YAHOO.namespace('yuidoc'),
propdata,
initialized = false;

yuidoc.init = function(altdata) {
yuidoc.initUI(altdata);
};

yuidoc.initUI = function() {
yuidoc.initUI = function(altdata) {

if (initialized) {
return;
}

propdata = ALL_YUI_PROPS || altdata;

//Checkboxes are available..
var handleClick = function(e) {
var id, checked = false;
Expand Down Expand Up @@ -75,14 +84,10 @@ yuidoc.initUI = function() {
//Starting the AutoComplete code
var getResults = function(query) {
var results = [];
if(query && query.length > 0) {

if (query && query.length > 0) {
var q = query.toLowerCase();

for (var i=0, len=ALL_YUI_PROPS.length; i<len; ++i) {

var prop = ALL_YUI_PROPS[i];

for (var i=0, len=propdata.length; i<len; ++i) {
var prop = propdata[i];
if (!show['protected'] && prop.access == "protected") {
// skip
} else if (!show['private'] && prop.access == "private") {
Expand Down Expand Up @@ -156,15 +161,18 @@ yuidoc.initUI = function() {
YAHOO.util.Event.onAvailable('classTab', function() {
var tabs = new YAHOO.widget.TabView('classTab');
});

/*
YAHOO.util.Event.onAvailable('codeTree', function() {
var tree1 = new YAHOO.widget.TreeView('codeTree');
tree1.render();
});
*/

YAHOO.util.Event.onAvailable('show_private', function() {
YAHOO.yuidoc.initUI();
YAHOO.util.Event.onDOMReady(function() {
if (typeof ALL_YUI_PROPS != "undefined") {
YAHOO.yuidoc.initUI();
});
});

})();
5 changes: 4 additions & 1 deletion template/main.tmpl
Expand Up @@ -675,8 +675,11 @@
</div>
</div>
<script type="text/javascript">
#if $indexasdfsdfa
YAHOO.yuidoc.init();
#end if

var ALL_YUI_PROPS = $allprops;
YAHOO.yuidoc.init();
</script>
#if $ydn
<!-- Yahoo! Web Analytics - All rights reserved -->
Expand Down

0 comments on commit cf62eeb

Please sign in to comment.