Updated oss-/cloud-only shortcodes to work with list items (#3424)
* updated oss-/cloud-only shortcodes to work with list items * deduplicated regex passes * Apply suggestions from code review Co-authored-by: Jason Stirnaman <jstirnaman@influxdata.com> Co-authored-by: Jason Stirnaman <jstirnaman@influxdata.com>pull/3378/head^2
parent
e6ef1f8bbf
commit
06731b2883
|
|
@ -1034,6 +1034,29 @@ only render in the InfluxDB OSS documentation.
|
|||
This is necessary to get the first sentence/paragraph to render correctly.
|
||||
|
||||
{{% /oss-only %}}
|
||||
|
||||
- {{% oss-only %}}This is a list item that will only render in InfluxDB OSS docs.{{% /oss-only %}}
|
||||
- {{% oss-only %}}
|
||||
|
||||
This is a multi-paragraph list item that will only render in the InfluxDB OSS docs.
|
||||
|
||||
**Note:** Notice shortcode is _inside_ of the line item.
|
||||
There also must be blank newline after the opening short-code tag.
|
||||
This is necessary to get the first sentence/paragraph to render correctly.
|
||||
|
||||
{{% /oss-only %}}
|
||||
|
||||
1. Step 1
|
||||
2. {{% oss-only %}}This is a list item that will only render in InfluxDB OSS docs.{{% /oss-only %}}
|
||||
3. {{% oss-only %}}
|
||||
|
||||
This is a list item that contains multiple paragraphs or nested list items and will only render in the InfluxDB OSS docs.
|
||||
|
||||
**Note:** Notice shortcode is _inside_ of the line item.
|
||||
There also must be blank newline after the opening short-code tag.
|
||||
This is necessary to get the first sentence/paragraph to render correctly.
|
||||
|
||||
{{% /oss-only %}}
|
||||
```
|
||||
|
||||
#### cloud-only
|
||||
|
|
@ -1052,6 +1075,29 @@ only render in the InfluxDB Cloud documentation.
|
|||
This is necessary to get the first sentence/paragraph to render correctly.
|
||||
|
||||
{{% /cloud-only %}}
|
||||
|
||||
- {{% cloud-only %}}This is a list item that will only render in InfluxDB Cloud docs.{{% /cloud-only %}}
|
||||
- {{% cloud-only %}}
|
||||
|
||||
This is a list item that contains multiple paragraphs or nested list items and will only render in the InfluxDB Cloud docs.
|
||||
|
||||
**Note:** Notice shortcode is _inside_ of the line item.
|
||||
There also must be blank newline after the opening short-code tag.
|
||||
This is necessary to get the first sentence/paragraph to render correctly.
|
||||
|
||||
{{% /cloud-only %}}
|
||||
|
||||
1. Step 1
|
||||
2. {{% cloud-only %}}This is a list item that will only render in InfluxDB Cloud docs.{{% /cloud-only %}}
|
||||
3. {{% cloud-only %}}
|
||||
|
||||
This is a multi-paragraph list item that will only render in the InfluxDB Cloud docs.
|
||||
|
||||
**Note:** Notice shortcode is _inside_ of the line item.
|
||||
There also must be blank newline after the opening short-code tag.
|
||||
This is necessary to get the first sentence/paragraph to render correctly.
|
||||
|
||||
{{% /cloud-only %}}
|
||||
```
|
||||
|
||||
#### All-Caps
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
title: Example post
|
||||
description: This is just an example post to show the format of new 2.0 posts
|
||||
weight: 1
|
||||
# draft: true
|
||||
draft: true
|
||||
related:
|
||||
- /influxdb/v2.0/write-data/
|
||||
- /influxdb/v2.0/write-data/quick-start
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
{{ $influxdbCloud := and (eq $product "influxdb") (eq $version "cloud") }}
|
||||
|
||||
{{ if $influxdbOSS }}
|
||||
{{ .Content | replaceRE `(?U)(<span class=\'cloud\-only\'>.*<\/span><\!\-\- close \-\-\>)` "" | replaceRE `(?Us)(<div class=\'cloud\-only\'>.*<\/div><\!\-\- close \-\-\>)` "" | safeHTML}}
|
||||
{{ .Content | replaceRE `(?Us)(<li>\s*<(?:div|span) class=\'cloud\-only\'>.*<\/(?:div|span)><\!\-\- close \-\-\>\s*</li>)` "" | replaceRE `(?Us)(<(?:div|span) class=\'cloud\-only\'>.*<\/(?:div|span)><\!\-\- close \-\-\>)` "" | safeHTML}}
|
||||
{{ else if $influxdbCloud }}
|
||||
{{ .Content | replaceRE `(?U)(<span class=\'oss\-only\'>.*<\/span><\!\-\- close \-\-\>)` "" | replaceRE `(?Us)(<div class=\'oss\-only\'>.*<\/div><\!\-\- close \-\-\>)` "" | safeHTML}}
|
||||
{{ .Content | replaceRE `(?Us)(<li>\s*<(?:div|span) class=\'oss\-only\'>.*<\/(?:div|span)><\!\-\- close \-\-\>\s*</li>)` "" | replaceRE `(?Us)(<(?:div|span) class=\'oss\-only\'>.*<\/(?:div|span)><\!\-\- close \-\-\>)` "" | safeHTML}}
|
||||
{{ else }}
|
||||
{{ .Content }}
|
||||
{{ end }}
|
||||
Loading…
Reference in New Issue