Skip to content

Commit c5c293d

Browse files
committed
Add preprocessor define to switch between FB2 and HTML DOM
1 parent 0e54ead commit c5c293d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

crengine/src/docxfmt.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010

1111
// comment this out to disable in-page footnotes
1212
#define DOCX_CRENGINE_IN_PAGE_FOOTNOTES 1
13+
// build FB2 DOM, comment out to build HTML DOM
14+
#define DOCX_FB2_DOM_STRUCTURE 1
1315

1416
/// known docx items name and identifier
1517
struct item_def_t {
@@ -1413,7 +1415,7 @@ void docx_ElementHandler::generateLink(const lChar16 *target, const lChar16 *typ
14131415
#ifndef DOCX_CRENGINE_IN_PAGE_FOOTNOTES
14141416
if( !lStr_cmp(type, "note") ) {
14151417
// For footnotes (but not endnotes), wrap in <sup> (to get the
1416-
// same effect upstream gets with the following in docx.css:
1418+
// same effect as the following in docx.css:
14171419
// a[type="note"] { vertical-align: super; font-size: 70%; }
14181420
m_writer->OnTagOpen(L"", L"sup");
14191421
m_writer->OnTagBody();
@@ -1864,11 +1866,11 @@ const lChar16 *docx_pHandler::getStyleTagName(lChar16 ch)
18641866
case 'b':
18651867
return L"strong";
18661868
case 'i':
1867-
return L"em"; // upstream uses L"emphasis";
1869+
return L"em";
18681870
case 'u':
18691871
return L"u";
18701872
case 's':
1871-
return L"s"; // upstream uses L"strike";
1873+
return L"s";
18721874
case 't':
18731875
return L"sup";
18741876
case 'd':
@@ -2313,13 +2315,15 @@ bool ImportDocXDocument( LVStreamRef stream, ldomDocument * doc, LVDocViewCallba
23132315
writer.OnTagClose(NULL, L"title-info");
23142316
writer.OnTagClose(NULL, L"description");
23152317

2318+
#ifdef DOCX_FB2_DOM_STRUCTURE
23162319
//Two options when dealing with titles: (FB2|HTML)
23172320
docx_fb2TitleHandler titleHandler(&writer, &importContext); //<section><title class=hx">..</title></section>
2318-
//docx_titleHandler titleHandler(&writer, &importContext); //<hx>..</hx>
2321+
#else
2322+
docx_titleHandler titleHandler(&writer, &importContext); //<hx>..</hx>
2323+
#endif
23192324
docx_documentHandler documentHandler(&docReader, &writer, &importContext, &titleHandler);
23202325
docReader.setHandler(&documentHandler);
23212326

2322-
23232327
LVXMLParser parser(m_stream, &docReader);
23242328

23252329
if ( !parser.Parse() )

0 commit comments

Comments
 (0)