diff --git a/src/Article.cxx b/src/Article.cxx index 6f331af..239d9fc 100644 --- a/src/Article.cxx +++ b/src/Article.cxx @@ -50,13 +50,21 @@ namespace Article { size_t det_article_pos = 0; bool reading_metadata = false, done = false, - skip = false; + skip = false, + ignore_line = false; std::list cfg_lines = { "" }; while (fgets(buf, buflen, a) != NULL) { // Ignore blank lines or lines starting with a comment. - if (buf[0] == '\n' || buf[0] == '#') continue; + if (buf[0] == '#') { + ignore_line = true; + continue; + } else if (buf[0] == '\n') { + if (ignore_line) + ignore_line = false; + continue; + } int eol = -1; for (int c = 0; c < buflen; c++) { // Check if this loop has already done what it's supposed to do by checking if the title has been set. @@ -93,6 +101,13 @@ namespace Article { if (skip) { skip = false; continue; } if (done) break; if (reading_metadata) { + if (ignore_line && eol == -1) + continue; + else if (ignore_line && eol > -1) { + ignore_line = false; + cfg_lines.insert(cfg_lines.end(), ""); + continue; + } if (eol > -1) { buf[eol] = '\0'; *(--cfg_lines.end()) += buf; @@ -104,6 +119,7 @@ namespace Article { bool reading_article_metadata = false; for (std::string const &line : cfg_lines) { + std::cout << "[!] " << line << "\n"; // Check namespace if (reading_article_metadata) { std::string k_title = "Title=",