example plugin: add `data-example-id` only if it's been supplied. (#24127)

This commit is contained in:
XhmikosR 2017-09-27 13:08:03 +03:00 committed by GitHub
parent 1d6a6c2abf
commit 6dd3d91768
1 changed files with 2 additions and 2 deletions

View 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)