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, http://www.bibletime.info/. 6 * 7 * Copyright 1999-2016 by the BibleTime developers. 8 * The BibleTime source code is licensed under the GNU General Public License version 2.0. 9 * 10 **********/ 11 12 #ifndef FILTERS_OSISTOHTML_H 13 #define FILTERS_OSISTOHTML_H 14 15 // Sword includes: 16 #include <osishtmlhref.h> 17 #include <swbuf.h> 18 #include <swmodule.h> 19 20 namespace Filters { 21 22 /** 23 \brief OSIS to HTMl conversion filter. 24 */ 25 class OsisToHtml: public sword::OSISHTMLHREF { 26 protected: /* Types: */ 27 class UserData: public sword::OSISHTMLHREF::MyUserData { 28 public: UserData(const sword::SWModule * module,const sword::SWKey * key)29 inline UserData(const sword::SWModule *module, 30 const sword::SWKey *key) 31 : sword::OSISHTMLHREF::MyUserData(module, key), 32 swordFootnote(1), inCrossrefNote(false), 33 entryAttributes(module->getEntryAttributes()), 34 noteType(Unknown) {} 35 36 unsigned short int swordFootnote; 37 bool inCrossrefNote; 38 sword::AttributeTypeList entryAttributes; 39 40 enum NoteType { 41 Unknown, 42 Alternative, 43 CrossReference, 44 Footnote, 45 StrongsMarkup 46 } noteType; 47 48 struct { 49 sword::SWBuf who; 50 } quote; 51 }; 52 53 public: /* Methods: */ 54 OsisToHtml(); 55 56 /** Reimplemented from sword::OSISHTMLHREF. */ 57 bool handleToken(sword::SWBuf &buf, 58 const char *token, 59 sword::BasicFilterUserData *userData) override; 60 61 protected: /* Methods: */ 62 /** Reimplemented from sword::OSISHTMLHREF. */ createUserData(const sword::SWModule * module,const sword::SWKey * key)63 inline sword::BasicFilterUserData *createUserData( 64 const sword::SWModule *module, 65 const sword::SWKey *key) override 66 { 67 return new UserData(module, key); 68 } 69 70 private: /* Methods: */ 71 void renderReference(const char *osisRef, sword::SWBuf &buf, 72 sword::SWModule *myModule, UserData *myUserData); 73 }; 74 75 } // namespace Filters 76 77 #endif 78