From 77f503bd6db90bd882e389ea977f02a2773e14f2 Mon Sep 17 00:00:00 2001 From: Aleksey Veresov Date: Fri, 4 Oct 2019 16:35:57 +0300 Subject: Semi-working html. =) --- src/html.hpp | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) (limited to 'src/html.hpp') diff --git a/src/html.hpp b/src/html.hpp index 265ee39..7a5a511 100644 --- a/src/html.hpp +++ b/src/html.hpp @@ -8,16 +8,73 @@ class TexoHTMLProducer: public TexoProducer { public: TexoHTMLProducer(TexoExporter &exporter); void Put(const Texo &piece); + private: void BeginLink(const Texo &piece); void Image(const Texo &piece); }; +class TexoHTMLStack { +public: + TexoHTMLStack(); + ~TexoHTMLStack(); + void Push(Texo::Type tag); + Texo::Type Pop(); + +private: + TexoHTMLStack *next; + Texo::Type tag; +}; + class TexoHTMLImporter: public TexoImporter { public: - TexoHTMLImporter(TexoProducer &producer); + TexoHTMLImporter(TexoProducer &producer, bool is_autoclose = true); + ~TexoHTMLImporter(); void Put(const char c); + +private: + bool is_autoclose; + + enum State { + text = 0, + tag_open, + tag_name, + tag_param_skip, + tag_param_pre, + tag_param, + tag_param_post, + tag_param_value_pre, + tag_param_value, + tag_param_value_quoted + } state; + + State Text(const char c); + State TagOpen(const char c); + State TagName(const char c); + State TagParamSkip(const char c); + State TagParamPre(const char c); + State TagParam(const char c); + State TagParamPost(const char c); + State TagParamValuePre(const char c); + State TagParamValue(const char c); + State TagParamValueQuoted(const char c); + + TexoHTMLStack opened; + + void Close(); + + bool is_closing; + Texo::Type tag; + + void SetTag(); + + char *readed; + int readed_len; + int readed_size; + + void ReadedAdd(const char c); + void ReadedClear(); }; -- cgit v1.2.3