Permalink
Browse files

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

…aracters in descriptions.
  • Loading branch information...
1 parent b3b2416 commit aba7c2eb29b7aed37cafa1672019216c04c6621f Adam Moore committed Dec 5, 2008
View
@@ -17,8 +17,8 @@ Unix (including cygwin):
setuptools
cd ext
- tar xfvz setuptools-0.6c3.tar.gz
- cd setuptools-0.6c3
+ tar xfvz setuptools-0.6c9.tar.gz
+ cd setuptools-0.6c9
sudo python setup.py install
3. Install the dependencies
View
12 TODO
@@ -1,12 +0,0 @@
-yuidoc TODO
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- Consider changing the json output format to use all arrays instead of a mix
- of arrays and dictionaries. For instance, the list of params has to be an
- array to keep the order, whereas classes, properties and methods get sorted
- so it doesn't matter. Dictionaries are used when possible because of
- cross-referencing I needed during the parse, but this is no doubt more
- difficult to use than an all array format.
-
- Documentation
-
View
@@ -1,4 +1,6 @@
#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# vim: et sw=4 ts=4
import yuidoc_parse, yuidoc_highlight, yuidoc_generate
View
@@ -1,4 +1,6 @@
#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# vim: et sw=4 ts=4
''' Prints documentation with htmltmpl from the json data outputted by parser.py '''
import os, re, simplejson, shutil, logging, logging.config, time, datetime
import const
@@ -83,15 +85,19 @@ def _mkdir(newdir):
self.filenames = ""
self.allprops = []
- def cleanseStr(self, str):
+ def cleanseStr(self, strg):
cleanregex= re.compile(r"[^\w\-]")
- cleansed = cleanregex.sub('', str.lower())
+ cleansed = cleanregex.sub('', strg.lower())
# log.warn('cleansed module: %s' %(cleansed));
return self.moduleprefix + cleansed
def write(self, filename, data):
out = open(os.path.join(self.outpath, filename), "w")
- out.writelines(unicode(data))
+ # 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):
@@ -134,6 +140,13 @@ 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
@@ -304,11 +317,11 @@ def allprop_sort(x, y):
if len(m[const.SUBMODULES]) > 0:
- str = ', '.join(m[const.SUBMODULES])
+ strg = ', '.join(m[const.SUBMODULES])
else:
- str = 'none'
+ strg = 'none'
- transferToTemplate(const.SUBMODULES, m, t, str)
+ transferToTemplate(const.SUBMODULES, m, t, strg)
t.submodules = m[const.SUBMODULES]
transferToTemplate(const.SUBDATA, m, t, '')
View
@@ -1,4 +1,6 @@
#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# vim: et sw=4 ts=4
import os, re, string, logging, logging.config
import const
from cStringIO import StringIO
View
@@ -1,4 +1,6 @@
#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+# vim: et sw=4 ts=4
''' A class to parse Javadoc style comments out of javascript to document
an API. It is designed to parse one module at a time '''
import os, re, simplejson, string, sys, pprint, logging, logging.config
@@ -18,8 +20,6 @@ class DocParser(object):
def __init__(self, inputdirs, outputdir, outputfile, extension, version):
-
-
def _mkdir(newdir):
if os.path.isdir(newdir): pass
elif os.path.isfile(newdir):
@@ -285,9 +285,10 @@ def parseParams(tokenMap, dict, srctag=const.PARAM, desttag=const.PARAMS):
if match:
if match.group(4):
- type, description = "", match.group(4) + match.group(5)
+ type, description = "", unicode(match.group(4) + match.group(5), 'utf-8', 'xmlcharrefreplace')
else:
- type, description = match.group(2), (match.group(1) + match.group(3)).strip()
+ type, description = unicode(match.group(2), 'utf-8', 'xmlcharrefreplace'), unicode((match.group(1) + match.group(3)).strip(), 'utf-8', 'xmlcharrefreplace')
+
else:
type, description = "", ""
@@ -296,10 +297,16 @@ def parseParams(tokenMap, dict, srctag=const.PARAM, desttag=const.PARAMS):
log.error("\nError, a parameter could not be parsed:\n\n %s\n\n %s\n" %(i, pprint.pformat(tokenMap)))
sys.exit()
+ # description.encode('utf-8', 'xmlcharrefreplace')
+ # description = unicode(description, 'utf-8', 'xmlcharrefreplace')
+
+
mo = self.param_pat.match(description)
if mo:
name = mo.group(1)
description = mo.group(2)
+ description.encode('utf-8', 'xmlcharrefreplace')
+
dict[desttag].append({
const.NAME: name,
const.TYPE: type,
@@ -321,9 +328,9 @@ def parseReturn(tokenMap, dict):
if match:
if match.group(4):
- type, description = "", match.group(4) + match.group(5)
+ type, description = "", unicode(match.group(4) + match.group(5), 'utf-8', 'xmlcharrefreplace')
else:
- type, description = match.group(2), (match.group(1) + match.group(3)).strip()
+ type, description = unicode(match.group(2), 'utf-8', 'xmlcharrefreplace'), unicode((match.group(1) + match.group(3)).strip(), 'utf-8', 'xmlcharrefreplace')
else:
type, description = "", ""
@@ -376,11 +383,17 @@ def defineClass(name):
log.warn("\n" + self.currentFile + "\n" + msg + ":\n\n" + unicode(tokens) + "\n")
+
+
# keep a map of the different tags we have found, with an
# array to keep track of each occurrance
if token not in tokenMap:
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
@@ -397,6 +410,9 @@ def defineClass(name):
# the first block without a description should be the description
# for the block
if token and const.DESCRIPTION not in tokenMap:
+
+ token = unicode(token, 'utf-8', 'xmlcharrefreplace')
+ # token.encode('utf-8', 'xmlcharrefreplace')
tokenMap[const.DESCRIPTION] = [token]
else: pass # I don't think this can happen any longer
@@ -537,7 +553,9 @@ def parseModule(tokenMap):
if self.subModName:
self.data[const.MODULES][self.currentModule][const.SUBDATA][self.subModName][const.NAME] = longName
if const.DESCRIPTION in tokenMap:
- self.data[const.MODULES][self.currentModule][const.SUBDATA][self.subModName][const.DESCRIPTION] = tokenMap[const.DESCRIPTION][0]
+ d = tokenMap[const.DESCRIPTION][0]
+ d= unicode(d, 'utf-8', 'xmlcharrefreplace')
+ self.data[const.MODULES][self.currentModule][const.SUBDATA][self.subModName][const.DESCRIPTION] = d
if const.GLOBAL in tokenMap:
self.globals[longName] = True
View
Binary file not shown.
View
Binary file not shown.
View
@@ -1,3 +1,5 @@
+#encoding UTF-8
+#filter EncodeUnicode
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html xmlns:yui="http://yuilibrary.com/rdf/1.0/yui.rdf#">
<head>
@@ -680,3 +682,4 @@ src="http://track2.mybloglog.com/js/jsserv.php?mblID=2007020704011645"></script>
#end if
</body>
</html>
+#end filter

0 comments on commit aba7c2e

Please sign in to comment.