lib/jekyll-inline-svg.rb in jekyll-inline-svg-1.0.0 vs lib/jekyll-inline-svg.rb in jekyll-inline-svg-1.0.1
- old
+ new
@@ -24,12 +24,22 @@
#Separate file path from other attributes
PATH_SYNTAX = %r!
^(?<path>[^\s"']+|"[^"]*"|'[^']*')
(?<params>.*)
!x
+
+ # parse the first parameter in a string, giving :
+ # [full_match, param_name, double_quoted_val, single_quoted_val, unquoted_val]
+ # The Regex works like :
+ # - first group
+ # - match a group of characters that is alphanumeric, _ or -.
+ # - second group (non-capturing OR)
+ # - match a double-quoted string
+ # - match a single-quoted string
+ # - match an unquoted string matching the set : [\w\.\-#]
PARAM_SYNTAX= %r!
([\w-]+)\s*=\s*
- (?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))
+ (?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.\-#]+))
!x
def initialize(tag_name, input, tokens)
super
@svg, @params = JekyllInlineSvg.parse_params(input)