stuff-from-scratch/apps/website-generator/MarkdownContentParser.h

23 lines
543 B
C
Raw Normal View History

2022-10-03 07:46:41 +00:00
#pragma once
#include <string>
#include <optional>
2022-10-04 07:20:39 +00:00
#include <unordered_map>
#include <filesystem>
#include <vector>
using Path = std::filesystem::path;
class MarkdownDocument;
2022-10-03 07:46:41 +00:00
class MarkdownContentParser
{
public:
using FileMetadataItem = std::pair<std::string, std::string>;
2022-10-04 07:20:39 +00:00
using FileMetadata = std::unordered_map<std::string, std::string>;
2022-10-03 07:46:41 +00:00
std::pair<FileMetadata, std::unique_ptr<MarkdownDocument>> run(const Path& path);
2022-10-03 07:46:41 +00:00
private:
2022-10-09 16:39:46 +00:00
std::optional<FileMetadataItem> checkForMetadataItem(const std::string& line) const;
2022-10-03 07:46:41 +00:00
};