summaryrefslogtreecommitdiff
path: root/src/markdown.hpp
diff options
context:
space:
mode:
authorAleksey Veresov <aleksey@veresov.pro>2019-11-08 19:49:40 +0300
committerAleksey Veresov <aleksey@veresov.pro>2019-11-08 19:49:40 +0300
commited7a63015c1583d5544ac18bbaccaedc95f3e5e3 (patch)
tree9648d5a74bae9cbd90670a8bfa0af47189e4536f /src/markdown.hpp
parentc6419eed96f2832b1de2b94d711552efaa9b172d (diff)
downloadtexo-ed7a63015c1583d5544ac18bbaccaedc95f3e5e3.tar
texo-ed7a63015c1583d5544ac18bbaccaedc95f3e5e3.tar.xz
texo-ed7a63015c1583d5544ac18bbaccaedc95f3e5e3.zip
[texo] Full rewrite of inner representation.
Diffstat (limited to 'src/markdown.hpp')
-rw-r--r--src/markdown.hpp49
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,