1 /****************************************************************************** 2 * 3 * osislatex.h - Render filter for LaTeX of an OSIS module 4 * 5 * $Id: osislatex.h 3548 2017-12-10 05:11:38Z scribe $ 6 * 7 * Copyright 2011-2014 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 OSISLATEX_H 24 #define OSISLATEX_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 OSISLaTeX : public SWBasicFilter { 33 private: 34 bool morphFirst; 35 bool renderNoteNumbers; 36 protected: 37 38 class TagStack; 39 // used by derived classes so we have it in the header 40 virtual BasicFilterUserData *createUserData(const SWModule *module, const SWKey *key); 41 virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData); 42 43 44 class MyUserData : public BasicFilterUserData { 45 public: 46 bool osisQToTick; 47 bool inXRefNote; 48 bool isBiblicalText; 49 int suspendLevel; 50 bool firstCell; // for tables, indicates whether a cell is the first one in a row 51 SWBuf wordsOfChristStart; 52 SWBuf wordsOfChristEnd; 53 SWBuf divLevel; // divLevel "module", "testament, "bookgroup", "book", "majorsection", "section", "paragraph" , ignore others. 54 55 TagStack *quoteStack; 56 TagStack *hiStack; 57 TagStack *titleStack; 58 TagStack *lineStack; 59 int consecutiveNewlines; 60 SWBuf lastTransChange; 61 SWBuf w; 62 SWBuf fn; 63 SWBuf version; 64 65 MyUserData(const SWModule *module, const SWKey *key); 66 ~MyUserData(); 67 void outputNewline(SWBuf &buf); 68 }; 69 public: 70 OSISLaTeX(); 71 void setMorphFirst(bool val = true) { morphFirst = val; } 72 void setRenderNoteNumbers(bool val = true) { renderNoteNumbers = val; } 73 virtual const char *getHeader() const; 74 }; 75 76 SWORD_NAMESPACE_END 77 #endif 78