/
yuidoc.py
executable file
·91 lines (82 loc) · 3.97 KB
/
yuidoc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: et sw=4 ts=4
import yuidoc_parse, yuidoc_highlight, yuidoc_generate
def main():
from optparse import OptionParser
optparser = OptionParser("usage: %prog inputdir [options] inputdir")
optparser.set_defaults(extension=".js",
newext=".highlighted",
parseroutdir="/tmp",
outputdir="docs",
parserfile="parsed.json",
showprivate=False,
project="Yahoo! UI Library",
version="",
projecturl="http://developer.yahoo.com/yui/",
ydn=False
)
optparser.add_option( "-p", "--parseroutdir",
action="store", dest="parseroutdir", type="string",
help="Directory to write the parser temp data" )
optparser.add_option( "-o", "--outputdir",
action="store", dest="outputdir", type="string",
help="Directory to write the html documentation" )
optparser.add_option( "-f", "--file",
action="store", dest="parserfile", type="string",
help="The name of the file that contains the JSON doc info" )
optparser.add_option( "-t", "--template",
action="store", dest="templatedir", type="string",
help="The directory containing the html tmplate" )
optparser.add_option( "-c", "--crosslink",
action="store", dest="crosslinkdir", type="string",
help="The directory containing json data for other modules to crosslink" )
optparser.add_option( "-s", "--showprivate",
action="store_true", dest="showprivate",
help="Should private properties/methods be in the docs?" )
optparser.add_option( "-e", "--extension",
action="store", dest="extension", type="string",
help="The extension to parse" )
optparser.add_option( "-n", "--newextension",
action="store", dest="newext", type="string",
help="The extension to append to the yuisyntax highlighted output file" )
optparser.add_option( "-m", "--project",
action="store", dest="project", type="string",
help="The name of the project" )
optparser.add_option( "-v", "--version",
action="store", dest="version", type="string",
help="The version of the project" )
optparser.add_option( "-u", "--projecturl",
action="store", dest="projecturl", type="string",
help="The project url" )
optparser.add_option( "-y", "--ydn",
action="store_true", dest="ydn",
help="Add YDN MyBlogLog intrumentation?" )
(opts, inputdirs) = optparser.parse_args()
if len(inputdirs) > 0:
docparser = yuidoc_parse.DocParser( inputdirs,
opts.parseroutdir,
opts.parserfile,
opts.extension,
opts.version
)
highlighter = yuidoc_highlight.DocHighlighter( [opts.parseroutdir],
opts.parseroutdir,
opts.extension,
opts.newext )
gen = yuidoc_generate.DocGenerator( opts.parseroutdir,
opts.parserfile,
opts.outputdir,
opts.templatedir,
opts.newext,
opts.showprivate,
opts.project,
opts.version,
opts.projecturl,
opts.ydn
)
gen.process()
else:
optparser.error("Incorrect number of arguments")
if __name__ == '__main__':
main()