[geeklog-hg] geeklog: Title to Id now trims leading and trailing dashes

geeklog-cvs at lists.geeklog.net geeklog-cvs at lists.geeklog.net
Sat Jan 4 11:04:20 EST 2014


changeset 9381:f6459189ab57
url:  http://project.geeklog.net/cgi-bin/hgwebdir.cgi/geeklog/rev/f6459189ab57
user: Tom <websitemaster at cogeco.net>
date: Sat Jan 04 10:35:59 2014 -0500
description:
Title to Id now trims leading and trailing dashes

diffstat:

 public_html/javascript/title_2_id.js |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r c50780e885ae -r f6459189ab57 public_html/javascript/title_2_id.js
--- a/public_html/javascript/title_2_id.js	Wed Jan 01 11:04:29 2014 -0500
+++ b/public_html/javascript/title_2_id.js	Sat Jan 04 10:35:59 2014 -0500
@@ -20,9 +20,11 @@
 		Title = Title.replace(Sch[i], Nch[i]);
 		}
 	}
-	var urlID = Title.replace(/\s\s+/g, " ").replace(/\s/g, "_").replace(/\W/g, Separ).replace(/_/g, Separ);
+	var urlID = Title.replace(/\s\s+/g, " ").replace(/\s/g, "_").replace(/\W/g, Separ).replace(/_/g, Separ).replace(/^-+|-+$/g, ""); // Final replace trim any leading and trailing dashes
+	
 	var T2ID = document.getElementById(setTl2ID);
 	
 	T2ID.value = urlID.slice(0, size); // Max size of id
-
+	
+	
 }
\ No newline at end of file



More information about the geeklog-cvs mailing list