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

Unified Diff: Source/devtools/front_end/documentation/DocumentationView.js

Issue 539353004: DevTools: [Documentation] Update parser for WikiText (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: add method secondToken() Created 6 years, 3 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: Source/devtools/front_end/documentation/DocumentationView.js
diff --git a/Source/devtools/front_end/documentation/DocumentationView.js b/Source/devtools/front_end/documentation/DocumentationView.js
index 042f0a243dfb3d91978eae87abf3857b071e2a0b..37ec59a5139b20e29539701acdcfb3b7fcb5c189 100644
--- a/Source/devtools/front_end/documentation/DocumentationView.js
+++ b/Source/devtools/front_end/documentation/DocumentationView.js
@@ -22,6 +22,7 @@ WebInspector.DocumentationView.showDocumentationURL = function(url, searchItem)
if (!WebInspector.DocumentationView._view)
WebInspector.DocumentationView._view = new WebInspector.DocumentationView();
var view = WebInspector.DocumentationView._view;
+ view.element.removeChildren();
lushnikov 2014/09/08 14:08:29 why do we need this?
iliia 2014/09/08 15:20:49 We discuss it with offline. On 2014/09/08 14:08:29
WebInspector.inspectorView.showCloseableViewInDrawer("documentation", WebInspector.UIString("Documentation"), view);
view.showDocumentation(url, searchItem);
}
@@ -61,14 +62,18 @@ WebInspector.DocumentationView.prototype = {
return;
}
var wikiMarkupText = pages[wikiKeys[0]]["revisions"]["0"]["*"];
- var article = WebInspector.JSArticle.parse(wikiMarkupText);
+ try {
+ var article = WebInspector.JSArticle.parse(wikiMarkupText);
+ } catch (error) {
+ this._createPageForError(error);
lushnikov 2014/09/08 14:08:29 let's fallback to empty page for now. We'll do a "
iliia 2014/09/08 15:20:50 Done.
+ }
if (!article) {
this._createEmptyPage();
return;
}
- var renderer = new WebInspector.DocumentationView.Renderer(article, searchItem);
this.element.removeChildren();
lushnikov 2014/09/08 14:08:29 why this change?
iliia 2014/09/08 15:20:49 We discuss it offline. On 2014/09/08 14:08:29, lus
+ var renderer = new WebInspector.DocumentationView.Renderer(article, searchItem);
this.element.appendChild(renderer.renderJSArticle());
},
@@ -79,6 +84,15 @@ WebInspector.DocumentationView.prototype = {
pageTitle.textContent = WebInspector.UIString("Documentation not available");
},
+ _createPageForError: function(message)
+ {
+ this.element.removeChildren();
+ var pageTitle = this.element.createChild("div", "documentation-page-title");
+ pageTitle.textContent = WebInspector.UIString("We have some problems");
+ var error = this.element.createChild("div", "documentation-text");
+ error.textContent = WebInspector.UIString("Error message: " + message);
+ },
+
__proto__: WebInspector.View.prototype
}
@@ -227,7 +241,7 @@ WebInspector.DocumentationView.Renderer.prototype = {
/**
* @param {!WebInspector.WikiParser.ArticleElement} article
- * @return {!Element}
+ * @return {?Element}
*/
_renderBlock: function(article)
{
@@ -237,7 +251,6 @@ WebInspector.DocumentationView.Renderer.prototype = {
switch (article.type()) {
case elementTypes.Inline:
element = document.createElement("span");
- break;
lushnikov 2014/09/08 14:08:30 I believe you still want "break" statement
iliia 2014/09/08 15:20:49 Done.
case elementTypes.Link:
element = document.createElementWithClass("a", "documentation-link");
element.href = article.url();

Powered by Google App Engine
This is Rietveld 408576698