Changeset 761 for branches/0.6-stable/lib
- Timestamp:
- Jan 29, 2009, 1:46:49 PM (14 years ago)
- Location:
- branches/0.6-stable/lib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/0.6-stable/lib/Trac.cc
r731 r761 50 50 51 51 52 bool Trac::changeset(std::string::const_iterator& first, 52 bool Trac::changeset(const std::string::const_iterator& first, 53 std::string::const_iterator& iter, 53 54 const std::string::const_iterator& last, 54 55 const std::string::const_iterator& last_trunc) 55 56 { 56 if (changeset1(first, last, last_trunc))57 return true; 58 if (changeset2( first, last, last_trunc))59 return true; 60 if (changeset3( first, last, last_trunc))57 if (changeset1(first, iter, last, last_trunc)) 58 return true; 59 if (changeset2(iter, last, last_trunc)) 60 return true; 61 if (changeset3(iter, last, last_trunc)) 61 62 return true; 62 63 return false; … … 64 65 65 66 66 bool Trac::changeset1(std::string::const_iterator& first, 67 bool Trac::changeset1(const std::string::const_iterator& first, 68 std::string::const_iterator& iter, 67 69 const std::string::const_iterator& last, 68 70 const std::string::const_iterator& last_trunc) 69 71 { 70 if (first==last) 71 return false; 72 if (*first != 'r') 73 return false; 74 const std::string::const_iterator first_orig(first); 75 ++first; 76 std::string rev = match(first, last, Digit()); 77 if (rev.empty()){ 78 first = first_orig; 72 if (iter==last) 73 return false; 74 if (*iter != 'r') 75 return false; 76 if (iter!=first && isalnum(*(iter-1))) 77 return false; 78 const std::string::const_iterator iter_orig(iter); 79 ++iter; 80 std::string rev = match(iter, last, Digit()); 81 if (rev.empty() || (iter!=last && (std::isalnum(*iter) || *iter==':')) ){ 82 iter = iter_orig; 79 83 return false; 80 84 } 81 85 std::string href(Configuration::instance().trac_root()+"changeset/"+rev); 82 hs_.stream() << anchor(href, anchor_text( first_orig, first, last_trunc));86 hs_.stream() << anchor(href, anchor_text(iter_orig, iter, last_trunc)); 83 87 return true; 84 88 } … … 290 294 291 295 292 bool Trac::log(std::string::const_iterator& first, 296 bool Trac::log(const std::string::const_iterator& first, 297 std::string::const_iterator& iter, 293 298 const std::string::const_iterator& last, 294 299 const std::string::const_iterator& last_trunc) 295 300 { 296 if (log1(first, last, last_trunc))297 return true; 298 if (log2( first, last, last_trunc))299 return true; 300 if (log3( first, last, last_trunc))301 if (log1(first, iter, last, last_trunc)) 302 return true; 303 if (log2(iter, last, last_trunc)) 304 return true; 305 if (log3(iter, last, last_trunc)) 301 306 return true; 302 307 return false; … … 304 309 305 310 306 bool Trac::log1(std::string::const_iterator& first, 311 bool Trac::log1(const std::string::const_iterator& first, 312 std::string::const_iterator& iter, 307 313 const std::string::const_iterator& last, 308 314 const std::string::const_iterator& last_trunc) 309 315 { 310 if (first==last) 311 return false; 312 313 const std::string::const_iterator first_orig(first); 314 if (*first != 'r') 315 return false; 316 ++first; 317 318 std::string stop_rev = match(first, last, AlNum()); 319 if (stop_rev.empty() || first == last || *first != ':') { 320 first = first_orig; 321 return false; 322 } 323 ++first; 324 std::string rev = match(first, last, AlNum()); 325 if (rev.empty() ) { 326 first = first_orig; 316 if (iter==last) 317 return false; 318 319 const std::string::const_iterator iter_orig(iter); 320 if (*iter != 'r') 321 return false; 322 if (iter!=first && isalnum(*(iter-1))) 323 return false; 324 ++iter; 325 326 std::string stop_rev = match(iter, last, Digit()); 327 if (stop_rev.empty() || iter == last || *iter != ':') { 328 iter = iter_orig; 329 return false; 330 } 331 ++iter; 332 std::string rev = match(iter, last, Digit()); 333 if (rev.empty() || (iter!=last && std::isalnum(*iter) ) ){ 334 iter = iter_orig; 327 335 return false; 328 336 } 329 337 std::string href(Configuration::instance().trac_root()+"log/?rev="+ 330 338 rev+"&stop_rev="+stop_rev); 331 hs_.stream() << anchor(href, anchor_text( first_orig,first, last_trunc));339 hs_.stream() << anchor(href, anchor_text(iter_orig,iter, last_trunc)); 332 340 return true; 333 341 } … … 447 455 last_trunc = first+width; 448 456 while (first<last_trunc) { 449 if (log( first, str.end(), last_trunc))457 if (log(str.begin(), first, str.end(), last_trunc)) 450 458 continue; 451 459 if (comment(first, str.end(), last_trunc)) … … 453 461 if (ticket(first, str.end(), last_trunc)) 454 462 continue; 455 if (changeset( first, str.end(), last_trunc))463 if (changeset(str.begin(), first, str.end(), last_trunc)) 456 464 continue; 457 465 if (diff(first, str.end(), last_trunc)) -
branches/0.6-stable/lib/Trac.h
r731 r761 60 60 /// @return true if any of changesetX returns true 61 61 /// 62 bool changeset(std::string::const_iterator& first, 62 bool changeset(const std::string::const_iterator& first, 63 std::string::const_iterator& iter, 63 64 const std::string::const_iterator& last, 64 65 const std::string::const_iterator& last_trunc); … … 68 69 /// 69 70 /// Search in range [\a first, \a last) for expression 70 /// /r(\d+)/. If expression is found an anchor to 71 /// trac-root/changeset/123, displaying expression, and first is 72 /// pointing to character after expression. 73 /// 74 /// @return true if expression is found 75 /// 76 bool changeset1(std::string::const_iterator& first, 71 /// /r(\d+)/. In addition character before cannot be 72 /// alpha-numeric, and character after expression cannot be 73 /// alpha-numeric or ':' (beginning/end of string is allowed). If 74 /// expression is found an anchor to trac-root/changeset/123, 75 /// displaying expression, and first is pointing to character 76 /// after expression. 77 /// 78 /// @return true if expression is found 79 /// 80 bool changeset1(const std::string::const_iterator& first, 81 std::string::const_iterator& iter, 77 82 const std::string::const_iterator& last, 78 83 const std::string::const_iterator& last_trunc); … … 189 194 /// @return true if any of logX returns true 190 195 /// 191 bool log(std::string::const_iterator& first, 196 bool log(const std::string::const_iterator& first, 197 std::string::const_iterator& iter, 192 198 const std::string::const_iterator& last, 193 199 const std::string::const_iterator& last_trunc); … … 197 203 /// 198 204 /// Search in range [\a first, \a last) for expression 199 /// /r(\w+):(\w+)/. If expression is found an 200 /// anchor is created, displaying the expression, and first is 201 /// pointing to character after expression. 205 /// /r(\d+):(\d+)/. In addition character before and after 206 /// expression cannot be alpha-numeric (beginning/end of string is 207 /// allowed). If expression is found an anchor is created, 208 /// displaying the expression, and iter is pointing to character 209 /// after expression. 202 210 /// 203 211 /// The created anchor goes to trac-root/log/?rev=236&stop_rev=123 … … 205 213 /// @return true if expression is found 206 214 /// 207 bool log1(std::string::const_iterator& first, 215 bool log1(const std::string::const_iterator& first, 216 std::string::const_iterator& iter, 208 217 const std::string::const_iterator& last, 209 218 const std::string::const_iterator& last_trunc);
Note: See TracChangeset
for help on using the changeset viewer.