Changeset 1005 for trunk/lib


Ignore:
Timestamp:
Jan 3, 2010, 4:05:25 AM (12 years ago)
Author:
Peter Johansson
Message:

refs #405. Move replicated code to a function

Location:
trunk/lib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/Directory.cc

    r978 r1005  
    33/*
    44  Copyright (C) 2005, 2006, 2007, 2008, 2009 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2010 Peter Johansson
    56
    67  This file is part of svndigest, http://dev.thep.lu.se/svndigest
     
    190191      ss << imagedir << "/index.svg";
    191192    os << "<p class=\"plot\">\n";
    192     os << "<object data='" << ss.str() << "' type='image/svg+xml' width='600'>\n"
    193        << "<embed src='" << ss.str() << "' type='image/svg+xml' width='600' />\n"
    194        << "</object>\n";
     193    os << image("svg", ss.str());
    195194    os << "</p>\n";
    196195
  • trunk/lib/File.cc

    r978 r1005  
    33/*
    44  Copyright (C) 2005, 2006, 2007, 2008, 2009 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2010 Peter Johansson
    56
    67  This file is part of svndigest, http://dev.thep.lu.se/svndigest
     
    384385      ss << imagefile;
    385386    os << "<p class=\"plot\">\n";
    386     os << "<object data='" << ss.str() << "' type='image/svg+xml' width='600'>\n"
    387        << "<embed src='" << ss.str() << "' type='image/svg+xml' width='600' />\n"
    388        << "</object>\n";
     387    os << image("svg", ss.str());
    389388    os << "</p>\n";
    390389
  • trunk/lib/first_page.cc

    r978 r1005  
    44  Copyright (C) 2006 Peter Johansson
    55  Copyright (C) 2007, 2008, 2009 Jari Häkkinen, Peter Johansson
     6  Copyright (C) 2010 Peter Johansson
    67
    78  This file is part of svndigest, http://dev.thep.lu.se/svndigest
     
    232233    stats.plot_summary(name);
    233234    os << "<div class=\"main\">\n";
    234     os << "<object data='" << name << "' type='image/svg+xml' width='600'>\n"
    235        << "<embed src='" << name << "' type='image/svg+xml' width='600' />\n"
    236        << "</object>\n";
     235    os << image("svg", name);
    237236    os << "</div>";
    238237
  • trunk/lib/html_utility.cc

    r991 r1005  
    44  Copyright (C) 2006 Peter Johansson
    55  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    6   Copyright (C) 2009 Peter Johansson
     6  Copyright (C) 2009, 2010 Peter Johansson
    77
    88  This file is part of svndigest, http://dev.thep.lu.se/svndigest
     
    6161
    6262 
     63  std::string image(const std::string& format, const std::string& name)
     64  {
     65    std::ostringstream os;
     66    if (format=="svg")
     67      os << "<object data='" << name << "' type='image/svg+xml' width='600'>\n"
     68         << "<embed src='" << name << "' type='image/svg+xml' width='600' />\n"
     69         << "</object>\n";
     70    else {
     71      assert(false);
     72      throw std::runtime_error("unknown image format: " + format);
     73    }
     74    return os.str();
     75  }
     76
     77
    6378  void print_footer(std::ostream& os)
    6479  {
  • trunk/lib/html_utility.h

    r978 r1005  
    77  Copyright (C) 2006 Peter Johansson
    88  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    9   Copyright (C) 2009 Peter Johansson
     9  Copyright (C) 2009, 2010 Peter Johansson
    1010
    1111  This file is part of svndigest, http://dev.thep.lu.se/svndigest
     
    4747                     const std::string& title="",
    4848                     const std::string& color="");
     49
     50  /**
     51   */
     52  std::string image(const std::string& format, const std::string& name);
    4953
    5054  ///
Note: See TracChangeset for help on using the changeset viewer.