From e2e30f6b7f783e967a73ebf257f0e4218bcedfc4 Mon Sep 17 00:00:00 2001 From: Greg Woodcock Date: Mon, 13 Jun 2016 12:38:50 +0100 Subject: [PATCH] Alter regex to allow apostrophes in document titles When parsing the content of pig content packages, the regex to look for the following pattern: href="/documents/%slug%">%Document title% would break if the document title included a '. This fix now stops the capture at '> OR "> --- lib/trough/pig/hooks.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/trough/pig/hooks.rb b/lib/trough/pig/hooks.rb index fbfba82..6bde742 100644 --- a/lib/trough/pig/hooks.rb +++ b/lib/trough/pig/hooks.rb @@ -76,7 +76,7 @@ def determine_text_change(key, content_chunk) def find_documents(value) # Find all links to /documents/:slug and return the slugs return [] if value.nil? - value.scan(/href=\S*\/documents\/(\S+[^\\])\\?['"]/).flatten + value.scan(/href=\S*\/documents\/(\S+[^\\])\\?['"]>/).flatten end def unlink_document_usages