Skip to content
This repository
Browse code

Updated setuptools, removed TODO, fixed errors created by high bit ch…

…aracters in descriptions.
  • Loading branch information...
commit aba7c2eb29b7aed37cafa1672019216c04c6621f 1 parent b3b2416
Adam Moore authored
4 INSTALL
@@ -17,8 +17,8 @@ Unix (including cygwin):
17 17
18 18 setuptools
19 19 cd ext
20   - tar xfvz setuptools-0.6c3.tar.gz
21   - cd setuptools-0.6c3
  20 + tar xfvz setuptools-0.6c9.tar.gz
  21 + cd setuptools-0.6c9
22 22 sudo python setup.py install
23 23
24 24 3. Install the dependencies
12 TODO
... ... @@ -1,12 +0,0 @@
1   -yuidoc TODO
2   -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3   -
4   - Consider changing the json output format to use all arrays instead of a mix
5   - of arrays and dictionaries. For instance, the list of params has to be an
6   - array to keep the order, whereas classes, properties and methods get sorted
7   - so it doesn't matter. Dictionaries are used when possible because of
8   - cross-referencing I needed during the parse, but this is no doubt more
9   - difficult to use than an all array format.
10   -
11   - Documentation
12   -
2  bin/yuidoc.py
... ... @@ -1,4 +1,6 @@
1 1 #!/usr/bin/env python
  2 +# -*- coding: utf-8 -*-
  3 +# vim: et sw=4 ts=4
2 4
3 5 import yuidoc_parse, yuidoc_highlight, yuidoc_generate
4 6
25 bin/yuidoc_generate.py
... ... @@ -1,4 +1,6 @@
1 1 #!/usr/bin/env python
  2 +# -*- coding: utf-8 -*-
  3 +# vim: et sw=4 ts=4
2 4 ''' Prints documentation with htmltmpl from the json data outputted by parser.py '''
3 5 import os, re, simplejson, shutil, logging, logging.config, time, datetime
4 6 import const
@@ -83,15 +85,19 @@ def _mkdir(newdir):
83 85 self.filenames = ""
84 86 self.allprops = []
85 87
86   - def cleanseStr(self, str):
  88 + def cleanseStr(self, strg):
87 89 cleanregex= re.compile(r"[^\w\-]")
88   - cleansed = cleanregex.sub('', str.lower())
  90 + cleansed = cleanregex.sub('', strg.lower())
89 91 # log.warn('cleansed module: %s' %(cleansed));
90 92 return self.moduleprefix + cleansed
91 93
92 94 def write(self, filename, data):
93 95 out = open(os.path.join(self.outpath, filename), "w")
94   - out.writelines(unicode(data))
  96 + # log.info(data);
  97 + # out.writelines(unicode(data, errors='strict'))
  98 + # out.writelines(unicode(data, 'utf-8', 'xmlcharrefreplace'))
  99 + out.writelines(str(data))
  100 + # out.writelines(unicode(data))
95 101 out.close()
96 102
97 103 def process(self):
@@ -134,6 +140,13 @@ def transferToTemplate(prop, dict, template, valOverride=''):
134 140 val = ""
135 141 if prop in dict:
136 142 val = unicode(dict[prop])
  143 + # val = str(dict[prop])
  144 + # val = dict[prop]
  145 + # if 'encode' in val:
  146 + # log.info(val)
  147 + # val.encode('ascii', 'xmlcharrefreplace')
  148 + # log.info(val)
  149 +
137 150 if valOverride:
138 151 val = valOverride
139 152
@@ -304,11 +317,11 @@ def allprop_sort(x, y):
304 317
305 318
306 319 if len(m[const.SUBMODULES]) > 0:
307   - str = ', '.join(m[const.SUBMODULES])
  320 + strg = ', '.join(m[const.SUBMODULES])
308 321 else:
309   - str = 'none'
  322 + strg = 'none'
310 323
311   - transferToTemplate(const.SUBMODULES, m, t, str)
  324 + transferToTemplate(const.SUBMODULES, m, t, strg)
312 325 t.submodules = m[const.SUBMODULES]
313 326
314 327 transferToTemplate(const.SUBDATA, m, t, '')
2  bin/yuidoc_highlight.py
... ... @@ -1,4 +1,6 @@
1 1 #!/usr/bin/env python
  2 +# -*- coding: utf-8 -*-
  3 +# vim: et sw=4 ts=4
2 4 import os, re, string, logging, logging.config
3 5 import const
4 6 from cStringIO import StringIO
32 bin/yuidoc_parse.py
... ... @@ -1,4 +1,6 @@
1 1 #!/usr/bin/env python
  2 +# -*- coding: utf-8 -*-
  3 +# vim: et sw=4 ts=4
