Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(672)

Unified Diff: utils/apidoc/apidoc.dart

Issue 9844031: add disqus comments (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: utils/apidoc/apidoc.dart
diff --git a/utils/apidoc/apidoc.dart b/utils/apidoc/apidoc.dart
index 8fff77ada207455663283f3729b1d9f8b648895c..88d2a843c5263ee8a2d39513c100c2d5a417a543 100644
--- a/utils/apidoc/apidoc.dart
+++ b/utils/apidoc/apidoc.dart
@@ -28,9 +28,11 @@ final GET_PREFIX = 'get:';
void main() {
final args = new Options().arguments;
+ int mode = doc.Dartdoc.MODE_STATIC;
var outputDir = 'docs';
// Use the output directory if provided.
+/*
if (args.length > 1) {
print('Usage: apidoc [--out=<output directory>]');
return;
@@ -43,16 +45,44 @@ void main() {
return;
}
}
+ */
+
+ for (int i = 0; i < args.length - 1; i++) {
+ final arg = args[i];
+
+ switch (arg) {
+ case '--mode=static':
+ mode = doc.Dartdoc.MODE_STATIC;
+ break;
+
+ case '--mode=live-nav':
+ mode = doc.Dartdoc.MODE_LIVE_NAV;
+ break;
+
+ default:
+ if (arg.startsWith('--out=')) {
+ outputDir = arg.substring('--out='.length);
+ } else {
+ print('Unknown option: $arg');
+ return;
+ }
+ break;
+ }
+ }
final frogPath = joinPaths(doc.scriptDir, '../../frog/');
+ final compilerPath = joinPaths(frogPath, 'minfrog');
+ final libDir = joinPaths(frogPath, 'lib');
doc.cleanOutputDirectory(outputDir);
// Compile the client-side code to JS.
// TODO(bob): Right path.
- doc.compileScript(frogPath,
- '${doc.scriptDir}/../../lib/dartdoc/client-live-nav.dart',
- '${outputDir}/client-live-nav.js');
+
+ final clientScript = (mode == doc.Dartdoc.MODE_STATIC) ? 'static' : 'live-nav';
Bob Nystrom 2012/03/28 20:01:21 Long line.
sethladd 2012/03/28 21:52:17 Done.
+ doc.compileScript(compilerPath, libDir,
+ '${doc.scriptDir}/../../lib/dartdoc/client-$clientScript.dart',
+ '${outputDir}/client-$clientScript.js');
// TODO(rnystrom): Use platform-specific path separator.
// The basic dartdoc-provided static content.
@@ -88,6 +118,7 @@ void main() {
print('Generating docs...');
final apidoc = new Apidoc(mdn, outputDir);
+ if (mode != null) apidoc.mode = mode;
Bob Nystrom 2012/03/28 20:01:21 Sicne we pass in the output directory, how about p
sethladd 2012/03/29 00:15:28 Done.
apidoc.document();
}
@@ -95,6 +126,8 @@ class Apidoc extends doc.Dartdoc {
/** Big ball of JSON containing the scraped MDN documentation. */
final Map mdn;
+ final String disqusShortname = 'dartapidocs';
Bob Nystrom 2012/03/28 20:01:21 Ditch the type annotation since it's obvious from
sethladd 2012/03/28 21:52:17 Done.
+
/**
* The URL to the page on MDN that content was pulled from for the current
* type being documented. Will be `null` if the type doesn't use any MDN
@@ -124,6 +157,25 @@ class Apidoc extends doc.Dartdoc {
<a href="$privacy">Privacy Policy</a></p>
''';
+ preFooterText =
+ '''
+ <div id="comments">
+ <div id="disqus_thread"></div>
+ <script type="text/javascript">
+ /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
+ var disqus_shortname = "$disqusShortname"; // required: replace example with your forum shortname
+
+ /* * * DON\'T EDIT BELOW THIS LINE * * */
+ (function() {
+ var dsq = document.createElement("script"); dsq.type = "text/javascript"; dsq.async = true;
+ dsq.src = "http://" + disqus_shortname + ".disqus.com/embed.js";
+ (document.getElementsByTagName("head")[0] || document.getElementsByTagName("body")[0]).appendChild(dsq);
+ })();
+ </script>
+ <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+ </div> <!-- #comments -->
+ ''';
+
searchEngineId = '011220921317074318178:i4mscbaxtru';
searchResultsUrl = 'http://www.dartlang.org/search.html';
}

Powered by Google App Engine
This is Rietveld 408576698