23 #include <webview/formatters/tracwiki.h> 25 #include <core/exception.h> 46 if ( regcomp(&__re_heading,
"^(=+) (.*) \\1$", REG_EXTENDED) != 0 ) {
47 throw Exception(
"Failed to compile heading regex");
56 regfree(&__re_heading);
69 bool in_paragraph =
false;
71 std::istringstream iss(text);
72 while (!iss.eof() && !iss.fail()) {
75 const char *sl = line.c_str();
78 regmatch_t matches[num_matches];
85 }
else if (regexec(&__re_heading, sl, num_matches, matches, 0) == 0) {
86 unsigned int h_depth = matches[1].rm_eo - matches[1].rm_so;
93 char title[matches[2].rm_eo - matches[2].rm_so + 1];
94 title[matches[2].rm_eo - matches[2].rm_so] = 0;
95 strncpy(title, &line.c_str()[matches[2].rm_so],
96 matches[2].rm_eo - matches[2].rm_so);
98 if (asprintf(&tmp,
"<h%u>%s</h%u>\n", h_depth, title, h_depth) != -1) {
114 in_paragraph =
false;
Fawkes library namespace.
Base class for exceptions in Fawkes.