From 833f3910907fafefd573ff446061f875d543b807 Mon Sep 17 00:00:00 2001 From: Chris Rebert Date: Tue, 2 Dec 2014 18:46:42 -0800 Subject: [PATCH] Add support for example IDs to {% example %} template tag e.g. {% example html id=some-example-id-here %} --- docs/_plugins/highlight_alt.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/_plugins/highlight_alt.rb b/docs/_plugins/highlight_alt.rb index de84e759da..9d1b414bb7 100644 --- a/docs/_plugins/highlight_alt.rb +++ b/docs/_plugins/highlight_alt.rb @@ -8,7 +8,7 @@ module Jekyll # forms: name, name=value, or name="" # # is a space-separated list of numbers - SYNTAX = /^([a-zA-Z0-9.+#-]+)((\s+\w+(=(\w+|"([0-9]+\s)*[0-9]+"))?)*)$/ + SYNTAX = /^([a-zA-Z0-9.+#-]+)((\s+\w+(=((\w|[0-9_-])+|"([0-9]+\s)*[0-9]+"))?)*)$/ def initialize(tag_name, markup, tokens) super @@ -17,7 +17,7 @@ module Jekyll @options = {} if defined?($2) && $2 != '' # Split along 3 possible forms -- key="", key=value, or key - $2.scan(/(?:\w="[^"]*"|\w=\w|\w)+/) do |opt| + $2.scan(/(?:\w+(?:=(?:(?:\w|[0-9_-])+|"[^"]*")?)?)/) do |opt| key, value = opt.split('=') # If a quoted list, convert to array if value && value.include?("\"") @@ -55,7 +55,7 @@ eos end def example(output) - "
#{output}
" + "
\n#{output}\n
" end def render_rouge(code)