diff --git a/_plugins/tabs.rb b/_plugins/tabs.rb index adc273de945..cea844897f7 100644 --- a/_plugins/tabs.rb +++ b/_plugins/tabs.rb @@ -1,3 +1,5 @@ +require 'digest/md5' + module Tags class TabsBlock < Liquid::Block def initialize(tag_name, tabonly = 'false', tokens) @@ -13,12 +15,15 @@ def render(context) tabslist = '' + "\n" @@ -48,7 +53,8 @@ def render(context) content = indentation ? super.gsub(/^#{' |\t' * indentation}/, '') : super content = converter.convert(content) content = content.strip # Strip again to avoid "\n" - tabslug = @tab.gsub(' ', '-') + tabslug = @tab.gsub(/[^0-9a-z]/i, '') + tabslug = Digest::MD5.hexdigest(@tab) if tabslug.empty? '
' + content + "
" end @@ -66,15 +72,17 @@ def initialize(tag_name, tabonly = 'false', tokens) def render(context) tabs = super.scan(/data\-sub\_tab=\"(.*?)\"/) tabslist = '' + "\n" @@ -104,7 +112,8 @@ def render(context) content = indentation ? super.gsub(/^#{' |\t' * indentation}/, '') : super content = converter.convert(content) content = content.strip # Strip again to avoid "\n" - tabslug = @tab.gsub(' ', '-') + tabslug = @tab.gsub(/[^0-9a-z]/i, '') + tabslug = Digest::MD5.hexdigest(@tab) if tabslug.empty? '
' + content + "
" end