From a79cdddc0936a528f39b08eccf43f6c1240a6eb7 Mon Sep 17 00:00:00 2001 From: Misty Stanley-Jones Date: Fri, 17 Mar 2017 15:38:34 -0700 Subject: [PATCH] Add a Liquid template for Github PR links (#2380) --- _includes/github-pr.md | 12 ++++++++++++ test.md | 14 +++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 _includes/github-pr.md diff --git a/_includes/github-pr.md b/_includes/github-pr.md new file mode 100644 index 0000000000..6ed0b979b2 --- /dev/null +++ b/_includes/github-pr.md @@ -0,0 +1,12 @@ +{% comment %} + Generates a Github PR URL from three parameters + + Usage: + {% include github-pr.md org=docker repo=docker pr=12345 %} + + If you omit the org or repo, they default to docker. + If you omit the pr, it defaults to NULL. + + Output: + [#12345](https://github.com/docker/docker/pull/12345) +{% endcomment %}{% assign org = include.org | default: "docker" %}{% assign repo = include.repo | default: "docker" %}{% assign pr = include.pr | default: NULL %}{% assign github-url="https://github.com" %}{% capture pr-link %}[#{{ pr }}]({{ github-url }}/{{ org }}/{{ repo }}/pull/{{ pr }}){% endcapture %}{{ pr-link | strip_newlines }} \ No newline at end of file diff --git a/test.md b/test.md index 935df76246..52abd3d095 100644 --- a/test.md +++ b/test.md @@ -45,7 +45,7 @@ Some Lorem ipsum text with formatting and styling. **Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt** ut labore `et dolore magna aliqua`. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo _consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore_ eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt _**in culpa quiofficia deserunt mollit anim id est laborum.**_ -And here are some tabs: +And here are some tabs: