+ add a stub HTML header/footer if the content only have the <body>

.--Cette ligne, et les suivantes ci-dessous, seront ignorées--

M    reader.cpp
This commit is contained in:
kelson42 2010-07-16 18:14:32 +00:00
parent c9a81bf79b
commit d968ac7114
1 changed files with 7 additions and 1 deletions

View File

@ -167,6 +167,12 @@ namespace kiwix {
/* Get the data */ /* Get the data */
content = string(article.getData().data(), article.getArticleSize()); content = string(article.getData().data(), article.getArticleSize());
/* Try to set a stub HTML header/footer if necesssary */
if (contentType == "text/html" && std::string::npos == content.find("<body>")) {
cout << content << endl;
content = "<html><head><title>" + article.getTitle() + "</title><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /></head><body>" + content + "</body></html>";
}
/* Get the data length */ /* Get the data length */
contentLength = article.getArticleSize(); contentLength = article.getArticleSize();