summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/docs
diff options
context:
space:
mode:
authorcduvall@chromium.org <cduvall@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-02 16:09:16 +0000
committercduvall@chromium.org <cduvall@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-02 16:09:16 +0000
commitf656805bcc1e3996d3f6fccaa385ea2438d70003 (patch)
tree1eed90b43d01b712368ef3ff79f4d329fedd2c65 /chrome/common/extensions/docs
parent9cfbf66521b2c1151d660a5b82f5183204663e5e (diff)
downloadchromium_src-f656805bcc1e3996d3f6fccaa385ea2438d70003.zip
chromium_src-f656805bcc1e3996d3f6fccaa385ea2438d70003.tar.gz
chromium_src-f656805bcc1e3996d3f6fccaa385ea2438d70003.tar.bz2
Allow comments in extension config files.
Added a script to remove comments from the extension api JSON files before processing for the extension docs. We will now be able to comment in the JSON files, and they should be much easier to read. Also added the license header to all the JSON files. BUG=114233 TEST=Put comments in one of the JSON files and remake the docs. They will make with no problems. Review URL: http://codereview.chromium.org/9447090 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124660 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/docs')
-rw-r--r--chrome/common/extensions/docs/build/directory.py4
-rw-r--r--chrome/common/extensions/docs/js/api_page_generator.js4
-rw-r--r--chrome/common/extensions/docs/template/page_shell.html3
3 files changed, 8 insertions, 3 deletions
diff --git a/chrome/common/extensions/docs/build/directory.py b/chrome/common/extensions/docs/build/directory.py
index 316e0d6..6f49bcf 100644
--- a/chrome/common/extensions/docs/build/directory.py
+++ b/chrome/common/extensions/docs/build/directory.py
@@ -12,6 +12,7 @@ import re
import hashlib
import zipfile
import simplejson as json
+import json_minify as minify
# Make sure we get consistent string sorting behavior by explicitly using the
# default C locale.
@@ -48,7 +49,8 @@ def parse_json_file(path, encoding="utf-8"):
raise Exception("Failed to read the file at %s: %s" % (path, msg))
try:
- json_obj = json.load(json_file, encoding)
+ json_str = json_file.read()
+ json_obj = json.loads(minify.json_minify(json_str), encoding)
except ValueError, msg:
raise Exception("Failed to parse JSON out of file %s: %s" % (path, msg))
finally:
diff --git a/chrome/common/extensions/docs/js/api_page_generator.js b/chrome/common/extensions/docs/js/api_page_generator.js
index 202854e..944a54b 100644
--- a/chrome/common/extensions/docs/js/api_page_generator.js
+++ b/chrome/common/extensions/docs/js/api_page_generator.js
@@ -183,7 +183,7 @@ function fetchSchema() {
schema = [];
function onSchemaContent(content) {
- schema = schema.concat(JSON.parse(content));
+ schema = schema.concat(JSON.parse(JSON.minify(content)));
if (++schemas_retrieved < schemas_to_retrieve.length)
return;
if (pageName.toLowerCase() == 'samples') {
@@ -204,7 +204,7 @@ function fetchSchema() {
function fetchSamples() {
// If we're rendering the samples directory, fetch the samples manifest.
fetchContent(SAMPLES, function(sampleManifest) {
- var data = JSON.parse(sampleManifest);
+ var data = JSON.parse(JSON.minify(sampleManifest));
samples = data.samples;
apiMapping = data.api;
renderTemplate();
diff --git a/chrome/common/extensions/docs/template/page_shell.html b/chrome/common/extensions/docs/template/page_shell.html
index fdca7c6..2aaf387 100644
--- a/chrome/common/extensions/docs/template/page_shell.html
+++ b/chrome/common/extensions/docs/template/page_shell.html
@@ -17,6 +17,9 @@
<script type="text/javascript"
src="../../../third_party/jstemplate/jstemplate_compiled.js">
</script>
+ <script type="text/javascript"
+ src="../../../../third_party/json_minify/minify-sans-regexp.js">
+ </script>
<script type="text/javascript" src="js/api_page_generator.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script type="text/javascript" src="js/sidebar.js"></script>