39 const static char *header =
"\
40 \\LoadClass[11pt,a4paper,twoside,headinclude=true,footinclude=true,BCOR=0mm,DIV=calc]{scrbook}\n\
41 \\LoadClass[11pt,a4paper,twoside,headinclude=true,footinclude=true,BCOR=0mm,DIV=calc]{scrbook}\n\
42 \\NeedsTeXFormat{LaTeX2e}\n\
43 \\ProvidesClass{sword}[2015/03/29 CrossWire LaTeX class for Biblical texts]\n\
44 %\\sworddiclink{%s}{%s}{\n\
45 %\\sworddictref{%s}{%s}{\n\
47 %\\sworddivinename}{%s}{\n\
49 %\\swordfootnote[%c]{%s}{%s}{%s}{%s}{\n\
50 %\\swordfootnote{%s}{%s}{%s}{\n\
51 %\\swordfootnote{%s}{%s}{%s}{%s}{\n\
53 %\\swordmorph[Greek]{%s}\n\
54 %\\swordmorph[lemma]{%s}\n\
56 %\\swordpoetryline{\n\
58 %\\swordref{%s}{%s}{\n\
61 %\\swordsection{book}{\n\
62 %\\swordsection{sechead}{\n\
63 %\\swordstrong[Greek]{\n\
64 %\\swordstrong[Greektense]{\n\
65 %\\swordstrong[Hebrew]{\n\
66 %\\swordstrong[Hebrewtense]{\n\
67 %\\swordstrong[%s]{%s}{\n\
68 %\\swordstrong{%s}{%s}\n\
70 %\\swordtranschange{supplied}{\n\
71 %\\swordtranschange{tense}{\n\
75 %\\swordxref{%s}{%s}{\n\
93 int i = (count > 1) ? 0 : -1;
97 val = strchr(attrib,
':');
98 val = (val) ? (val + 1) : attrib;
104 const char *val2 = val;
105 if ((strchr(
"GH", *val)) && (isdigit(val[1])))
110 if (!suspendTextPassThru) {
117 }
while (++i < count);
132 int i = (count > 1) ? 0 : -1;
136 val = strchr(attrib,
':');
137 val = (val) ? (val + 1) : attrib;
138 const char *val2 = val;
139 if ((*val ==
'T') && (strchr(
"GH", val[1])) && (isdigit(val[2])))
141 if (!suspendTextPassThru) {
146 }
while (++i < count);
205 if (++consecutiveNewlines <= 2) {
207 supressAdjacentWhitespace =
true;
220 if (!strcmp(tag.
getName(),
"w")) {
237 else lastText =
"stuff";
242 val = strchr(attrib,
':');
243 val = (val) ? (val + 1) : attrib;
267 val = strchr(attrib,
':');
268 val = (val) ? (val + 1) : attrib;
279 else if (!strcmp(tag.
getName(),
"note")) {
282 bool strongsMarkup = (type ==
"x-strongsMarkup" || type ==
"strongsMarkup");
289 if (!strongsMarkup) {
291 SWBuf footnoteBody =
"";
304 footnoteNumber.
c_str(),
315 footnoteNumber.
c_str(),
337 else if (!strcmp(tag.
getName(),
"p") || !strcmp(tag.
getName(),
"lg")) {
364 else if (!strcmp(tag.
getName(),
"reference")) {
370 bool is_scripRef =
false;
373 const char* the_ref = strchr(target,
':');
389 if(!strncmp(work,
"Bible", 5))
416 else if (!strcmp(tag.
getName(),
"l")) {
420 outText(
"\\swordpoetryline{", buf, u);
460 int level = (tmp) ? atoi(tmp) : 1;
467 outText((level % 2) ?
'\"' :
'\'', buf, u);
473 else if (!strcmp(tag.
getName(),
"title")) {
479 outText(
"\n\\swordtitle{", buf, u);
483 if (hasType)
outText(type, buf, u);
496 else if (!strcmp(tag.
getName(),
"list")) {
498 outText(
"\n\\begin{itemize}", buf, u);
501 outText(
"\n\\end{itemize}", buf, u);
508 else if (!strcmp(tag.
getName(),
"item")) {
518 else if (!strcmp(tag.
getName(),
"rdg") || !strcmp(tag.
getName(),
"catchWord")) {
528 else if (!strcmp(tag.
getName(),
"divineName")) {
530 outText(
"\\sworddivinename{", buf, u);
536 if (lastText.
size()) {
544 else if (!strcmp(tag.
getName(),
"hi")) {
551 if (type ==
"bold" || type ==
"b" || type ==
"x-b") {
552 outText(
"\\textbold{", buf, u);
560 else if (type ==
"ol" || type ==
"overline" || type ==
"x-overline") {
561 outText(
"\\textoverline{", buf, u);
564 else if (type ==
"super") {
565 outText(
"\\textsuperscript{", buf, u);
567 else if (type ==
"sub") {
568 outText(
"\\textsubscript{", buf, u);
588 else if (!strcmp(tag.
getName(),
"q")) {
592 int level = (tmp) ? atoi(tmp) : 1;
613 outText((level % 2) ?
'\"' :
'\'', buf, u);
622 type = qTag.getAttribute(
"type");
623 who = qTag.getAttribute(
"who");
624 tmp = qTag.getAttribute(
"level");
625 level = (tmp) ? atoi(tmp) : 1;
626 tmp = qTag.getAttribute(
"marker");
636 outText((level % 2) ?
'\"' :
'\'', buf, u);
645 else if (!strcmp(tag.
getName(),
"transChange")) {
651 if ((type ==
"added") || (type ==
"supplied"))
652 outText(
"\\swordtranschange{supplied}{", buf, u);
653 else if (type ==
"tenseChange")
654 outText(
"\\swordtranschange{tense}{", buf, u);
664 else if (!strcmp(tag.
getName(),
"figure")) {
670 if ((filepath.
size()) && (filepath[filepath.
size()-1] !=
'/') && (src[0] !=
'/'))
676 outText(
"\\includegraphics{", buf, u);
684 else if (!strcmp(tag.
getName(),
"div")) {
686 if (type ==
"module") {
690 else if (type ==
"testament") {
694 else if (type ==
"bookGroup") {
698 else if (type ==
"book") {
702 else if (type ==
"majorSection") {
706 else if (type ==
"section") {
710 else if (type ==
"paragraph") {
715 else if (!strcmp(tag.
getName(),
"span")) {
718 else if (!strcmp(tag.
getName(),
"br")) {
721 else if (!strcmp(tag.
getName(),
"table")) {
723 outText(
"\n\\begin{tabular}", buf, u);
726 outText(
"\n\\end{tabular}", buf, u);
732 else if (!strcmp(tag.
getName(),
"row")) {
743 else if (!strcmp(tag.
getName(),
"cell")) {
#define SWORD_NAMESPACE_START
SWBuf & appendFormatted(const char *format,...)
void setTokenEnd(const char *tokenEnd)
void addAllowedEscapeString(const char *findString)
unsigned long length() const
void setEmpty(bool value)
virtual const char * getConfigEntry(const char *key) const
MyUserData(const SWModule *module, const SWKey *key)
const char * getName() const
const char * toString() const
void setTokenCaseSensitive(bool val)
void setEscapeStart(const char *escStart)
SWBuf renderText(const char *buf, int len=-1, bool render=true) const
bool substituteToken(SWBuf &buf, const char *token)
virtual const char * getText() const
virtual const char * getText() const
void processLemma(bool suspendTextPassThru, XMLTag &tag, SWBuf &buf)
void setTokenStart(const char *tokenStart)
const char * c_str() const
virtual BasicFilterUserData * createUserData(const SWModule *module, const SWKey *key)
void setPassThruNumericEscapeString(bool val)
static void outText(const char *t, SWBuf &o, BasicFilterUserData *u)
void processMorph(bool suspendTextPassThru, XMLTag &tag, SWBuf &buf)
unsigned long size() const
virtual AttributeTypeList & getEntryAttributes() const
const char * getAttribute(const char *attribName, int partNum=-1, char partSplit= '|') const
bool supressAdjacentWhitespace
void setEscapeStringCaseSensitive(bool val)
bool isEndTag(const char *eID=0) const
void outputNewline(SWBuf &buf)
void setEscapeEnd(const char *escEnd)
#define SWORD_NAMESPACE_END
SWBuf & setFormatted(const char *format,...)
virtual bool handleToken(SWBuf &buf, const char *token, BasicFilterUserData *userData)
virtual const char * getHeader() const
void setSize(unsigned long len)
int getAttributePartCount(const char *attribName, char partSplit= '|') const