]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
example plugin: add `data-example-id` only if it's been supplied. (#24127)
authorXhmikosR <xhmikosr@gmail.com>
Wed, 27 Sep 2017 10:08:03 +0000 (13:08 +0300)
committerGitHub <noreply@github.com>
Wed, 27 Sep 2017 10:08:03 +0000 (13:08 +0300)
_plugins/example.rb

index 8a86a2202825e4b9f4fc39a6cff95063804c6a0d..913289720629bcef580cdd191485b4faf5a6cbe0 100644 (file)
@@ -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)