summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2019-10-25 14:10:45 +0300
committerAleksey Veresov <aleksey@veresov.pro>2019-10-25 14:10:45 +0300
commit1de3a9aae84ec71c4fd83604ea9c45204efb9baf (patch)
tree99246ae8cbb19864657360b513f501d796a92db5 /examples
parent2c12c0652d2b8c8440e1e908f004826840ed14ab (diff)
downloadtexo-1de3a9aae84ec71c4fd83604ea9c45204efb9baf.tar
texo-1de3a9aae84ec71c4fd83604ea9c45204efb9baf.tar.xz
texo-1de3a9aae84ec71c4fd83604ea9c45204efb9baf.zip
.
Diffstat (limited to 'examples')
-rw-r--r--examples/Makefile2
-rw-r--r--examples/lines.cpp61
-rw-r--r--examples/lines.txt2
-rw-r--r--examples/plain.cpp61
-rw-r--r--examples/plain.txt17
-rw-r--r--examples/plain_to_html.cpp22
6 files changed, 142 insertions, 23 deletions
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 <stdio.h>
+#include <html.hpp>
+#include <plain.hpp>
+#include <lines.hpp>
+#include <markdown.hpp>
+#include <file.hpp>
+
+
+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 <stdio.h>
+#include <html.hpp>
+#include <plain.hpp>
+#include <lines.hpp>
+#include <markdown.hpp>
+#include <file.hpp>
+
+
+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 <stdio.h>
-#include <html.hpp>
-#include <plain.hpp>
-#include <file.hpp>
-#include <scrvar.hpp>
-
-
-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;
-}