64 lines
1.2 KiB
C++
64 lines
1.2 KiB
C++
#pragma once
|
|
|
|
#include "MarkdownContentParser.h"
|
|
#include "File.h"
|
|
|
|
#include <string>
|
|
#include <iostream>
|
|
#include <unordered_map>
|
|
|
|
class MarkdownDocument;
|
|
|
|
class ContentFile
|
|
{
|
|
public:
|
|
using FileMetadata = std::unordered_map<std::string, std::string>;
|
|
using FileContentBody = std::vector<std::string>;
|
|
|
|
ContentFile(const Path& filename);
|
|
|
|
virtual ~ContentFile();
|
|
|
|
Path getFilename() const;
|
|
|
|
virtual void load();
|
|
|
|
std::string getMetadataItem(const std::string& key) const;
|
|
|
|
virtual std::string getOutputLocation() const;
|
|
|
|
MarkdownDocument* getContentBody() const
|
|
{
|
|
return mContentBody.get();
|
|
}
|
|
|
|
void doLinkTagSubstitution(const Path& basePath);
|
|
|
|
void write(const Path& path);
|
|
|
|
void setProcessedOutput(const std::string& output)
|
|
{
|
|
mProcessedOutput = output;
|
|
}
|
|
protected:
|
|
Path mFilename;
|
|
FileMetadata mMetadata;
|
|
std::unique_ptr<MarkdownDocument> mContentBody;
|
|
std::string mProcessedOutput;
|
|
};
|
|
|
|
class ContentArticle : public ContentFile
|
|
{
|
|
public:
|
|
|
|
ContentArticle(const Path& filename)
|
|
: ContentFile(filename)
|
|
{
|
|
|
|
}
|
|
|
|
void load() override
|
|
{
|
|
ContentFile::load();
|
|
}
|
|
};
|