OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @constructor | 6 * @constructor |
7 */ | 7 */ |
8 WebInspector.JSArticle = function() | 8 WebInspector.JSArticle = function() |
9 { | 9 { |
10 /** @type {string} */ | 10 /** @type {string} */ |
(...skipping 11 matching lines...) Expand all Loading... | |
22 /** | 22 /** |
23 * @param {string} wikiMarkupText | 23 * @param {string} wikiMarkupText |
24 * @return {!WebInspector.JSArticle} | 24 * @return {!WebInspector.JSArticle} |
25 */ | 25 */ |
26 WebInspector.JSArticle.parse = function(wikiMarkupText) | 26 WebInspector.JSArticle.parse = function(wikiMarkupText) |
27 { | 27 { |
28 var wikiParser = new WebInspector.WikiParser(wikiMarkupText); | 28 var wikiParser = new WebInspector.WikiParser(wikiMarkupText); |
29 var from = wikiParser.document(); | 29 var from = wikiParser.document(); |
30 | 30 |
31 var article = new WebInspector.JSArticle(); | 31 var article = new WebInspector.JSArticle(); |
32 if (typeof from["Page_Title"] !== "undefined" && from["Page_Title"] !== {}) | 32 if (typeof from["Page_Title"] !== "undefined" && from["Page_Title"] !== {}) |
lushnikov
2014/08/11 09:42:49
from["Page_Title"] !== {}
This is always true, th
iliia
2014/08/11 12:17:53
Done.
| |
33 article.pageTitle = from["Page_Title"]; | 33 article.pageTitle = from["Page_Title"]; |
34 if (typeof from["Standardization_Status"] !== "undefined") | 34 if (typeof from["Standardization_Status"] !== "undefined") |
lushnikov
2014/08/11 09:42:49
you test all these fields for not being "undefined
apavlov
2014/08/11 10:05:13
I believe, they will ALWAYS be strings, since this
iliia
2014/08/11 12:17:53
Done.
| |
35 article.standardizationStatus = from["Standardization_Status"]; | 35 article.standardizationStatus = from["Standardization_Status"]; |
36 if (typeof from["Summary_Section"] !== "undefined") | 36 if (typeof from["Summary_Section"] !== "undefined") |
37 article.summary = from["Summary_Section"]; | 37 article.summary = from["Summary_Section"]; |
38 if (typeof from["API_Object_Method"] !== "undefined") | 38 if (typeof from["API_Object_Method"] !== "undefined") |
39 article.methods = from["API_Object_Method"]; | 39 article.methods = from["API_Object_Method"]; |
40 if (typeof from["Remarks_Section"] !== "undefined") | 40 if (typeof from["Remarks_Section"] !== "undefined" && typeof from["Remarks_S ection"]["Remarks"] !== "undefined") |
lushnikov
2014/08/11 09:42:49
For clarity:
if (from["Remarks_Section"] && typeo
iliia
2014/08/11 12:17:53
Done.
| |
41 article.remarks = from["Remarks_Section"]; | 41 article.remarks = from["Remarks_Section"]["Remarks"]; |
42 if (typeof from["Examples_Section"] !== "undefined" && typeof from["Examples _Section"]["Examples"] !== "undefined") | |
43 article.examples = from["Examples_Section"]["Examples"]; | |
42 | 44 |
43 return article; | 45 return article; |
44 } | 46 } |
45 | 47 |
OLD | NEW |