diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/docparser.cpp | 45 | ||||
-rw-r--r-- | src/docparser.h | 2 | ||||
-rw-r--r-- | src/latexdocvisitor.cpp | 17 |
3 files changed, 51 insertions, 13 deletions
diff --git a/src/docparser.cpp b/src/docparser.cpp index a812406..e3187a0 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -3371,31 +3371,33 @@ DocHtmlCell::Alignment DocHtmlCell::alignment() const { for (const auto &attr : attribs()) { - if (attr.name.lower()=="align") + QCString attrName = attr.name.lower(); + QCString attrValue = attr.value.lower(); + if (attrName=="align") { - if (attr.value.lower()=="center") + if (attrValue=="center") return Center; - else if (attr.value.lower()=="right") + else if (attrValue=="right") return Right; else return Left; } - else if (attr.name.lower()=="class") + else if (attrName=="class" && attrValue.startsWith("markdowntable")) { - if (attr.value.lower()=="markdowntableheadcenter") + if (attrValue=="markdowntableheadcenter") return Center; - else if (attr.value.lower()=="markdowntableheadright") + else if (attrValue=="markdowntableheadright") return Right; - else if (attr.value.lower()=="markdowntableheadleft") + else if (attrValue=="markdowntableheadleft") return Left; - else if (attr.value.lower()=="markdowntableheadnone") + else if (attrValue=="markdowntableheadnone") return Center; - else if (attr.value.lower()=="markdowntablebodycenter") + else if (attrValue=="markdowntablebodycenter") return Center; - else if (attr.value.lower()=="markdowntablebodyright") + else if (attrValue=="markdowntablebodyright") return Right; - else if (attr.value.lower()=="markdowntablebodyleft") + else if (attrValue=="markdowntablebodyleft") return Left; - else if (attr.value.lower()=="markdowntablebodynone") + else if (attrValue=="markdowntablebodynone") return Left; else return Left; } @@ -3403,6 +3405,25 @@ DocHtmlCell::Alignment DocHtmlCell::alignment() const return Left; } +DocHtmlCell::Valignment DocHtmlCell::valignment() const +{ + for (const auto &attr : attribs()) + { + QCString attrName = attr.name.lower(); + QCString attrValue = attr.value.lower(); + if (attrName=="valign") + { + if (attrValue=="top") + return Top; + else if (attrValue=="bottom") + return Bottom; + else if (attrValue=="middle") + return Middle; + else return Middle; + } + } + return Middle; +} //--------------------------------------------------------------------------- diff --git a/src/docparser.h b/src/docparser.h index 44cd8dc..40fdc0c 100644 --- a/src/docparser.h +++ b/src/docparser.h @@ -1288,6 +1288,7 @@ class DocHtmlCell : public CompAccept<DocHtmlCell> friend class DocHtmlTable; public: enum Alignment { Left, Right, Center }; + enum Valignment {Top, Middle, Bottom}; DocHtmlCell(DocNode *parent,const HtmlAttribList &attribs,bool isHeading) : m_isHeading(isHeading), m_attribs(attribs) { m_parent = parent; } bool isHeading() const { return m_isHeading; } @@ -1304,6 +1305,7 @@ class DocHtmlCell : public CompAccept<DocHtmlCell> uint rowSpan() const; uint colSpan() const; Alignment alignment() const; + Valignment valignment() const; private: void setRowIndex(uint idx) { m_rowIdx = idx; } diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index 3e48dc5..e793f50 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -1320,14 +1320,29 @@ void LatexDocVisitor::visitPre(DocHtmlCell *c) } } int rs = c->rowSpan(); + int va = c->valignment(); if (rs>0) { setInRowSpan(TRUE); + m_t << "\\multirow"; + switch(va) + { + case DocHtmlCell::Top: + m_t << "[t]"; + break; + case DocHtmlCell::Bottom: + m_t << "[b]"; + break; + case DocHtmlCell::Middle: + break; // No alignment option needed + default: + break; + } //printf("adding row span: cell={r=%d c=%d rs=%d cs=%d} curCol=%d\n", // c->rowIndex(),c->columnIndex(),c->rowSpan(),c->colSpan(), // currentColumn()); addRowSpan(ActiveRowSpan(c,rs,cs,currentColumn())); - m_t << "\\multirow{" << rs << "}{*}{"; + m_t << "{" << rs << "}{*}{"; } if (a==DocHtmlCell::Center) { |