Change performance doc generator to shorten path names.

Make sure all sections have names.
See #13001.
This commit is contained in:
jzmaddock
2017-08-01 08:18:05 +01:00
parent bc9b25b5d3
commit 9cfc6a4e30
4 changed files with 88 additions and 181 deletions

View File

@ -11,6 +11,7 @@
#include <boost/lexical_cast.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/functional/hash.hpp>
#include <vector>
#include <set>
#include <iostream>
@ -28,6 +29,12 @@ inline std::string sanitize_string(const std::string& s)
return result;
}
inline std::string sanitize_short_string(const std::string& s)
{
unsigned id = boost::hash<std::string>()(s);
return sanitize_string("id" + boost::lexical_cast<std::string>(id));
}
std::string format_precision(double val, int digits)
{
std::stringstream ss;
@ -320,7 +327,7 @@ void add_cell(boost::intmax_t val, const std::string& table_name, const std::str
//
// Add a section for this table as well:
//
std::string section_id = "section_" + sanitize_string(table_name);
std::string section_id = "section_" + sanitize_short_string(table_name);
if(content.find(section_id + "[]") == std::string::npos)
{
std::string new_section = "\n[template " + section_id + "[]\n[section:" + section_id + " " + table_name + "]\n[" + table_id + "]\n[endsect]\n]\n";