summaryrefslogtreecommitdiff
path: root/scripts/lib
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-06-30 03:08:59 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-06-30 03:08:59 +0000
commiteddf35996244adeeac6edff5df82efe2167dff9c (patch)
tree464092bcdf21fce23d34e58a0ab6396f5084d438 /scripts/lib
parent7b5ff5df506fb54eea0e5d58aadecd0e184ca089 (diff)
downloadgitlab-ce-eddf35996244adeeac6edff5df82efe2167dff9c.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/glfm/parse_examples.rb16
1 files changed, 4 insertions, 12 deletions
diff --git a/scripts/lib/glfm/parse_examples.rb b/scripts/lib/glfm/parse_examples.rb
index 051cbdc7941..14634bcfb3e 100644
--- a/scripts/lib/glfm/parse_examples.rb
+++ b/scripts/lib/glfm/parse_examples.rb
@@ -41,7 +41,6 @@ module Glfm
h1_regex = /\A# / # new logic compared to original Python code
h2_regex = /\A## / # new logic compared to original Python code
- h3_regex = /\A### / # new logic compared to original Python code
header_regex = /\A#+ / # Added beginning of line anchor to original Python code
spec_txt_lines.each do |line|
@@ -103,19 +102,12 @@ module Glfm
# reset the headers array if we found a new H1
headers = [] if line =~ h1_regex
- if headers.length == 2 && line =~ h2_regex
- # pop the last entry from the headers array if we are in an H2 and found a new H2
- headers.pop
- elsif headers.length == 3 && line =~ h3_regex
- # pop the last entry from the headers array if we are in an H3 and found a new H3
- headers.pop
- elsif headers.length == 3 && line =~ h2_regex
- # pop the last two entries from the headers array if we are in an H3 and found a new H2
- headers.pop(2)
- end
+ # headers should be size 2 or less [<H1_headertext>, <H2_headertext>]
+ # pop the last entry from the headers array if we are in an H2 and found a new H2
+ headers.pop if headers.length == 2 && line =~ h2_regex
# push the new header text to the headers array
- headers << headertext # New logic compared to original Python code
+ headers << headertext if line =~ h1_regex || line =~ h2_regex
else
# Else if we are in regular text...