5 // utility functions for Biaweb that don't fit into any class and can be used by
8 // convert a document title to a file title - strip out the non-alpha
10 std::string convert_title (std::string title)
13 for (char c : title) {
17 output.append (1, '_');
22 // escape HTML special characters
23 std::string escape_html (std::string source)
25 std::string replace_buf;
26 replace_buf.reserve (source.size());
31 case '&' : replace_buf.append ("&"); break;
32 case '<' : replace_buf.append ("<"); break;
33 case '>' : replace_buf.append (">"); break;
34 case '\"': replace_buf.append ("""); break;
35 case '\'': replace_buf.append ("'"); break;
36 default : replace_buf.append (1, p);