Skip to content

Commit 03efcaa

Browse files
committed
Fixes #1 (ignored URL wihtout CMSSW_X_Y_Z in it)
1 parent 6672f9b commit 03efcaa

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

contentscript.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
11
// console.log("Debugging github-linkify-cmssw");
2+
23
// the lines of code are stored in a table
34
table = document.getElementsByClassName("js-file-line-container")[0];
45

56
// get current page URL
7+
// better way to do this?
68
url = table.baseURI;
7-
// make root URL, i.e. up to & including CMSSW_X_Y_Z_AAA
8-
// note, be careful as can have CMSSW_1_2_3, CMSSW_1_2_X, CMSSW_1_2_3_SHLC_fixTk, etc
9-
var pattern = /CMSSW_[0-9]_[0-9]_.*?\//;
10-
cmssw = pattern.exec(url)[0];
11-
rootURL = url.substr(0, url.search(pattern)+cmssw.length);
9+
10+
// make root URL, i.e. up to & including CMSSW_X_Y_Z_AAA, or tag hash
11+
// note, be careful as can have URLs in diff formats:
12+
// github.com/cms-sw/cmssw/blob/CMSSW_7_2_X/DataFormats/JetReco/interface/GenJetCollection.h
13+
// with CMSSW_1_2_3, CMSSW_1_2_X, CMSSW_1_2_3_SHLC_fixTk, etc,
14+
// or
15+
// github.com/cms-sw/cmssw/blob/975...a78/DataFormats/JetReco/interface/GenJetCollection.h
16+
var cmssw_pattern = /.*\/cmssw\/blob\/[_a-zA-Z0-9]*?\//;
17+
var rootURL = "";
18+
cmssw = cmssw_pattern.exec(url)[0];
19+
rootURL = url.substr(0, url.search(cmssw_pattern)+cmssw.length);
1220
// console.log("URL: " + rootURL);
1321

1422
// pattern to do #include matching

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "Github linkify for CMSSW",
33
"description": "Turns #include statments in C++ files, and import X/from X import Y/process.load(XXX.YYY.ZZZ_cff) in python config files, into links when browing CMSSW on Github.",
4-
"version": "0.2.0",
4+
"version": "0.2.2",
55
"content_scripts": [
66
{
77
"matches": [

0 commit comments

Comments
 (0)