Merge pull request #6687 from abiogenesis-now/jyao/allow-glossary-prefix

[glossary] Add prepend option to glossary definition tag
This commit is contained in:
Andrew Chen
2017-12-18 14:15:51 -06:00
committed by GitHub
5 changed files with 22 additions and 15 deletions
+1
View File
@@ -25,6 +25,7 @@ This renders the definition of the glossary term inside a `<div>`, preserving Ma
| --- | --- | --- | | --- | --- | --- |
| `term_id` | N/A (Required) | The `id` of the glossary term whose definition will be used. (This `id` is the same as the filename of the term, i.e. `_data/glossary/<ID>.yml`.) | | `term_id` | N/A (Required) | The `id` of the glossary term whose definition will be used. (This `id` is the same as the filename of the term, i.e. `_data/glossary/<ID>.yml`.) |
| `length` | "short" | Specifies which term definition should be used ("short" for the `short-definition`, "long" for `long-description`, "all" when both should be included). | | `length` | "short" | Specifies which term definition should be used ("short" for the `short-definition`, "long" for `long-description`, "all" when both should be included). |
| `prepend` | "Service Catalog is" | A prefix which can be attached in front of a term's short definition (which is one or more sentence fragments). |
#### (2) `glossary_tooltip` tag #### (2) `glossary_tooltip` tag
+8 -2
View File
@@ -55,11 +55,17 @@ module Jekyll
class Definition < Base class Definition < Base
VALID_PARAM_NAMES = [ VALID_PARAM_NAMES = [
:term_id, :term_id,
:length :length,
:prepend,
].freeze ].freeze
def render(context) def render(context)
include_snippet(context) text = include_snippet(context)
if @args[:prepend]
text.sub(/<p>(.)/) { "<p>#{@args[:prepend]} #{$1.downcase}" }
else
text
end
end end
end end
@@ -5,7 +5,7 @@ approvers:
--- ---
{% capture overview %} {% capture overview %}
{% glossary_definition term_id="service-catalog" length="long" %} {% glossary_definition term_id="service-catalog" length="all" prepend="Service Catalog is" %}
Use [Helm](https://helm.sh/) to install Service Catalog on your Kubernetes cluster. Up to date information on this process can be found at the [kubernetes-incubator/service-catalog](https://github.com/kubernetes-incubator/service-catalog/blob/master/docs/install.md) repo. Use [Helm](https://helm.sh/) to install Service Catalog on your Kubernetes cluster. Up to date information on this process can be found at the [kubernetes-incubator/service-catalog](https://github.com/kubernetes-incubator/service-catalog/blob/master/docs/install.md) repo.
@@ -5,7 +5,7 @@ approvers:
--- ---
{% capture overview %} {% capture overview %}
{% glossary_definition term_id="service-catalog" length="long" %} {% glossary_definition term_id="service-catalog" length="all" prepend="Service Catalog is" %}
Use the [Service Catalog Installer](https://github.com/GoogleCloudPlatform/k8s-service-catalog#installation) tool to easily install or uninstall Service Catalog on your Kubernetes cluster. This CLI tool is installed as `sc` in your local environment. Use the [Service Catalog Installer](https://github.com/GoogleCloudPlatform/k8s-service-catalog#installation) tool to easily install or uninstall Service Catalog on your Kubernetes cluster. This CLI tool is installed as `sc` in your local environment.