Initial site generation

This commit is contained in:
James Grogan 2022-12-05 17:50:49 +00:00
parent f44c79dc1f
commit fc44290e3f
35 changed files with 667 additions and 303 deletions

View file

@ -1,6 +1,8 @@
#include "MarkdownDocument.h"
#include "MarkdownElement.h"
#include "MarkdownComponents.h"
void MarkdownDocument::addElement(std::unique_ptr<MarkdownElement> element)
{
@ -16,3 +18,25 @@ MarkdownElement* MarkdownDocument::getElement(std::size_t idx) const
{
return mElements[idx].get();
}
void MarkdownDocument::doLinkTargetSubstitution(const std::string& targetString, const std::string& replacementString)
{
for(auto& element : mElements)
{
element->doFieldSubstitution(MarkdownElement::Type::LINK, targetString, replacementString);
}
}
std::vector<MarkdownLink*> MarkdownDocument::getAllLinks() const
{
std::vector<MarkdownLink*> links;
for(auto& element : mElements)
{
if (element->getType() == MarkdownElement::Type::PARAGRAPH)
{
auto para_links = dynamic_cast<MarkdownParagraph*>(element.get())->getAllLinks();
links.insert(links.end(), para_links.begin(), para_links.end());
}
}
return links;
}