forked from hound-search/hound
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes some issues in hound-search#76.
1. Changes mini-templating to use {name} instead of ${name}. 2. Merges url-pattern into a single json property. 3. Makes excluded files page respect url pattern. 4. Introduces common.js file to share between pages.
- Loading branch information
Kelly Norton
committed
Mar 2, 2015
1 parent
1cdf48e
commit f643617
Showing
6 changed files
with
84 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,5 @@ hound.sublime-workspace | |
data | ||
.vagrant | ||
pub/index.html | ||
pub/excluded_files.html | ||
config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// TODO(knorton): Use something to bundle this more intelligently and get this | ||
// out of the global scope. | ||
|
||
var ExpandVars = function(template, values) { | ||
for (var name in values) { | ||
template = template.replace('{' + name + '}', values[name]); | ||
} | ||
return template; | ||
}; | ||
|
||
var UrlToRepo = function(repo, path, line) { | ||
var url = repo.url.replace(/\.git$/, ''), | ||
pattern = repo['url-pattern'], | ||
anchor = line ? ExpandVars(pattern.anchor, { line : line }) : ''; | ||
|
||
// Hacky solution to fix _some more_ of the 404's when using SSH style URLs | ||
var sshParts = /git@(.*):(.*)/i.exec(url); | ||
if (sshParts) { | ||
url = '//' + sshParts[1] + '/' + sshParts[2]; | ||
} | ||
|
||
// I'm sure there is a nicer React/jsx way to do this: | ||
return ExpandVars(pattern['base-url'], { | ||
url : url, | ||
path: path, | ||
anchor: anchor | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters