Index: string_api.php =================================================================== RCS file: /cvs/TPS/mantis/core/string_api.php,v retrieving revision 1.9 diff -u -r1.9 string_api.php --- string_api.php 19 Sep 2005 11:58:45 -0000 1.9 +++ string_api.php 29 Dec 2005 13:24:37 -0000 @@ -176,20 +176,33 @@ # -------------------- # process the $p_string and convert filenames in the format # cvs:filename.ext or cvs:filename.ext:n.nn to a html link + # filenames in the format cvs:filename.ext:n.nn:n.nn are + # converted to html links of diffs between the two versions # if $p_include_anchor is true, include an tag, # otherwise, just insert the URL as text function string_process_cvs_link( $p_string, $p_include_anchor=true ) { $t_cvs_web = config_get( 'cvs_web' ); + if ( $p_include_anchor ) { + $t_replace_with = '[CVS] \\1:\\4:\\6\\7'; + } else { + $t_replace_with = '[CVS] '.$t_cvs_web.'\\1?r1=\\4&r2=\\6\\7'; + } + + $new_string = preg_replace( '/cvs:([^\.\s:,\?!]+(\.[^\.\s:,\?!]+)*)(:)(\d\.[\d\.]+)(:)(\d\.[\d\.]+)([\W\s])?/i', + $t_replace_with, + $p_string ); + + if ( $p_include_anchor ) { - $t_replace_with = '[CVS] \\1\\5'; + $t_replace_with = '[CVS] \\1\\3\\5'; } else { $t_replace_with = '[CVS] '.$t_cvs_web.'\\1?rev=\\4\\5'; } - return preg_replace( '/cvs:([^\.\s:,\?!<]+(\.[^\.\s:,\?!<]+)*)(:)?(\d\.[\d\.]+)?([\W\s])?/i', + return preg_replace( '/cvs:([^\.\s:,\?!]+(\.[^\.\s:,\?!<]+)*)(:(\d\.[\d\.]+))?([\W\s])?/i', $t_replace_with, - $p_string ); + $new_string ); } # --------------------