Some markdown processing.
This commit is contained in:
parent
31b479e9f6
commit
ec11529b9a
23 changed files with 677 additions and 135 deletions
|
@ -1,8 +1,15 @@
|
|||
#include "DocumentConverter.h"
|
||||
|
||||
#include "MarkdownParser.h"
|
||||
#include "MarkdownDocument.h"
|
||||
#include "MarkdownConverter.h"
|
||||
|
||||
#include "HtmlDocument.h"
|
||||
#include "HtmlWriter.h"
|
||||
|
||||
#include "FileLogger.h"
|
||||
#include "File.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
DocumentConverter::DocumentConverter()
|
||||
|
@ -55,19 +62,14 @@ void DocumentConverter::markdownToHtml(File* input, File* output)
|
|||
input->open(File::AccessMode::Read);
|
||||
|
||||
MarkdownParser parser;
|
||||
|
||||
auto handle = input->getInHandle();
|
||||
while(handle->good())
|
||||
{
|
||||
std::string line;
|
||||
std::getline(*handle, line);
|
||||
parser.processLine(line);
|
||||
};
|
||||
auto md_doc = parser.run(input->readText());
|
||||
input->close();
|
||||
|
||||
auto html_document = parser.getHtml();
|
||||
MarkdownConverter converter;
|
||||
auto html_doc = converter.convert(md_doc.get());
|
||||
|
||||
HtmlWriter writer;
|
||||
std::string html_string = writer.toString(html_document.get());
|
||||
std::string html_string = writer.toString(html_doc.get());
|
||||
|
||||
output->open(File::AccessMode::Write);
|
||||
*(output->getOutHandle()) << html_string;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue