Add PDF writer.
This commit is contained in:
parent
c05b7b6315
commit
9c116b1efd
72 changed files with 1819 additions and 114 deletions
25
test/web/TestMarkdownParser.cpp
Normal file
25
test/web/TestMarkdownParser.cpp
Normal file
|
@ -0,0 +1,25 @@
|
|||
#include "MarkdownParser.h"
|
||||
#include "File.h"
|
||||
#include "HtmlWriter.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
File md_file("/home/jmsgrogan/code/MediaTool/test/data/sample_markdown.md");
|
||||
md_file.Open();
|
||||
const auto md_content = md_file.ReadText();
|
||||
|
||||
MarkdownParser parser;
|
||||
parser.Run(md_content);
|
||||
|
||||
auto html = parser.GetHtml();
|
||||
|
||||
HtmlWriter writer;
|
||||
const auto html_string = writer.ToString(html);
|
||||
|
||||
File html_file("TestMarkdownParserOut.html");
|
||||
html_file.SetAccessMode(File::AccessMode::Write);
|
||||
html_file.Open();
|
||||
html_file.WriteText(html_string);
|
||||
return 0;
|
||||
|
||||
}
|
31
test/web/TestXmlParser.cpp
Normal file
31
test/web/TestXmlParser.cpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
#include "XmlParser.h"
|
||||
#include "XmlWriter.h"
|
||||
#include "File.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
XmlParser parser;
|
||||
|
||||
std::ifstream xml_file;
|
||||
xml_file.open("/home/jmsgrogan/test.xml", std::ifstream::in);
|
||||
while(xml_file.good())
|
||||
{
|
||||
std::string line;
|
||||
std::getline(xml_file, line);
|
||||
parser.ProcessLine(line);
|
||||
}
|
||||
xml_file.close();
|
||||
|
||||
auto outFile = std::make_unique<File>("test_out.xml");
|
||||
outFile->SetAccessMode(File::AccessMode::Write);
|
||||
outFile->Open();
|
||||
|
||||
XmlWriter writer;
|
||||
auto content = writer.ToString(parser.GetDocument().get());
|
||||
outFile->WriteText(content);
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue