Changeset 295 for trunk


Ignore:
Timestamp:
May 8, 2007, 8:47:00 PM (14 years ago)
Author:
Peter Johansson
Message:

refs #180 support milestone:0.6

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Trac.cc

    r294 r295  
    125125      if (diff(first, str.end()))
    126126        continue;
     127      if (milestone(first, str.end()))
     128        continue;
    127129      hs_ << *first;
    128130      ++first;
     
    168170
    169171
     172  bool Trac::milestone(std::string::const_iterator& first,
     173                       const std::string::const_iterator& last)
     174  {
     175    if (first==last)
     176      return false;
     177
     178    const std::string::const_iterator first_orig(first);
     179
     180    if (match(first, last, Str("milestone:")).empty()){
     181      first = first_orig;
     182      return false;
     183    }
     184
     185    const std::string::const_iterator milestone_begin;
     186
     187    // find the last alphanumerical char before next space (or last)
     188    for (std::string::const_iterator i(first); i!=last && *i!=' '; ++i)
     189      if (isalnum(*i))
     190        first = i;
     191
     192    std::string milestone(milestone_begin, first);
     193    if (milestone.empty()){
     194      first = first_orig;
     195      return false;
     196    }
     197
     198    const Configuration& conf = Configuration::instance();
     199    hs_.stream() << anchor(conf.trac_root()+"milestone/"+milestone,
     200                           std::string(first_orig, first));
     201    return true;
     202  }
     203
     204
    170205  bool Trac::ticket(std::string::const_iterator& first,
    171206                    const std::string::const_iterator& last)
     
    197232
    198233    const Configuration& conf = Configuration::instance();
    199     hs_.stream() << anchor(conf.trac_root()+"ticket/"+ticket,"#"+ticket);
     234    hs_.stream() << anchor(conf.trac_root()+"ticket/"+ticket,
     235                           std::string(first_orig, first));
    200236    return true;
    201237  }
Note: See TracChangeset for help on using the changeset viewer.