Skip to content

Loading…

Add -N / --nocode to the command options. #2

Merged
merged 1 commit into from

2 participants

@codelulu

It means not to add any source file to the generated documents, just like jsdoc-toolkit does.

@davglass davglass merged commit 782bdc1 into yui:master
@davglass davglass added a commit to davglass/yuidoc that referenced this pull request
@davglass davglass Fixes #2 - Wrapped return tag descriptions properly 28e3f33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 41 additions and 20 deletions.
  1. +10 −4 bin/yuidoc.py
  2. +17 −9 bin/yuidoc_generate.py
  3. +11 −6 bin/yuidoc_parse.py
  4. +3 −1 template/main.tmpl
View
14 bin/yuidoc.py
@@ -25,7 +25,8 @@ def main():
copyrighttag="Yahoo! Inc.",
projecturl="http://developer.yahoo.com/yui/",
yuiversion=False,
- ydn=False
+ ydn=False,
+ nocode=False
)
optparser.add_option( "-p", "--parseroutdir",
action="store", dest="parseroutdir", type="string",
@@ -73,6 +74,10 @@ def main():
action="store_true", dest="ydn",
help="Add YDN MyBlogLog intrumentation?" )
+ optparser.add_option( "-N", "--nocode",
+ action="store_true", dest="nocode",
+ help="Without source code?" )
+
(opts, inputdirs) = optparser.parse_args()
if len(inputdirs) > 0:
@@ -81,8 +86,8 @@ def main():
opts.parserfile,
opts.extension,
opts.version,
- opts.yuiversion
- )
+ opts.yuiversion,
+ opts.nocode)
highlighter = yuidoc_highlight.DocHighlighter( [opts.parseroutdir],
opts.parseroutdir,
@@ -99,7 +104,8 @@ def main():
opts.version,
opts.projecturl,
opts.ydn,
- opts.copyrighttag
+ opts.copyrighttag,
+ opts.nocode
)
gen.process()
else:
View
26 bin/yuidoc_generate.py
@@ -38,7 +38,8 @@ def __init__(self, inpath, datafile, outpath, templatepath, newext, showprivate=
projectname='Yahoo! UI Library',
version='',
projecturl='http://developer.yahoo.com/yui/',
- ydn=False, copyrighttag='Yahoo! Inc.'):
+ ydn=False, copyrighttag='Yahoo! Inc.',
+ nocode=False):
def _mkdir(newdir):
if os.path.isdir(newdir): pass
@@ -87,6 +88,7 @@ def _mkdir(newdir):
self.projecturl = projecturl
self.copyrighttag = copyrighttag
self.ydn = ydn
+ self.nocode = nocode
self.version = version
self.modulename = ""
self.timestamp = "" # if supplied, linked script and css will have a timestamp appended to the url for cache busting
@@ -137,6 +139,7 @@ def assignGlobalProperties(template):
template.projecturl = self.projecturl
template.copyrighttag = self.copyrighttag
template.ydn = self.ydn
+ template.nocode = self.nocode
template.version = self.version
template.modules = self.modules
template.modulenames = self.modulenames
@@ -669,11 +672,12 @@ def completeProp(main, ext):
self.write( t.cleansedmodulename + ".html", t)
# class source view
- for i in m[FILE_LIST]:
- log.info("Generating source view for " + i)
- self.filename = i
- assignGlobalProperties(t)
- self.write("%s.html" %(self.filename), t)
+ if not self.nocode:
+ for i in m[FILE_LIST]:
+ log.info("Generating source view for " + i)
+ self.filename = i
+ assignGlobalProperties(t)
+ self.write("%s.html" %(self.filename), t)
#remove dups
@@ -753,7 +757,8 @@ def main():
newext=".highlighted",
showprivate=False,
project="Yahoo! UI Library",
- version=""
+ version="",
+ nocode=False
)
optparser.add_option( "-o", "--outputdir",
action="store", dest="outputdir", type="string",
@@ -789,7 +794,9 @@ def main():
optparser.add_option( "-y", "--ydn",
action="store_true", dest="ydn",
help="Add YDN MyBlogLog intrumentation?" )
-
+ optparser.add_option( "-N", "--nocode",
+ action="store_true", dest="nocode",
+ help="Without source code?" )
(options, inputdirs) = optparser.parse_args()
@@ -803,7 +810,8 @@ def main():
options.version,
options.projecturl,
options.ydn,
- options.copyrighttag
+ options.copyrighttag,
+ options.nocode
)
generator.process()
else:
View
17 bin/yuidoc_parse.py
@@ -34,8 +34,8 @@
class DocParser(object):
- def __init__(self, inputdirs, outputdir, outputfile, extension, version, yuiversion):
-
+ def __init__(self, inputdirs, outputdir, outputfile, extension, version, yuiversion, nocode):
+
def _mkdir(newdir):
if os.path.isdir(newdir): pass
elif os.path.isfile(newdir):
@@ -54,10 +54,11 @@ def parseFile(path, file):
content = "\n/** @%s %s \n*/\n" % (FILE_MARKER, file)
# copy
- # out = open(os.path.join(self.outputdir, file), "w")
- out = codecs.open( os.path.join(self.outputdir, file), "w", "utf-8" )
- out.writelines(fileStr)
- out.close()
+ if not self.nocode:
+ # out = open(os.path.join(self.outputdir, file), "w")
+ out = codecs.open( os.path.join(self.outputdir, file), "w", "utf-8" )
+ out.writelines(fileStr)
+ out.close()
return content + fileStr
@@ -129,6 +130,7 @@ def parseDir(path):
self.deferredModuleFiles=[]
self.globals={}
self.currentGlobal=""
+ self.nocode = nocode
log.info("-------------------------------------------------------")
@@ -851,6 +853,9 @@ def main():
optparser.add_option( "-v", "--version",
action="store", dest="version", type="string",
help="The version of the project" )
+ optparser.add_option( "-N", "--nocode",
+ action="store_true", dest="nocode",
+ help="Without source code?" )
(opts, inputdirs) = optparser.parse_args()
if len(inputdirs) > 0:
docparser = DocParser( inputdirs,
View
4 template/main.tmpl
@@ -607,7 +607,9 @@
</div>
#end if
- #if $filenames
+ #if $nocode
+
+ #else if $filenames
<div id="fileList" class="module">
<h4>Files</h4>
<ul class="content">
Something went wrong with that request. Please try again.