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

Side by Side Diff: Source/devtools/front_end/documentation/DocumentationURLProvider.js

Issue 530003002: DevTools: [Documentation] Add syntax highlight for code examples (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@iliia-patch
Patch Set: Comments addressed 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 unified diff | Download patch
OLDNEW
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.DocumentationURLProvider = function() 8 WebInspector.DocumentationURLProvider = function()
9 { 9 {
10 this._gapFromIndex = 0; 10 this._gapFromIndex = 0;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 }, 226 },
227 227
228 /** 228 /**
229 * @param {string} itemPath 229 * @param {string} itemPath
230 */ 230 */
231 _addDescriptorToList: function(itemPath) 231 _addDescriptorToList: function(itemPath)
232 { 232 {
233 var lastSlashIndex = itemPath.lastIndexOf("/"); 233 var lastSlashIndex = itemPath.lastIndexOf("/");
234 if (lastSlashIndex === -1) 234 if (lastSlashIndex === -1)
235 return; 235 return;
236 var sourceName = itemPath.substring(0, lastSlashIndex + 1);
237 // There are some properties which have several words in their name. 236 // There are some properties which have several words in their name.
238 // In article list they are written through gap, while in URL they are w ritten through underscore. 237 // In article list they are written through gap, while in URL they are w ritten through underscore.
239 // We are creating URL for current property, so we have to replace all t he gaps with underscores. 238 // We are creating URL for current property, so we have to replace all t he gaps with underscores.
240 var propertyName = itemPath.substring(lastSlashIndex + 1).replace(" ", " _"); 239 var correctedItemPath = itemPath.replace(" ", "_");
240 var sourceName = correctedItemPath.substring(0, lastSlashIndex + 1);
241 var propertyName = correctedItemPath.substring(lastSlashIndex + 1);
241 var sources = WebInspector.DocumentationURLProvider._sources; 242 var sources = WebInspector.DocumentationURLProvider._sources;
242 for (var i = 0; i < sources.length; ++i) { 243 for (var i = 0; i < sources.length; ++i) {
243 if (sources[i].url() !== sourceName || !sources[i].source().hasOwnPr operty(propertyName)) 244 if (sources[i].url() !== sourceName || !sources[i].source().hasOwnPr operty(propertyName))
244 continue; 245 continue;
245 var descriptors = this._articleList.get(propertyName) || []; 246 var descriptors = this._articleList.get(propertyName) || [];
246 descriptors.push(new WebInspector.DocumentationURLProvider.ItemDescr iptor(sources[i], propertyName)); 247 descriptors.push(new WebInspector.DocumentationURLProvider.ItemDescr iptor(sources[i], propertyName));
247 this._articleList.set(propertyName, descriptors); 248 this._articleList.set(propertyName, descriptors);
248 } 249 }
249 } 250 }
250 } 251 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/common/Settings.js ('k') | Source/devtools/front_end/documentation/DocumentationView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698