You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by mw...@apache.org on 2019/04/24 20:44:50 UTC
[accumulo-website] branch master updated: Specify branch using -b
with ghc tag (#172)
This is an automated email from the ASF dual-hosted git repository.
mwalch pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo-website.git
The following commit(s) were added to refs/heads/master by this push:
new 5f52dae Specify branch using -b with ghc tag (#172)
5f52dae is described below
commit 5f52dae659c997d02139dc93df05e7fddac66ac5
Author: Mike Walch <mw...@apache.org>
AuthorDate: Wed Apr 24 16:44:45 2019 -0400
Specify branch using -b with ghc tag (#172)
---
README.md | 2 +-
_plugins/links.rb | 9 +++++++--
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/README.md b/README.md
index a8da500..196cb78 100644
--- a/README.md
+++ b/README.md
@@ -49,7 +49,7 @@ The source for these tags is at [_plugins/links.rb](_plugins/links.rb).
| dlink | Creates Documentation link | None | `{% dlink getting-stared/clients %}` |
| durl | Creates Documentation URL | None | `{% durl troubleshooting/performance %}` |
| ghi | GitHub issue link | None | `{% ghi 100 %}` |
-| ghc | GitHub code link | None | `{% ghc server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java %}` |
+| ghc | GitHub code link | Branch defaults to `gh_branch` setting in `_config.yml`. Override using `-b` | `{% ghc server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java %}` `{% ghc -b 1.9 README.md %}` |
| jira | Jira issue link | None | `{% jira ACCUMULO-1000 %}` |
## Updating property documentation
diff --git a/_plugins/links.rb b/_plugins/links.rb
index 6225c49..61007a9 100755
--- a/_plugins/links.rb
+++ b/_plugins/links.rb
@@ -210,12 +210,17 @@ class GitHubCodeTag < Liquid::Tag
end
def render(context)
- path = @text.strip
- file_name = path.split('/').last
+ args = @text.split(' ')
+ path = args[0]
branch = context.environments.first["page"]["gh_branch"]
if branch.nil?
branch = context.registers[:site].config["gh_branch"]
end
+ if args[0] == '-b'
+ branch = args[1]
+ path = args[2]
+ end
+ file_name = path.split('/').last
url = "https://github.com/apache/accumulo/blob/#{branch}/#{path}"
return "[#{file_name}](#{url})"
end