Index: /other-projects/nightly-tasks/diffcol/trunk/diffcol/diffcol.pl
===================================================================
--- /other-projects/nightly-tasks/diffcol/trunk/diffcol/diffcol.pl	(revision 27742)
+++ /other-projects/nightly-tasks/diffcol/trunk/diffcol/diffcol.pl	(revision 27743)
@@ -591,5 +591,5 @@
 				my $strNewTest = &FileUtils::filenameConcatenate($strTest,$strEachFile);
 				# now additionally ignoring the earliestDatestamp file and the index/idx/*.idh binary file when diffing file 
-				if(!($strEachFile eq "log" || $strEachFile eq "earliestDatestamp" || $strEachFile =~ m/\.cfg$/g || $strEachFile =~ m/\.((g|j|l|b)db|idh|i.*|wa|td|tsd|ti|t|tl|w|jpe?g|gif|png)$/g))
+				if(!($strEachFile eq "log" || $strEachFile eq "earliestDatestamp" || $strEachFile =~ m/\.cfg$/g || $strEachFile =~ m/\.((g|j|l|b)db|idh|i.*|wa|td|tsd|ti|t|tl|w|jpe?g|gif|png|wmf)$/g)) # wmf = windows meta file
 				{
 					push(@Errors,TestEach($strNewModel,$strNewTest,$intLevel,$strColName));
@@ -611,5 +611,5 @@
 				my $strNewModel = &FileUtils::filenameConcatenate($strModel,$strEachFile);
 				my $strNewTest = &FileUtils::filenameConcatenate($strTest,$strEachFile);
-				if(!($strEachFile eq "log" || $strEachFile eq "earliestDatestamp" || $strEachFile =~ m/\.cfg$/g || $strEachFile =~ m/\.((g|j|l|b)db|idh|i.*|wa|td|tsd|ti|t|tl|w|jpe?g|gif|png)$/g))
+				if(!($strEachFile eq "log" || $strEachFile eq "earliestDatestamp" || $strEachFile =~ m/\.cfg$/g || $strEachFile =~ m/\.((g|j|l|b)db|idh|i.*|wa|td|tsd|ti|t|tl|w|jpe?g|gif|png|wmf)$/g))
 				{
 					push(@Errors,TestEach($strNewModel,$strNewTest,$intLevel,$strColName));
@@ -645,4 +645,27 @@
 		$test_contents =~ s/$ignore_line_re//g;
 
+
+			# equalise/normalise the two doc.xml files for OS differences, if there are any
+			my $testIsWin = &isDocXMLFileWindows($test_contents);
+			my $modelIsWin = &isDocXMLFileWindows($model_contents);
+			
+			if($testIsWin != $modelIsWin) { # one of the 2 collections is built on windows, the other on linux, so need to make newlines constant
+			
+				my $win_contents = $testIsWin ? \$test_contents : \$model_contents;
+			
+				# remove all carriage returns \r - introduced into doc.xml by multiread after pdf converted to html
+				$$win_contents =~ s@[\r]@@g;
+			
+				# make all single windows slashes into single unix slashes
+				$$win_contents =~ s@([^\\])\\([^\\])@$1\/$2@g;
+				# make windows \r newlines into constant \n newlines. Already handled when \r got replaced
+				#$$win_contents =~ s@\r\n@\n@mg; # #http://stackoverflow.com/questions/650743/in-perl-how-to-do-you-remove-m-from-a-file
+				
+				#FOR MAC: old macs use CR carriage return (see http://www.perlmonks.org/?node_id=745018), so replace with \n?)
+				# $$win_contents =~ s@\r@\n@mg;
+			}
+			
+		
+
 		# tmp dirs have subdirs with random numbers in name, remove randomly named subdir portion of path
 		$model_contents =~ s@(tmp[\\\/])(\d*[\\\/])@$1@g; 
@@ -651,23 +674,9 @@
 		# remove all absolute paths upto collect folder from <Metadata /> elements
 		$model_contents =~ s@(<Metadata name=\"[^\"]*\">(http:\/\/)?).*(collect[\\\/]$strColName)@$1$3@g;
-		$test_contents =~ s@(<Metadata name=\"[^\"]*\">(http:\/\/)?).*(collect[\\\/]$strColName)@$1$3@g;
-
-
-			# equalise/normalise the two doc.xml files for OS differences, if there are any
-			my $testIsWin = &isDocXMLFileWindows($test_contents);
-			my $modelIsWin = &isDocXMLFileWindows($model_contents);
-			
-			if($testIsWin != $modelIsWin) { # one of the 2 collections is built on windows, the other on linux, so need to make newlines constant
-			
-				my $win_contents = $testIsWin ? \$test_contents : \$model_contents;
-			
-				# make all windows slashes into unix slashes
-				$$win_contents =~ s@\\@\/@g;
-				# make windows \r newlines into constant \n newlines		
-				$$win_contents =~ s@\r\n@\n@mg; # #http://stackoverflow.com/questions/650743/in-perl-how-to-do-you-remove-m-from-a-file
-				
-				#FOR MAC: old macs use CR carriage return (see http://www.perlmonks.org/?node_id=745018), so replace with \n?)
-				# $$win_contents =~ s@\r@\n@mg;
-			}
+		$test_contents =~ s@(<Metadata name=\"[^\"]*\">(http:\/\/)?).*(collect[\\\/]$strColName)@$1$3@g;	
+		
+#		my $savepath = &getcwd."/../"; # TASK_HOME env var does not exist at this stage, but it's one level up from current directory		
+#		&gdbdiff::print_string_to_file($model_contents, $savepath."model_doc.xml");
+#		&gdbdiff::print_string_to_file($test_contents, $savepath."test_doc.xml");
 		
 		$strResult = diff \$model_contents, \$test_contents, { STYLE => "OldStyle" };
Index: /other-projects/nightly-tasks/diffcol/trunk/diffcol/gdbdiff.pm
===================================================================
--- /other-projects/nightly-tasks/diffcol/trunk/diffcol/gdbdiff.pm	(revision 27742)
+++ /other-projects/nightly-tasks/diffcol/trunk/diffcol/gdbdiff.pm	(revision 27743)
@@ -59,5 +59,5 @@
     my $test_text = readin_gdb($test_cmd);
 
-#	my $savepath = &getcwd."/../"; # TASK_HOME env does not exist at this stage, but it's one level up from current directory
+#	my $savepath = &getcwd."/../"; # TASK_HOME env var does not exist at this stage, but it's one level up from current directory
 #	print_string_to_file($test_text, $savepath.$dbname."_test.out");	
 #	print_string_to_file($model_text, $savepath.$dbname."_model.out");
@@ -92,6 +92,8 @@
 			# Better regex is of the form /BEGIN((?:(?!BEGIN).)*)END/, see http://docstore.mik.ua/orelly/perl/cookbook/ch06_16.htm
 
-			$model_text =~ s@^([^\\//]*).*(\\|/)(collect(\\|/)$strColName)(.*)$@$1$3$5@mg;			
-			$test_text =~ s@^([^\\//]*).*(\\|/)(collect(\\|/)$strColName)(.*)$@$1$3$5@mg;						
+			$model_text =~ s@^([^\\/]*(//)*).*(\\|/)(collect(\\|/)$strColName)(.*)$@$1$4$6@mg;
+			$test_text =~ s@^([^\\/]*(//)*).*(\\|/)(collect(\\|/)$strColName)(.*)$@$1$4$6@mg;
+			#$model_text =~ s@^([^\\//]*).*(\\|/)(collect(\\|/)$strColName)(.*)$@$1$3$5@mg;			
+			#$test_text =~ s@^([^\\//]*).*(\\|/)(collect(\\|/)$strColName)(.*)$@$1$3$5@mg;						
 	}
 	
@@ -116,9 +118,10 @@
 			for my $line (split /^/, $$win_text) { # split the string into newlines
 				
-				if($line =~ m@^<assoc-file>(.*)(\s+)@s) {
-					$line = $1; # may be a short file name
+				# assoc-file and meta-file contain filepaths, ensure these are long windows file paths now (will later convert to linux slashes)	
+				if($line =~ m@^<(assoc-file|meta-file)>(.*)(\s+)@s) { 
+					$line = $2; # may be a short file name
 					# perhaps test here if it is a shortfilename? should match /CAPS....~number(.ext)/
 				
-					$line = "<assoc-file>".&Win32::GetLongPathName($line)."$2"; # make it a long file name and prefix assoc-file to it again					
+					$line = "<$1>".&Win32::GetLongPathName($line)."$3"; # make it a long file name and prefix assoc-file/meta-file tagname to it again					
 				}
 				$tmp .= $line;
@@ -127,10 +130,36 @@
 		}
 		
-		# slashes in windows text need to be turned into linux style slashes
-		$$win_text =~ s@\\@/@g;
+		
+		# index gdb file
+		if($dbname =~ m/$strColName/) {
+			my $tmp = ""; # rebuild windows file's set of lines after processing them one by one
+			for my $line (split /^/, $$win_text) { # split the string into newlines
+				
+				if($line =~ m@^<ex.File.Directory>(.*)@s) { # word-pdf collection contains double windows backslashes
+					(my $escaped_path = $1) =~ s@\\\\@\\@g;				
+					$line = "<ex.File.Directory>$escaped_path";
+				} 
+				elsif($line =~ m@^<Title>(.*)@s) {
+#					print STDERR "***** TITLE: |$1|\n";
+				
+					# word-pdf collection: Title of ps files contain new lines at end when
+					# GreenstoneXMLPlugin::xml_end_tag() writes the Title back out after utf8 decode
+					# if($metadata_name eq "Title") { $metadata_value =~ s/[\n\r]*$//; }
+				
+					(my $title = $1) =~ s@(\r|\n|\\n)*$@@; # get rid of trailing newlines/carriage returns
+					$line = "<Title>$title\n"; # add single newline					
+				}
+				$tmp .= $line;
+			}
+			$$win_text = $tmp;			
+		}
+		
+		
+		# slashes in windows metadata text need to be turned into linux style slashes
+		$$win_text =~ s@\\@/@g; #$$win_text =~ s@\\([^n|r|\|"])@/$1@g; # filepath something\rtf remains something\rtf
 		
 		# cut down absolute paths to files to just collect/colname/.../file, same as before
-		$$lin_text =~ s@^([^\\//]*).*(\\|/)(collect(\\|/)$strColName)(.*)$@$1$3$5@mg;
-		$$win_text =~ s@^([^\\//]*).*(\\|/)(collect(\\|/)$strColName)(.*)$@$1$3$5@mg;
+		$$lin_text =~ s@^([^\\/]*(//)*).*(\\|/)(collect(\\|/)$strColName)(.*)$@$1$4$6@mg; # $$lin_text =~ s@^([^\\\/]*(//)?).*(\\|/)(collect(\\|/)$strColName)(.*)$@$1$4$6@mg;
+		$$win_text =~ s@^([^\\/]*(//)*).*(\\|/)(collect(\\|/)$strColName)(.*)$@$1$4$6@mg;		
 		
 		# for the windows text, need to further get rid of the driveletter after [ or <meta>
@@ -166,7 +195,7 @@
 	my ($dbtailname, $db_contents) = @_; # db filename without suffix
 	
-	if($dbtailname !~ m/archiveinf/) { # only archiveinf-doc and archive-inf source need special Windows processing, not col.gdb
-		return 0;
-	}
+	#if($dbtailname !~ m/archiveinf/) { # only archiveinf-doc and archive-inf source need special Windows processing, not col.gdb
+	#	return 0;
+	#}
 	return ($db_contents =~ m/\\/) ? 1 : 0; # windows slashes detected. Better test would be: [Something\something] OR <tag>something\something
 	# for doc.xml:
Index: /other-projects/nightly-tasks/diffcol/trunk/task.pl
===================================================================
--- /other-projects/nightly-tasks/diffcol/trunk/task.pl	(revision 27742)
+++ /other-projects/nightly-tasks/diffcol/trunk/task.pl	(revision 27743)
@@ -417,5 +417,5 @@
     for my $collection (readdir $collect_handle) {
 	next if ($collection eq "." || $collection eq "..");
-	##next if ($collection ne "Small-HTML"); ## TEMPORARY, FOR TESTING THIS SCRIPT
+#	next if ($collection ne "Word-PDF-Basic"); ## TEMPORARY, FOR TESTING THIS SCRIPT
 
 	#escape the filename (in case of space)
