1 /****************************************************************************** 2 * 3 * osisxhtml.h - Render filter for classed XHTML of an OSIS module 4 * 5 * $Id: osisxhtml.h 3548 2017-12-10 05:11:38Z scribe $ 6 * 7 * Copyright 2011-2013 CrossWire Bible Society (http://www.crosswire.org) 8 * CrossWire Bible Society 9 * P. O. Box 2528 10 * Tempe, AZ 85280-2528 11 * 12 * This program is free software; you can redistribute it and/or modify it 13 * under the terms of the GNU General Public License as published by the 14 * Free Software Foundation version 2. 15 * 16 * This program is distributed in the hope that it will be useful, but 17 * WITHOUT ANY WARRANTY; without even the implied warranty of 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19 * General Public License for more details. 20 * 21 */ 22 23 #ifndef OSISXHTML_H 24 #define OSISXHTML_H 25 26 #include <swbasicfilter.h> 27 28 SWORD_NAMESPACE_START 29 30 /** this filter converts OSIS text to classed XHTML 31 */ 32 class SWDLLEXPORT OSISXHTML : public SWBasicFilter { 33 private: 34 bool morphFirst; 35 bool renderNoteNumbers; 36 protected: 37 38 class TagStack; 39 virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key); 40 virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData); 41 42 43 // used by derived classes so we have it in the header 44 class MyUserData : public BasicFilterUserData { 45 public: 46 bool osisQToTick; 47 bool inXRefNote; 48 bool isBiblicalText; 49 int suspendLevel; 50 SWBuf wordsOfChristStart; 51 SWBuf wordsOfChristEnd; 52 SWBuf interModuleLinkStart; 53 SWBuf interModuleLinkEnd; 54 TagStack *quoteStack; 55 TagStack *hiStack; 56 TagStack *titleStack; 57 TagStack *lineStack; 58 int consecutiveNewlines; 59 SWBuf lastTransChange; 60 SWBuf w; 61 SWBuf fn; 62 SWBuf version; 63 64 MyUserData(const SWModule *module, const SWKey *key); 65 ~MyUserData(); 66 void outputNewline(SWBuf &buf); 67 }; 68 public: 69 OSISXHTML(); 70 void setMorphFirst(bool val = true) { morphFirst = val; } 71 void setRenderNoteNumbers(bool val = true) { renderNoteNumbers = val; } 72 virtual const char *getHeader() const; 73 }; 74 75 SWORD_NAMESPACE_END 76 #endif 77