Description: Use slugs in FAQ instead of object_id
 In order to make the FAQ build reproducibly we use “slugs” for
 internal links instead of object ids.
Author: Jérémy Bobbio <lunar@debian.org>
Bug-Debian: https://bugs.debian.org/782884

--- ruby-sqlite3-1.3.9.orig/faq/faq.rb
+++ ruby-sqlite3-1.3.9/faq/faq.rb
@@ -1,6 +1,10 @@
 require 'yaml'
 require 'redcloth'
 
+def slugify( str )
+  str.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
+end
+
 def process_faq_list( faqs )
   puts "<ul>"
   faqs.each do |faq|
@@ -20,7 +24,7 @@ def process_faq_list_item( faq )
     puts question_text
     process_faq_list answer
   else
-    print "<a href='##{question.object_id}'>#{question_text}</a>"
+    print "<a href='##{slugify(question)}'>#{question_text}</a>"
   end
 
   puts "</li>"
@@ -43,7 +47,7 @@ def process_faq_description( faq, path )
     title = RedCloth.new( path ).to_html.gsub( %r{</?p>}, "" )
     answer = RedCloth.new( answer || "" )
 
-    puts "<a name='#{question.object_id}'></a>"
+    puts "<a name='#{slugify(question)}'></a>"
     puts "<div class='faq-title'>#{title}</div>"
     puts "<div class='faq-answer'>#{add_api_links(answer.to_html)}</div>"
   end
