From 6dd3d91768227a7ac03a63f8e47eacae99be8892 Mon Sep 17 00:00:00 2001
From: XhmikosR <xhmikosr@gmail.com>
Date: Wed, 27 Sep 2017 13:08:03 +0300
Subject: [PATCH] example plugin: add `data-example-id` only if it's been
 supplied. (#24127)

---
 _plugins/example.rb | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/_plugins/example.rb b/_plugins/example.rb
index 8a86a22028..9132897206 100644
--- a/_plugins/example.rb
+++ b/_plugins/example.rb
@@ -34,7 +34,7 @@ Syntax Error in tag 'example' while parsing the following markup:
 
   #{markup}
 
-Valid syntax: example <lang>
+Valid syntax: example <lang> [id=foo]
 eos
         end
       end
@@ -55,7 +55,7 @@ eos
       end
 
       def example(output)
-        "<div class=\"bd-example\" data-example-id=\"#{@options[:id]}\">\n#{output}\n</div>"
+        "<div class=\"bd-example\"" + (@options[:id] ? " data-example-id=\"#{@options[:id]}\"" : "") + ">\n#{output}\n</div>"
       end
 
       def remove_holderjs(code)
-- 
GitLab