2 4 ''' A class to parse Javadoc style comments out of javascript to document
3 5 an API. It is designed to parse one module at a time '''
4 6 import os, re, simplejson, string, sys, pprint, logging, logging.config
@@ -18,8 +20,6 @@ class DocParser(object):
18 20
19 21 def __init__(self, inputdirs, outputdir, outputfile, extension, version):
20 22
21   -
22   -
23 23 def _mkdir(newdir):
24 24 if os.path.isdir(newdir): pass
25 25 elif os.path.isfile(newdir):
@@ -285,9 +285,10 @@ def parseParams(tokenMap, dict, srctag=const.PARAM, desttag=const.PARAMS):
285 285
286 286 if match:
287 287 if match.group(4):
288   - type, description = "", match.group(4) + match.group(5)
  288 + type, description = "", unicode(match.group(4) + match.group(5), 'utf-8', 'xmlcharrefreplace')
289 289 else:
290   - type, description = match.group(2), (match.group(1) + match.group(3)).strip()
  290 + type, description = unicode(match.group(2), 'utf-8', 'xmlcharrefreplace'), unicode((match.group(1) + match.group(3)).strip(), 'utf-8', 'xmlcharrefreplace')
  291 +
291 292 else:
292 293 type, description = "", ""
293 294
@@ -296,10 +297,16 @@ def parseParams(tokenMap, dict, srctag=const.PARAM, desttag=const.PARAMS):
296 297 log.error("\nError, a parameter could not be parsed:\n\n %s\n\n %s\n" %(i, pprint.pformat(tokenMap)))
297 298 sys.exit()
298 299
  300 + # description.encode('utf-8', 'xmlcharrefreplace')
  301 + # description = unicode(description, 'utf-8', 'xmlcharrefreplace')
  302 +
  303 +
299 304 mo = self.param_pat.match(description)
300 305 if mo:
301 306 name = mo.group(1)
302 307 description = mo.group(2)
  308 + description.encode('utf-8', 'xmlcharrefreplace')
  309 +
303 310 dict[desttag].append({
304 311 const.NAME: name,
305 312 const.TYPE: type,
@@ -321,9 +328,9 @@ def parseReturn(tokenMap, dict):
321 328
322 329 if match:
323 330 if match.group(4):
324   - type, description = "", match.group(4) + match.group(5)
  331 + type, description = "", unicode(match.group(4) + match.group(5), 'utf-8', 'xmlcharrefreplace')
325 332 else:
326   - type, description = match.group(2), (match.group(1) + match.group(3)).strip()
  333 + type, description = unicode(match.group(2), 'utf-8', 'xmlcharrefreplace'), unicode((match.group(1) + match.group(3)).strip(), 'utf-8', 'xmlcharrefreplace')
327 334 else:
328 335 type, description = "", ""
329 336
@@ -376,11 +383,17 @@ def defineClass(name):
376 383 log.warn("\n" + self.currentFile + "\n" + msg + ":\n\n" + unicode(tokens) + "\n")
377 384
378 385
  386 +
  387 +
379 388 # keep a map of the different tags we have found, with an
380 389 # array to keep track of each occurrance
381 390 if token not in tokenMap:
382 391 tokenMap[token] = []
383 392
  393 +
  394 + # if desc:
  395 +# desc = unicode(desc, 'utf-8', 'xmlcharrefreplace')
  396 +
384 397 tokenMap[token].append(desc)
385 398
386 399 # There are key pieces of info we need to have before we
@@ -397,6 +410,9 @@ def defineClass(name):
397 410 # the first block without a description should be the description
398 411 # for the block
399 412 if token and const.DESCRIPTION not in tokenMap:
  413 +
  414 + token = unicode(token, 'utf-8', 'xmlcharrefreplace')
  415 + # token.encode('utf-8', 'xmlcharrefreplace')
400 416 tokenMap[const.DESCRIPTION] = [token]
401 417 else: pass # I don't think this can happen any longer
402 418
@@ -537,7 +553,9 @@ def parseModule(tokenMap):
537 553 if self.subModName:
538 554 self.data[const.MODULES][self.currentModule][const.SUBDATA][self.subModName][const.NAME] = longName
539 555 if const.DESCRIPTION in tokenMap:
540   - self.data[const.MODULES][self.currentModule][const.SUBDATA][self.subModName][const.DESCRIPTION] = tokenMap[const.DESCRIPTION][0]
  556 + d = tokenMap[const.DESCRIPTION][0]
  557 + d= unicode(d, 'utf-8', 'xmlcharrefreplace')
  558 + self.data[const.MODULES][self.currentModule][const.SUBDATA][self.subModName][const.DESCRIPTION] = d
541 559
542 560 if const.GLOBAL in tokenMap:
543 561 self.globals[longName] = True
BIN  ext/setuptools-0.6c3.tar.gz
Binary file not shown
BIN  ext/setuptools-0.6c9.tar.gz
Binary file not shown
3  template/main.tmpl
... ... @@ -1,3 +1,5 @@
  1 +#encoding UTF-8
  2 +#filter EncodeUnicode
1 3 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 4 <html xmlns:yui="http://yuilibrary.com/rdf/1.0/yui.rdf#">
3 5 <head>
@@ -680,3 +682,4 @@ src="http://track2.mybloglog.com/js/jsserv.php?mblID=2007020704011645"></script>
680 682 #end if
681 683 </body>
682 684 </html>
  685 +#end filter

0 comments on commit aba7c2e

Please sign in to comment.
Something went wrong with that request. Please try again.