Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-docs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/Rules
diff options
context:
space:
mode:
authorAchilleas Pipinellis <axilleas@axilleas.me>2017-09-10 20:05:57 +0300
committerAchilleas Pipinellis <axilleas@axilleas.me>2017-09-10 20:05:57 +0300
commit259982ccd3f72eb19e938fa929301a7725b3d1da (patch)
tree95a84a20d52308c666e3e68f30af0f7f827e637f /Rules
parentea5f2ee6d944c4fe5443dbb589600c4906969ce6 (diff)
Let us define a "title: This is a title" in a document
Without this change, the regex was being confused if there were other strings starting with '#' (like code comments)
Diffstat (limited to 'Rules')
-rw-r--r--Rules8
1 files changed, 5 insertions, 3 deletions
diff --git a/Rules b/Rules
index 29bd0732..ea8be954 100644
--- a/Rules
+++ b/Rules
@@ -11,9 +11,11 @@ preprocess do
item[:redirect] = item[:redirect].gsub!(/\.md/, '.html')
end
- title = item.raw_content.match(/^[#] .*$/).to_s
- title.gsub!('# ', '')
- item[:title] = title unless title.empty?
+ unless item[:title]
+ title = item.raw_content.match(/^[#] .*$/).to_s
+ title.gsub!('# ', '')
+ item[:title] = title unless title.empty?
+ end
end
end
end