Skip to content

Commit

Permalink
Merging horizontal rule to main
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuali7536 committed Sep 29, 2021
2 parents ce8f1db + 5d4b2a5 commit ca45d34
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions LennahSSG/LennahSSG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ void version_message();
void readTxt(string path);
string italicize(string itLine);
string boldify(string boldLine);
string trim(string line);
string inlineCode(string line);
int fileType = 0;

Expand Down Expand Up @@ -178,6 +179,10 @@ static void readTxt(string path) {
if (line.find("`") != string::npos) {
line = inlineCode(line);
}

if (trim(line) == "---") {
line = "<hr>";
}
}

//format <p> tags
Expand Down Expand Up @@ -237,6 +242,14 @@ string boldify(string boldLine) {
}
return boldLine;
}
string trim(string line)
{
const char* WhiteSpace = " \t\v\r\n";
size_t start = line.find_first_not_of(WhiteSpace);
size_t end = line.find_last_not_of(WhiteSpace);
return start == end ? string() : line.substr(start, end - start + 1);
}
}
string inlineCode(string line) {
while (line.find("`") != string::npos) {
if (line.find("`") != string::npos && line.find("`") != line.find_last_of("`")) {
Expand Down

0 comments on commit ca45d34

Please sign in to comment.