Changeset 291


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

added support for link of type comment:ticket:180:4 refs #180

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Trac.cc

    r290 r291  
    4444      if (ticket(first, str.end()))
    4545        continue;
     46      if (comment(first, str.end()))
     47        continue;
    4648      hs_ << *first;
    4749      ++first;
    4850    }
     51  }
     52
     53
     54  bool Trac::comment(std::string::const_iterator& first,
     55                     const std::string::const_iterator& last)
     56  {
     57    if (first==last)
     58      return false;
     59
     60    const std::string::const_iterator first_orig(first);
     61    if (match(first, last, "comment:ticket:").empty()){
     62      first = first_orig;
     63      return false;
     64    }
     65     
     66    std::string ticket = match(first, last, Digit());
     67    if (ticket.empty() || first == last || *first != ':') {
     68      first = first_orig;
     69      return false;
     70    }
     71    ++first;
     72    std::string comment = match(first, last, Digit());
     73    if (comment.empty() ) {
     74      first = first_orig;
     75      return false;
     76    }
     77    std::string href(Configuration::instance().trac_root()+"ticket/"+ticket+
     78                     "#comment:"+comment);
     79    std::string str(first_orig, first);
     80    hs_.stream() << anchor(href, str);
     81    return true;
     82
     83
     84    const Configuration& conf = Configuration::instance();
     85    hs_.stream() << anchor(conf.trac_root()+"ticket/"+ticket,"#"+ticket);
     86    return true;
     87
    4988  }
    5089
     
    128167    ++first;
    129168    std::string rev = match(first, last, Digit());
     169    if (rev.empty() ) {
     170      first = first_orig;
     171      return false;
     172    }
    130173    std::string href(Configuration::instance().trac_root()+"log"+node+
    131174                     "?rev="+rev+"&stop_rev="+stop_rev);
Note: See TracChangeset for help on using the changeset viewer.