BibleTime
thmltohtml.h
Go to the documentation of this file.
1 /*********
2 *
3 * In the name of the Father, and of the Son, and of the Holy Spirit.
4 *
5 * This file is part of BibleTime's source code, https://bibletime.info/
6 *
7 * Copyright 1999-2021 by the BibleTime developers.
8 * The BibleTime source code is licensed under the GNU General Public License
9 * version 2.0.
10 *
11 **********/
12 
13 #pragma once
14 
15 #include <optional>
16 #include <QString>
17 
18 // Sword includes:
19 #pragma GCC diagnostic push
20 #pragma GCC diagnostic ignored "-Wextra-semi"
21 #pragma GCC diagnostic ignored "-Wsuggest-override"
22 #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
23 #ifdef __clang__
24 #pragma clang diagnostic push
25 #pragma clang diagnostic ignored "-Wsuggest-destructor-override"
26 #endif
27 #include <swbuf.h>
28 #include <thmlhtml.h>
29 #ifdef __clang__
30 #pragma clang diagnostic pop
31 #endif
32 #pragma GCC diagnostic pop
33 
34 
35 namespace Filters {
36 
37 /**
38  \brief ThML to HTML conversion filter.
39 */
40 class ThmlToHtml: public sword::ThMLHTML {
41  protected: // types:
43  public:
44  UserData(sword::SWModule const * module,
45  sword::SWKey const * key)
46  : sword::ThMLHTML::MyUserData(module, key),
47  inscriptRef(false), inFootnoteTag(false),
48  swordFootnote(1) {}
49 
50  std::optional<QString> absolutePath;
53  unsigned short int swordFootnote;
54  };
55 
56  public: // methods:
57  ThmlToHtml();
58 
59  bool handleToken(sword::SWBuf &buf,
60  const char *token,
61  sword::BasicFilterUserData *userData) override;
62 
63  char processText(sword::SWBuf &buf,
64  const sword::SWKey *key,
65  const sword::SWModule *module = nullptr) override;
66 
67  protected: // methods:
68 
69  sword::BasicFilterUserData * createUserData(
70  sword::SWModule const * module,
71  sword::SWKey const * key) override
72  { return new UserData(module, key); }
73 };
74 
75 } // namespace Filters
std::optional< QString > absolutePath
Definition: thmltohtml.h:50
UserData(sword::SWModule const *module, sword::SWKey const *key)
Definition: thmltohtml.h:44
unsigned short int swordFootnote
Definition: thmltohtml.h:53
ThML to HTML conversion filter.
Definition: thmltohtml.h:40
sword::BasicFilterUserData * createUserData(sword::SWModule const *module, sword::SWKey const *key) override
Definition: thmltohtml.h:69
bool handleToken(sword::SWBuf &buf, const char *token, sword::BasicFilterUserData *userData) override
Definition: thmltohtml.cpp:237
char processText(sword::SWBuf &buf, const sword::SWKey *key, const sword::SWModule *module=nullptr) override
Definition: thmltohtml.cpp:60