File tree Expand file tree Collapse file tree 2 files changed +10
-5
lines changed
lib/prmd/templates/schemata Expand file tree Collapse file tree 2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change 138138
139139 if value['pattern']
140140 # Prevent the pipe regex pattern characters from being interpreted
141- # as markdown table
141+ # as markdown table.
142142 # Prevent instances of []() in regexes from being rendered as
143- # markdown links
144- pattern = value['pattern'].gsub(/\|/, '|').gsub(/\[/, '[')
143+ # markdown links.
144+ # Prevent patterns with * being rendered as having emphasis
145+ # or being an unordered list.
146+ pattern = value['pattern']
147+ .gsub(/\|/, '|')
148+ .gsub(/\[/, '[')
149+ .gsub(/\*/, '*')
145150
146151 description += "<br/> **pattern:** <pre>#{pattern}</pre>"
147152 end
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ def test_render_for_example_as_an_array
5151 end
5252
5353 def test_render_for_regex_patterns_with_pipes
54- expression = /<pre>\^ [ ;a-z\] \( \? :[a-z \] | \) \+ [ a-z\] \$ /
54+ expression = /<pre>\^ &lbrack ;a-z\] \( \? :[a|b \] \) \& ast;[ a-z]* \$ /
5555 markdown = render
5656 assert_match expression , markdown
5757 end
@@ -123,7 +123,7 @@ def data
123123 'description' => 'A string with a regex pattern applied to it.' ,
124124 'type' => 'string' ,
125125 'example' => 'second' ,
126- 'pattern' => '^[a-z](?:[a-z]|)+ [a-z]$'
126+ 'pattern' => '^[a-z](?:[a|b])* [a-z]* $'
127127 } ,
128128 'option1' => {
129129 'properties' => {
You can’t perform that action at this time.
0 commit comments