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