diff options
author | Aleksey Veresov <aleksey@veresov.pro> | 2019-11-08 19:49:40 +0300 |
---|---|---|
committer | Aleksey Veresov <aleksey@veresov.pro> | 2019-11-08 19:56:11 +0300 |
commit | 3047ed6100a56a529f26e43ada0a3fc3c3815c3e (patch) | |
tree | 9648d5a74bae9cbd90670a8bfa0af47189e4536f /src/markdown.hpp | |
parent | c6419eed96f2832b1de2b94d711552efaa9b172d (diff) | |
download | texo-3047ed6100a56a529f26e43ada0a3fc3c3815c3e.tar texo-3047ed6100a56a529f26e43ada0a3fc3c3815c3e.tar.xz texo-3047ed6100a56a529f26e43ada0a3fc3c3815c3e.zip |
[texo] Full rewrite of inner representation.
Diffstat (limited to 'src/markdown.hpp')
-rw-r--r-- | src/markdown.hpp | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/src/markdown.hpp b/src/markdown.hpp index f9b25f4..ee8aee8 100644 --- a/src/markdown.hpp +++ b/src/markdown.hpp @@ -10,33 +10,44 @@ class TexoProducerMarkdown: public TexoProducer { public: TexoProducerMarkdown(TexoExporter &exporter); - void End(); + bool End(); - void Put(const Texo &piece); + bool Put(char c); - void Put(const TexoHeader &piece); - void Put(const TexoParagraph &piece); - void Put(const TexoCode &piece); - void Put(const TexoQuote &piece); + bool Code(); + bool Header(int level); + bool Paragraph(); + bool Quote(); - void Put(const TexoMono &piece); - void Put(const TexoBold &piece); - void Put(const TexoItalic &piece); - void Put(const TexoUnderline &piece); - void Put(const TexoStrike &piece); + bool Bold(); + bool Italic(); + bool Mono(); + bool Strike(); + bool Underline(); - void Put(const TexoImage &piece); - void Put(const TexoLink &piece); - void Put(const TexoHorizontalRule &piece); + bool Link(const ScriptVariable &link, const ScriptVariable &title); + bool Link(); + + bool PutImage( + const ScriptVariable &src, + const ScriptVariable &alt, + const ScriptVariable &title + ); + bool PutHorizontalRule(); private: - void Close(); + bool Mod(const ScriptVariable &str); + bool Close(); + bool CloseLink(); bool quoted; bool newline; bool header; bool code; bool nospace; + + ScriptVariable link_link; + ScriptVariable link_title; }; @@ -44,13 +55,13 @@ class TexoImporterMarkdown: public TexoImporter { public: TexoImporterMarkdown(TexoProducer &producer); - void Put(char c); - void Put(const ScriptVariable &str); - void Put(FILE *file); + +protected: + bool TruePut(char c); + private: enum State { - error, start, text, header_text, |