mirror of
https://github.com/szymon-jozef/static-site-generator.git
synced 2026-09-07 12:10:42 +02:00
rename replace to replace_once
This commit is contained in:
@@ -3,8 +3,8 @@
|
|||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
static bool replace(std::string &str, const std::string &from,
|
static bool replace_once(std::string &str, const std::string &from,
|
||||||
const std::string &to) {
|
const std::string &to) {
|
||||||
size_t start_pos = str.find(from);
|
size_t start_pos = str.find(from);
|
||||||
if (start_pos == std::string::npos)
|
if (start_pos == std::string::npos)
|
||||||
return false;
|
return false;
|
||||||
@@ -23,7 +23,7 @@ std::string inject_html_into_template(const std::string &FILE_NAME,
|
|||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
ss << file.rdbuf();
|
ss << file.rdbuf();
|
||||||
result = ss.str();
|
result = ss.str();
|
||||||
if (replace(result, TEMPLATE, HTML)) {
|
if (replace_once(result, TEMPLATE, HTML)) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
|
|||||||
Reference in New Issue
Block a user