add prepend option to glossary definition tag
This commit is contained in:
@@ -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`.) |
|
||||
| `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
|
||||
|
||||
|
||||
@@ -55,11 +55,17 @@ module Jekyll
|
||||
class Definition < Base
|
||||
VALID_PARAM_NAMES = [
|
||||
:term_id,
|
||||
:length
|
||||
:length,
|
||||
:prepend,
|
||||
].freeze
|
||||
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user