2022-10-03 07:46:41 +00:00
|
|
|
#pragma once
|
|
|
|
|
2023-12-21 09:18:44 +00:00
|
|
|
#include "String.h"
|
2022-10-03 07:46:41 +00:00
|
|
|
#include <optional>
|
2023-12-27 12:20:02 +00:00
|
|
|
#include Map.h
|
2022-12-05 13:16:10 +00:00
|
|
|
#include <filesystem>
|
2023-12-21 09:18:44 +00:00
|
|
|
#include "Vector.h"
|
2022-12-05 13:16:10 +00:00
|
|
|
|
|
|
|
using Path = std::filesystem::path;
|
|
|
|
|
|
|
|
class MarkdownDocument;
|
2022-10-03 07:46:41 +00:00
|
|
|
|
|
|
|
class MarkdownContentParser
|
|
|
|
{
|
|
|
|
public:
|
2023-12-21 09:18:44 +00:00
|
|
|
using FileMetadataItem = std::pair<String, String>;
|
2023-12-27 12:20:02 +00:00
|
|
|
using FileMetadata = Map<String, String>;
|
2022-10-03 07:46:41 +00:00
|
|
|
|
2023-12-21 09:18:44 +00:00
|
|
|
std::pair<FileMetadata, Ptr<MarkdownDocument>> run(const Path& path);
|
2022-10-03 07:46:41 +00:00
|
|
|
private:
|
2023-12-21 09:18:44 +00:00
|
|
|
std::optional<FileMetadataItem> checkForMetadataItem(const String& line) const;
|
2022-10-03 07:46:41 +00:00
|
|
|
};
|