Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Cleanup, better error handling for malformed comment block

  • Loading branch information...
commit c8757ed62671e00ee7a93dde628aaeda7da89136 1 parent b9ee1f4
Adam Moore authored
Showing with 4 additions and 75 deletions.
  1. +4 −47 bin/yuidoc_generate.py
  2. +0 −28 bin/yuidoc_parse.py
View
51 bin/yuidoc_generate.py
@@ -93,11 +93,7 @@ def cleanseStr(self, strg):
def write(self, filename, data):
out = open(os.path.join(self.outpath, filename), "w")
- # log.info(data);
- # out.writelines(unicode(data, errors='strict'))
- # out.writelines(unicode(data, 'utf-8', 'xmlcharrefreplace'))
out.writelines(str(data))
- # out.writelines(unicode(data))
out.close()
def process(self):
@@ -140,12 +136,6 @@ def transferToTemplate(prop, dict, template, valOverride=''):
val = ""
if prop in dict:
val = unicode(dict[prop])
- # val = str(dict[prop])
- # val = dict[prop]
- # if 'encode' in val:
- # log.info(val)
- # val.encode('ascii', 'xmlcharrefreplace')
- # log.info(val)
if valOverride:
val = valOverride
@@ -180,9 +170,6 @@ def shouldShowClass(item):
return False
def soft_sort(x, y):
- # pat = re.compile(r"[\_\-\.]")
- # return cmp(pat.sub('', x.lower()), pat.sub('', y.lower()))
- # pat = re.compile(r"[\_\-\.]")
return cmp(x.lower(), y.lower())
@@ -201,7 +188,6 @@ def getPropsFromSuperclass(superc, classes, dict):
elif const.PROTECTED in superprop: access = const.PROTECTED
else:access = ""
inhdef.append({const.NAME: prop, const.ACCESS: access, const.DEPRECATED: const.DEPRECATED in superprop})
- #inhdef.append(superprop)
if const.METHODS in superc:
inhdef = dict[const.METHODS][supercname] = []
keys = superc[const.METHODS].keys()
@@ -209,7 +195,6 @@ def getPropsFromSuperclass(superc, classes, dict):
for method in keys:
supermethod = superc[const.METHODS][method]
if shouldShow(supermethod):
- #inhdef.append(method)
if const.PRIVATE in supermethod: access = const.PRIVATE
elif const.PROTECTED in supermethod: access = const.PROTECTED
else:access = ""
@@ -309,12 +294,7 @@ def allprop_sort(x, y):
transferToTemplate(const.OPTIONAL, m, t)
transferToTemplate(const.BETA, m, t, "Beta")
- # if const.BETA in m:
- # t[const.BETA] = "Beta"
transferToTemplate(const.EXPERIMENTAL, m, t, "Experimental")
- # if const.EXPERIMENTAL in m:
- # t[const.EXPERIMENTAL] = "Experimental"
-
if len(m[const.SUBMODULES]) > 0:
strg = ', '.join(m[const.SUBMODULES])
@@ -654,33 +634,10 @@ def allprop_sort(x, y):
try:
pkgMap[i] = self.data[const.CLASS_MAP][i][const.MODULE]
except:
- log.warn('class map ' + i + ' failure (no module declaration?)')
-
- # log.info(" ")
- # log.info(unicode(keys))
- # log.info(" ")
- # for i in keys:
- # ns = i.split('.')
- # log.info("processing: " + unicode(ns))
- # cn = ns[len(ns) - 1]
- # log.info("target class: " + cn)
- # current = pkgMap
- # for j in ns:
- # if cn == j:
- # if j in current:
- # log.info("already defined: " + j)
- # else:
- # log.info("class: " + j + ", full class: " + i)
- # current[j] = self.data[const.CLASS_MAP][i]['module']
- # else:
- # if j not in current:
- # current[j] = {}
- # current = current[j]
-
- # # log.info(" ")
- # log.info(unicode(pkgMap))
- # classjson = "YAHOO.env.classMap = " + simplejson.dumps(pkgMap)
- # log.info(classjson)
+ try:
+ log.warn('class map ' + i + ' failure (no module declaration?)')
+ except: pass
+
t.pkgmap = simplejson.dumps(pkgMap)
self.write("classmap.js", t)
View
28 bin/yuidoc_parse.py
@@ -266,13 +266,6 @@ def isTag(token):
""" identify an attribute tag vs a description block """
return token.strip()[:1] == "@"
- # extracts compound comment blocks .. like {type}
- # def compound_sub(match):
- # if match.group(4):
- # return "", match.group(4) + match.group(5)
- # else:
- # return match.group(2), (match.group(1) + match.group(3)).strip()
-
def parseParams(tokenMap, dict, srctag=const.PARAM, desttag=const.PARAMS):
if srctag in tokenMap:
# params must be an array because they need to stay in order
@@ -391,9 +384,6 @@ def defineClass(name):
tokenMap[token] = []
- # if desc:
-# desc = unicode(desc, 'utf-8', 'xmlcharrefreplace')
-
tokenMap[token].append(desc)
# There are key pieces of info we need to have before we
@@ -434,15 +424,12 @@ def defineClass(name):
# outer class
if const.FOR in tokenMap:
name = tokenMap[const.FOR][0]
- #shortName, longName = self.getClassName(name, self.currentNamespace)
longName = name
currentFor = longName
if const.CLASS not in tokenMap:
if longName in self.data[const.CLASS_MAP]:
self.currentClass = longName
else:
- # msg = "@for tag references a class that has not been defined"
- # raise ValueError, unicode(tokens) + " " + msg
defineClass(name)
tokenMap.pop(const.FOR)
@@ -544,12 +531,6 @@ def parseModule(tokenMap):
if const.MODULE in tokenMap:
target, tokenMap = parseModule(tokenMap)
- # if not 'subModName' in self:
- # self.subModName = None
-
-
- # log.warn("Here");
-
if self.subModName:
self.data[const.MODULES][self.currentModule][const.SUBDATA][self.subModName][const.NAME] = longName
if const.DESCRIPTION in tokenMap:
@@ -625,7 +606,6 @@ def parseModule(tokenMap):
if not const.METHODS in c: c[const.METHODS] = {}
if method in c[const.METHODS]:
- # print "WARNING: %s - method %s was redefined (method overloading is not supported)" %(tokens, method)
log.warn("WARNING: method %s was redefined" %(method))
else:
c[const.METHODS][method] = parseParams(tokenMap, {})
@@ -646,7 +626,6 @@ def parseModule(tokenMap):
if not const.EVENTS in c: c[const.EVENTS] = {}
if event in c[const.EVENTS]:
- #print "WARNING: %s - event %s was redefined" %(tokens, event)
log.warn("WARNING: event %s was redefined" %(event))
else:
c[const.EVENTS][event] = parseParams(tokenMap, {})
@@ -667,7 +646,6 @@ def parseModule(tokenMap):
if not const.PROPERTIES in c: c[const.PROPERTIES] = {}
if property in c[const.PROPERTIES]:
- # print "WARNING: %s - Property %s was redefined" %(tokens, property)
log.warn("WARNING: Property %s was redefined" %(property))
else:
c[const.PROPERTIES][property] = {}
@@ -685,7 +663,6 @@ def parseModule(tokenMap):
c = self.data[const.CLASS_MAP][self.currentClass]
if const.ATTRIBUTE in tokenMap:
config = tokenMap[const.ATTRIBUTE][0]
- # config.hasEvents = True;
else:
config = tokenMap[const.CONFIG][0]
@@ -693,7 +670,6 @@ def parseModule(tokenMap):
if not const.CONFIGS in c: c[const.CONFIGS] = {}
if config in c[const.CONFIGS]:
- # print "WARNING: %s - Property %s was redefined" %(tokens, config)
log.warn("WARNING: Property %s was redefined" %(config))
else:
c[const.CONFIGS][config] = {}
@@ -702,7 +678,6 @@ def parseModule(tokenMap):
if const.ATTRIBUTE in tokenMap:
tokenMap.pop(const.ATTRIBUTE)
- # target[const.HASEVENTS] = True;
if not const.EVENTS in c: c[const.EVENTS] = {}
@@ -795,9 +770,6 @@ def get3xAttEvt(eventname, config):
for token in tokenMap:
if token not in target:
target[token] = tokenMap[token][0]
- else:
- msg = "WARNING no target, this block will be skipped"
- # print "\n" + self.currentFile + "\n" + msg + ":\n\n" + unicode(tokens) + "\n"
def main():
optparser = OptionParser("usage: %prog [options] inputdir1 inputdir2 etc")
Please sign in to comment.
Something went wrong with that request. Please try again.