diff --git a/lib/cli.coffee b/lib/cli.coffee index 7b9d25b..74b1c5a 100755 --- a/lib/cli.coffee +++ b/lib/cli.coffee @@ -79,6 +79,11 @@ module.exports = CLI = (inputArgs, callback) -> describe: "Supply your GitHub repository URL (if groc fails to guess it)." type: 'string' + 'repository-branch': + describe: "Supply your git branch" + type: 'string' + default: 'master' + 'only-render-newer': describe: "Only render files if the source is newer than the output." default: true @@ -232,6 +237,7 @@ module.exports = CLI = (inputArgs, callback) -> onlyRenderNewer: argv['only-render-newer'] style: style + project.gitBranch = argv['repository-branch'] # Good to go! unless argv.github project.githubURL = argv['repository-url'] diff --git a/lib/styles/default/behavior.coffee b/lib/styles/default/behavior.coffee index 74ffcfa..5a37082 100755 --- a/lib/styles/default/behavior.coffee +++ b/lib/styles/default/behavior.coffee @@ -191,7 +191,7 @@ buildNav = (metaInfo) -> if metaInfo.documentPath == 'index' sourceURL = metaInfo.githubURL else - sourceURL = "#{metaInfo.githubURL}/blob/master/#{metaInfo.projectPath}" + sourceURL = "#{metaInfo.githubURL}/blob/#{metaInfo.gitBranch}/#{metaInfo.projectPath}" nav$.find('.tools').prepend """
  • @@ -255,6 +255,7 @@ $ -> metaInfo = relativeRoot: $('meta[name="groc-relative-root"]').attr('content') githubURL: $('meta[name="groc-github-url"]').attr('content') + gitBranch: $('meta[name="groc-git-branch"]').attr('content') documentPath: $('meta[name="groc-document-path"]').attr('content') projectPath: $('meta[name="groc-project-path"]').attr('content') diff --git a/lib/styles/default/docPage.jade b/lib/styles/default/docPage.jade index ccbc9b8..c5ad0b7 100755 --- a/lib/styles/default/docPage.jade +++ b/lib/styles/default/docPage.jade @@ -8,6 +8,7 @@ html(lang="en") meta(name="groc-document-path", content=targetPath) meta(name="groc-project-path", content=projectPath) - if (project.githubURL) + meta(name="groc-git-branch", content=project.gitBranch) meta(name="groc-github-url", content=project.githubURL) link(rel="stylesheet", type="text/css", media="all", href=relativeRoot + "assets/style.css") script(type="text/javascript", src=relativeRoot + "assets/behavior.js") @@ -16,7 +17,7 @@ html(lang="en") #meta - if (project.githubURL) .file-path - a(href=project.githubURL + '/blob/master/' + projectPath)= projectPath + a(href=project.githubURL + '/blob/' + project.gitBranch + '/' + projectPath)= projectPath - else .file-path= projectPath #document