Changeset 1155
- Timestamp:
- Aug 9, 2010, 5:41:59 AM (12 years ago)
- Location:
- trunk/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Configuration.cc
r1154 r1155 31 31 #include <algorithm> 32 32 #include <cassert> 33 #include <cstdlib> 33 34 #include <fstream> 34 35 #include <map> … … 216 217 else { 217 218 throw Config_error(line, ""); 219 } 220 } 221 else if (lhs=="tab_size") { 222 tab_size_ = strtoul(rhs.c_str(), NULL, 10); 223 if (tab_size_==0) { 224 throw Config_error(line, 225 "invalid value: tab_size must be a positive integer"); 226 } 227 else if (tab_size_ == ULONG_MAX) { 228 throw Config_error(line, "invalid value: out of range"); 218 229 } 219 230 } … … 482 493 missing_copyright_warning_=false; 483 494 trac_root_ = ""; 495 tab_size_ = 2; 484 496 485 497 add_codon("*.ac", "#", "\n"); … … 561 573 562 574 575 size_t Configuration::tab_size(void) const 576 { 577 return tab_size_; 578 } 579 580 563 581 std::string Configuration::trac_root(void) const 564 582 { … … 602 620 else 603 621 os << "no\n"; 622 os << "# svndigest uses this value to replace tabs " 623 << "with spaces in blame output\n" 624 << "tab_size = " << conf.tab_size() << "\n"; 625 604 626 605 627 os << "\n### Section for setting behaviour of copyright update\n" -
trunk/lib/Configuration.h
r1154 r1155 128 128 const std::map<std::string, std::string>& 129 129 svn_properties(const std::string& filename) const; 130 131 /** 132 \return size of a tab, i.e., how many spaces are ued to display 133 a space (in blame output) 134 */ 135 size_t tab_size(void) const; 130 136 131 137 /// … … 209 215 bool output_file_; 210 216 std::string trac_root_; 217 size_t tab_size_; 211 218 212 219 typedef std::map<std::string, std::string> str_map; -
trunk/lib/HtmlBuf.cc
r992 r1155 23 23 #include "HtmlBuf.h" 24 24 25 #include "Configuration.h" 26 25 27 #include <cstdio> 26 28 #include <iostream> … … 40 42 map_['&']=std::string("&"); 41 43 map_[' ']=std::string(" "); 42 // This should be configurable, but for now indentation is two spaces. 43 map_['\t']=std::string(" "); 44 std::string str; 45 for (size_t i=0; i<Configuration::instance().tab_size(); ++i) 46 str += " "; 47 map_['\t']=str; 44 48 } 45 49
Note: See TracChangeset
for help on using the changeset viewer.