From 1de3a9aae84ec71c4fd83604ea9c45204efb9baf Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Fri, 25 Oct 2019 14:10:45 +0300 Subject: . --- examples/Makefile | 2 +- examples/lines.cpp | 61 ++++++++++++++++++++++++++++++++++++++++++++++ examples/lines.txt | 2 ++ examples/plain.cpp | 61 ++++++++++++++++++++++++++++++++++++++++++++++ examples/plain.txt | 17 +++++++++++++ examples/plain_to_html.cpp | 22 ----------------- 6 files changed, 142 insertions(+), 23 deletions(-) create mode 100644 examples/lines.cpp create mode 100644 examples/lines.txt create mode 100644 examples/plain.cpp create mode 100644 examples/plain.txt delete mode 100644 examples/plain_to_html.cpp (limited to 'examples') diff --git a/examples/Makefile b/examples/Makefile index 1959b4b..69f383c 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -2,7 +2,7 @@ DEBUG = yes CC = g++ -EXAMPLES = plain_to_html +EXAMPLES = plain lines CPPFLAGS = -Wall -ansi ifeq '$(DEBUG)' 'yes' diff --git a/examples/lines.cpp b/examples/lines.cpp new file mode 100644 index 0000000..5c24444 --- /dev/null +++ b/examples/lines.cpp @@ -0,0 +1,61 @@ +#include +#include +#include +#include +#include +#include + + +void plain() +{ + fputs(" ---- Lines to Plain ----\n\n", stdout); + TexoExporterFile exporter(stdout); + TexoProducerPlain producer(exporter); + TexoImporterLines importer(producer); + FILE *file = fopen("lines.txt", "r"); + importer.Put(file); + fclose(file); +} + +void html() +{ + fputs("\n\n ---- Lines to HTML ----\n\n", stdout); + TexoExporterFile exporter(stdout); + TexoProducerHTML producer(exporter); + TexoImporterLines importer(producer); + FILE *file = fopen("lines.txt", "r"); + importer.Put(file); + fclose(file); +} + +void markdown() +{ + fputs("\n\n ---- Lines to Markdown ----\n\n", stdout); + TexoExporterFile exporter(stdout); + TexoProducerMarkdown producer(exporter); + TexoImporterLines importer(producer); + FILE *file = fopen("lines.txt", "r"); + importer.Put(file); + fclose(file); +} + +void lines() +{ + fputs("\n\n ---- Lines to Lines ----\n\n", stdout); + TexoExporterFile exporter(stdout); + TexoProducerLines producer(exporter); + TexoImporterLines importer(producer); + FILE *file = fopen("lines.txt", "r"); + importer.Put(file); + fclose(file); +} + +int main() +{ + plain(); + html(); + markdown(); + lines(); + + return 0; +} diff --git a/examples/lines.txt b/examples/lines.txt new file mode 100644 index 0000000..a227a08 --- /dev/null +++ b/examples/lines.txt @@ -0,0 +1,2 @@ +Simpliest format. Paragraphs on newlines. And nothing else. +So this is second paragraph. diff --git a/examples/plain.cpp b/examples/plain.cpp new file mode 100644 index 0000000..d91fcde --- /dev/null +++ b/examples/plain.cpp @@ -0,0 +1,61 @@ +#include +#include +#include +#include +#include +#include + + +void plain() +{ + fputs(" ---- Plain to Plain ----\n\n", stdout); + TexoExporterFile exporter(stdout); + TexoProducerPlain producer(exporter); + TexoImporterPlain importer(producer); + FILE *file = fopen("plain.txt", "r"); + importer.Put(file); + fclose(file); +} + +void html() +{ + fputs("\n\n ---- Plain to HTML ----\n\n", stdout); + TexoExporterFile exporter(stdout); + TexoProducerHTML producer(exporter); + TexoImporterPlain importer(producer); + FILE *file = fopen("plain.txt", "r"); + importer.Put(file); + fclose(file); +} + +void markdown() +{ + fputs("\n\n ---- Plain to Markdown ----\n\n", stdout); + TexoExporterFile exporter(stdout); + TexoProducerMarkdown producer(exporter); + TexoImporterPlain importer(producer); + FILE *file = fopen("plain.txt", "r"); + importer.Put(file); + fclose(file); +} + +void lines() +{ + fputs("\n\n ---- Plain to Lines ----\n\n", stdout); + TexoExporterFile exporter(stdout); + TexoProducerLines producer(exporter); + TexoImporterPlain importer(producer); + FILE *file = fopen("plain.txt", "r"); + importer.Put(file); + fclose(file); +} + +int main() +{ + plain(); + html(); + markdown(); + lines(); + + return 0; +} diff --git a/examples/plain.txt b/examples/plain.txt new file mode 100644 index 0000000..c05d73f --- /dev/null +++ b/examples/plain.txt @@ -0,0 +1,17 @@ +I am a little cute line. + +I am another and that's fine. + +But I am as long as a pine, +so lets drink a glass of wine. + + + +You can use any count of empty lines to mark paragraphs. + +> This is quote. +> Long enough. + +-------------------------------------------------------- + +This was horizontal rule diff --git a/examples/plain_to_html.cpp b/examples/plain_to_html.cpp deleted file mode 100644 index d123a84..0000000 --- a/examples/plain_to_html.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -#include -#include -#include -#include - - -int main() -{ - TexoExporterFile exporter(stdout); - TexoProducerHTML producer(exporter); - TexoImporterPlain importer(producer); - importer.Put( - "I am a little cute line. \n" - "I am another and that's fine. \n" - "But I am as long as a pine,\n" - "so lets drink a glass of wine.\n\n" - "Second paragraph was started here. \n" - "Take your bananas and go home, seer.\n" - ); - return 0; -} -- cgit v1.2.3