Adds wrapper to md4c code, fixes issues with previous commit
This commit is contained in:
parent
6d98202f38
commit
d19c822764
31 changed files with 175 additions and 1722 deletions
43
Src/blog.cpp
43
Src/blog.cpp
|
@ -1,45 +1,12 @@
|
|||
#include <stdio.h>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include "Libs/md4c-html.h"
|
||||
|
||||
#define MD4C_USE_UTF8
|
||||
|
||||
void SaveTextToFile(const MD_CHAR* text, MD_SIZE size, void* unneeded)
|
||||
{
|
||||
static int timesCalled = 0;
|
||||
// printf("Times called: %i\n", timesCalled++);
|
||||
// printf("This time we were given:\n");
|
||||
// printf(text);
|
||||
// printf("\n\n\n\n");
|
||||
|
||||
std::string fileUrl = "../../outputfile.html";
|
||||
|
||||
std::ofstream file;
|
||||
file.open(fileUrl, std::ios_base::app);
|
||||
file << text;
|
||||
file.close();
|
||||
}
|
||||
#include "BlogParser.h"
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
std::ifstream file;
|
||||
file.open("../../inputfile.md");
|
||||
BlogParser* parser = new BlogParser();
|
||||
|
||||
std::stringstream buffer;
|
||||
buffer << file.rdbuf();
|
||||
|
||||
file.close();
|
||||
|
||||
std::string text = buffer.str();
|
||||
int length = text.length();
|
||||
|
||||
int endCode = md_html(text.c_str(), length, SaveTextToFile, NULL, 0, 1);
|
||||
printf("program finished with code %i\n", endCode);
|
||||
std::string in = "../../inputfile.md";
|
||||
std::string out = "../../outputfile.html";
|
||||
parser->parse(in, out);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue