summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/docs
diff options
context:
space:
mode:
authorrafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-12 21:41:15 +0000
committerrafaelw@chromium.org <rafaelw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-12 21:41:15 +0000
commitdb30527a4f5017945dca3db5cf6cb5e1d589387e (patch)
tree22a0c41d138300aa72a7d441620d6dad3eed0440 /chrome/common/extensions/docs
parent99432806a06b73301e4723de2d4b6b12aad63a21 (diff)
downloadchromium_src-db30527a4f5017945dca3db5cf6cb5e1d589387e.zip
chromium_src-db30527a4f5017945dca3db5cf6cb5e1d589387e.tar.gz
chromium_src-db30527a4f5017945dca3db5cf6cb5e1d589387e.tar.bz2
JsonSchema support for declaring "object" constructors.
This adds support for an optional declaration of "isInstanceOf" on "type":"object". If present, the candidate object will be tested for js:instanceof window[schema.isInstanceOf]. Several api functions are modified to take advantage of declaring their "class". Also, support added to docs for modules, methods & events to declare "nodocs":"true" to be excluded from the docs. Also, check to warn on an attempt to use cygwin python to generate docs. BUG=27213 TEST=NONE Review URL: http://codereview.chromium.org/389005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31834 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/docs')
-rwxr-xr-xchrome/common/extensions/docs/build/build.py10
-rwxr-xr-xchrome/common/extensions/docs/js/api_page_generator.js3
-rw-r--r--chrome/common/extensions/docs/template/api_template.html12
3 files changed, 19 insertions, 6 deletions
diff --git a/chrome/common/extensions/docs/build/build.py b/chrome/common/extensions/docs/build/build.py
index 8d55ab1..c44bf8a 100755
--- a/chrome/common/extensions/docs/build/build.py
+++ b/chrome/common/extensions/docs/build/build.py
@@ -141,8 +141,9 @@ def GetAPIModuleNames():
except ValueError, msg:
raise Exception("File %s has a syntax error: %s" %
(_extension_api_json, msg))
-
- return set(module['namespace'].encode() for module in extension_api)
+ # Exclude modules with a "nodoc" property.
+ return set(module['namespace'].encode() for module in extension_api
+ if "nodoc" not in module)
def GetStaticFileNames():
static_files = os.listdir(_static_dir)
@@ -151,6 +152,11 @@ def GetStaticFileNames():
if file.endswith(".html"))
def main():
+ # Prevent windows from using cygwin python.
+ if (sys.platform == "cygwin"):
+ raise Exception("Building docs not supported for cygwin python.\n"
+ "Please run the build.bat script.");
+
parser = OptionParser()
parser.add_option("--test-shell-path", dest="test_shell_path")
(options, args) = parser.parse_args()
diff --git a/chrome/common/extensions/docs/js/api_page_generator.js b/chrome/common/extensions/docs/js/api_page_generator.js
index dbd30dc..2e2a0af 100755
--- a/chrome/common/extensions/docs/js/api_page_generator.js
+++ b/chrome/common/extensions/docs/js/api_page_generator.js
@@ -366,6 +366,9 @@ function getTypeName(schema) {
if (schema.type == "array")
return "array of " + getTypeName(schema.items);
+ if (schema.isInstanceOf)
+ return schema.isInstanceOf;
+
return schema.type;
}
diff --git a/chrome/common/extensions/docs/template/api_template.html b/chrome/common/extensions/docs/template/api_template.html
index c5193ee..faac001 100644
--- a/chrome/common/extensions/docs/template/api_template.html
+++ b/chrome/common/extensions/docs/template/api_template.html
@@ -172,7 +172,8 @@
<li jsdisplay="functions && functions.length > 0">
<a href="#methods">Methods</a>
<ol>
- <li jsselect="functions.sort(sortByName)">
+ <li jsselect="functions.sort(sortByName)"
+ jsdisplay="!($this.nodoc)">
<a jscontent="name"
jsvalues=".href:'#method-' + name"
href="#method-anchor">methodName</a>
@@ -182,7 +183,8 @@
<li jsdisplay="events && events.length > 0">
<a href="#events">Events</a>
<ol>
- <li jsselect="events.sort(sortByName)">
+ <li jsselect="events.sort(sortByName)"
+ jsdisplay="!($this.nodoc)">
<a jscontent="name"
jsvalues=".href:'#event-' + name"
href="#event-anchor">eventName</a>
@@ -238,7 +240,8 @@
<h3>Methods</h3>
<!-- iterates over all functions -->
- <div class="apiItem" jsselect="functions.sort(sortByName)">
+ <div class="apiItem" jsselect="functions.sort(sortByName)"
+ jsdisplay="!($this.nodoc)">
<a jsvalues=".name:'method-' + name"></a> <!-- method-anchor -->
<h4 jscontent="name">method name</h4>
@@ -303,7 +306,8 @@
<h3 id="events">Events</h3>
<!-- iterates over all events -->
- <div jsselect="events.sort(sortByName)" class="apiItem">
+ <div jsselect="events.sort(sortByName)" class="apiItem"
+ jsdisplay="!($this.nodoc)">
<a jsvalues=".name:'event-' + name"></a>
<h4 jscontent="name">event name</h4>