about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
authorYamagishi Kazutoshi <ykzts@desire.sh>2019-09-24 00:25:10 +0900
committerEugen Rochko <eugen@zeonfederated.com>2019-09-23 17:25:10 +0200
commit67bef15e53a77b6f1557fdd0efa65f3e916c20df (patch)
treef5bdd8f6942b5ce951f571b331cfd68d44c9dd21 /app/lib
parent1051c5cffadeee8d37bffcd0b3de90ef65d7d9d9 (diff)
Add fallback section ID with ToC (#11941)
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/toc_generator.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/lib/toc_generator.rb b/app/lib/toc_generator.rb
index 351675a5c..0c8f766ca 100644
--- a/app/lib/toc_generator.rb
+++ b/app/lib/toc_generator.rb
@@ -45,7 +45,7 @@ class TOCGenerator
     parsed_html.traverse do |node|
       next unless TARGET_ELEMENTS.include?(node.name)
 
-      anchor = node['id'] || node.text.parameterize
+      anchor = node['id'] || node.text.parameterize.presence || 'sec'
       @slugs[anchor] += 1
       anchor = "#{anchor}-#{@slugs[anchor]}" if @slugs[anchor] > 1