Continue cleaning.

This commit is contained in:
jmsgrogan 2023-01-13 14:29:12 +00:00
parent cd688f608f
commit cb4212d972
67 changed files with 367 additions and 282 deletions

View file

@ -32,7 +32,7 @@ bool MarkdownParser::isInMultilineBlock() const
return working_type == MarkdownElement::Type::MULTILINE_QUOTE || working_type == MarkdownElement::Type::CUSTOM_MULTILINE ;
}
unsigned MarkdownParser::checkForLink(const std::string& lineSection)
std::size_t MarkdownParser::checkForLink(const std::string& lineSection)
{
if (lineSection.empty())
{
@ -40,7 +40,7 @@ unsigned MarkdownParser::checkForLink(const std::string& lineSection)
}
std::vector<std::string> hits;
unsigned hit_size{0};
std::size_t hit_size{0};
if (Lexer::matchPattern("[@](@)", lineSection, '@', hits))
{
if (hits.size() == 2)
@ -59,7 +59,7 @@ unsigned MarkdownParser::checkForLink(const std::string& lineSection)
return hit_size;
}
unsigned MarkdownParser::checkForImage(const std::string& lineSection)
std::size_t MarkdownParser::checkForImage(const std::string& lineSection)
{
if (lineSection.empty())
{
@ -67,7 +67,7 @@ unsigned MarkdownParser::checkForImage(const std::string& lineSection)
}
std::vector<std::string> hits;
unsigned hit_size{0};
std::size_t hit_size{0};
if (Lexer::matchPattern("![@](@)", lineSection, '@', hits))
{
if (hits.size() == 2)
@ -85,7 +85,7 @@ unsigned MarkdownParser::checkForImage(const std::string& lineSection)
return hit_size;
}
unsigned MarkdownParser::checkForInlineQuote(const std::string& lineSection)
std::size_t MarkdownParser::checkForInlineQuote(const std::string& lineSection)
{
if (lineSection.empty())
{
@ -93,7 +93,7 @@ unsigned MarkdownParser::checkForInlineQuote(const std::string& lineSection)
}
std::vector<std::string> hits;
unsigned hit_size{0};
std::size_t hit_size{0};
if (Lexer::matchPattern("`@`", lineSection, '@', hits))
{
if (hits.size() == 1)
@ -111,7 +111,8 @@ unsigned MarkdownParser::checkForInlineQuote(const std::string& lineSection)
}
return hit_size;
}
unsigned MarkdownParser::checkForCustomInline(const std::string& lineSection)
std::size_t MarkdownParser::checkForCustomInline(const std::string& lineSection)
{
if (lineSection.empty())
{
@ -119,9 +120,9 @@ unsigned MarkdownParser::checkForCustomInline(const std::string& lineSection)
}
std::vector<std::string> hits;
unsigned hit_size{0};
std::size_t hit_size{0};
for(unsigned idx=0; idx<mWorkingDocument->getNumInlineContexts(); idx++)
for(std::size_t idx=0; idx<mWorkingDocument->getNumInlineContexts(); idx++)
{
const auto delimiter = mWorkingDocument->getInlineContext(idx)->getDelimiter();
if (Lexer::matchPattern(delimiter + "@" + delimiter, lineSection, '@', hits))
@ -193,7 +194,7 @@ void MarkdownParser::processLine(const std::string& line)
}
}
unsigned line_position = 0;
std::size_t line_position = 0;
mWorkingLine.clear();
while(line_position < line.size())
{
@ -308,11 +309,11 @@ void MarkdownParser::onFoundHeading(const std::string& line)
{
onSectionFinished();
unsigned level = StringUtils::countFirstConsecutiveHits(line, HEADING_DELIMITER);
auto level = StringUtils::countFirstConsecutiveHits(line, HEADING_DELIMITER);
auto heading = std::make_unique<MarkdownHeading>(level);
std::string prefix;
for(unsigned idx=0; idx<level; idx++)
for(std::size_t idx=0; idx<level; idx++)
{
prefix += HEADING_DELIMITER;
}

View file

@ -25,10 +25,10 @@ public:
private:
void addChildToWorkingElement(std::unique_ptr<MarkdownInlineElement> child);
unsigned checkForImage(const std::string& lineSection);
unsigned checkForLink(const std::string& lineSection);
unsigned checkForInlineQuote(const std::string& lineSection);
unsigned checkForCustomInline(const std::string& lineSection);
std::size_t checkForImage(const std::string& lineSection);
std::size_t checkForLink(const std::string& lineSection);
std::size_t checkForInlineQuote(const std::string& lineSection);
std::size_t checkForCustomInline(const std::string& lineSection);
bool isInMultilineBlock() const;