Permalink
Browse files

Removed the simplejson requirement when native support is available

(Python 2.6.0+).
  • Loading branch information...
1 parent 1c76ee6 commit c7395c63e487c9e3d61dac256d186ef825d763d4 Adam Moore committed Mar 31, 2010
Showing with 50 additions and 25 deletions.
  1. +2 −0 INSTALL
  2. +1 −1 README
  3. +10 −3 bin/yuidoc_generate.py
  4. +10 −11 bin/yuidoc_parse.py
  5. +27 −10 test/intl/intl.js
View
@@ -33,6 +33,8 @@ Unix (including cygwin):
easy_install pygments
easy_install Cheetah
+
+ * For Python version below 2.6.0, also install simplejson *
easy_install simplejson
View
@@ -5,7 +5,7 @@ in the YUI library. The docs are derived completely from JavaDoc style
comment blocks; no attempt is made to understand the javascript itself.
yuidoc requires Python 2.3+ with the following extensions:
- simplejson - for reading and writing json
+ simplejson - for reading and writing json (required for Python versions below 2.6.0)
cheetah - for generating the html docs
pygments - for colorizing the source
@@ -10,7 +10,14 @@
'''
''' Prints documentation with htmltmpl from the json data outputted by parser.py '''
-import os, re, simplejson, shutil, logging, logging.config, time, datetime
+
+try:
+ import json as simplejson
+except:
+ import simplejson
+
+import os, re, shutil, logging, logging.config, time, datetime
+
from const import *
# from cStringIO import StringIO
from Cheetah.Template import Template
@@ -672,8 +679,8 @@ def completeProp(main, ext):
#remove dups
allprops = []
propmap = {}
- # for i in self.allprops:
- for i in self.allprops_ext:
+ for i in self.allprops:
+ # for i in self.allprops_ext:
url = i[URL]
if url not in propmap:
allprops.append(i)
View
@@ -11,7 +11,14 @@
''' 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
+
+
+try:
+ import json as simplejson
+except:
+ import simplejson
+
+import os, re, string, sys, pprint, logging, logging.config
from const import *
# from cStringIO import StringIO
from optparse import OptionParser
@@ -40,13 +47,7 @@ def _mkdir(newdir):
if tail: os.mkdir(newdir)
def parseFile(path, file):
- # f=open(os.path.join(path, file))
f = codecs.open(os.path.join(path, file), "r", "utf-8" )
- #adding a return to the beginning of the line allows for:
- # #!/usr/bin/foo
- # MOVED to the file marker
- # fileStr = StringIO("\n%s" % f.read()).getvalue()
- # fileStr = StringIO("%s" % f.read()).getvalue()
fileStr = f.read()
log.info("parsing " + file)
# add a file marker token so the parser can keep track of what is in what file
@@ -163,12 +164,10 @@ def getClassName(self, classString, namespace):
longName = namespace + "." + shortName
return shortName, longName
- # extract string literals in case they contain the documentation pattern
+ # extract string literals in case they contain the doc comment pattern
literals_pat = re.compile(r'(\'.*?(?<=[^\\])\')|(\".*?(?<=[^\\])\")')
- # extract regex literals in case they contain
- #regex_pat = re.compile(r'(\/.*?(?<=[^\\])\/)')
- #regex_pat = re.compile(r'(\/[^\s\/\*][^\n]*?(?<=[^\\])\/)')
+ # extract regex literals in case they contain the doc comment pattern
regex_pat = re.compile(r'(\/[^\s\/\*][^\n]*\/)')
# the token we will use to restore the string literals
View
@@ -4,30 +4,47 @@
* <ul>
* <li><em>Languages:</em> RFC 4646 language tags, such as "en-GB" (English as used
* in the United Kingdom), "zh-Hans-CN" (simpified Chinese as used in China).
+ * </em></li>
* <li><em>Time zones:</em> tz database identifiers, such as "Europe/Berlin"
* (time zone of Germany), "America/Los_Angeles" (Pacific time zone in the United States),
* "Asia/Kolkata" (time zone of India).
+ * </em></li>
* </ul>
+ * </p>
* @module text
- * @requires yahoo, json
*/
/**
* Provides functionality for formatting date and time information.
* @class DateFormat
- * @namespace YAHOO.text
* @constructor
* @param {Style | Style[] | String} style Style constant or pattern string for the desired date format.
* @param {String} language The RFC 4646 language tag for the language of the date format.
* @param {String} timeZone <b>future</b> The tz database identifier for the time zone of the date format.
* Optional - the browser time zone is used by default.
*/
- /**
- * <b>future</b> Calendar month format. Examples:
- * <ul>
- * <li>June 2009
- * <li>2009年6月
- * </ul>
- * @property CALENDAR_MONTH
- */
+/**
+ * <b>future</b> Calendar month format. Examples:
+ * <ul>
+ * <li>June 2009
+ * <li>2009年6月
+ * </ul>
+ * @property CALENDAR_MONTH
+ */
+
+/**
+ * subclass method
+ * @method subclassmethod
+ */
+
+/**
+ * DateFormat subclass
+ * @class DateFormatSubclass
+ * @extends DateFormat
+ */
+
+/**
+ * subclass method
+ * @method subclassmethod
+ */

0 comments on commit c7395c6

Please sign in to comment.