+ if (is_long_tabular) {
+ // we'll wrap it in a div, so as to deal with alignment
+ string align;
+ switch (longtabular_alignment) {
+ case LYX_LONGTABULAR_ALIGN_LEFT:
+ align = "left";
+ break;
+ case LYX_LONGTABULAR_ALIGN_CENTER:
+ align = "center";
+ break;
+ case LYX_LONGTABULAR_ALIGN_RIGHT:
+ align = "right";
+ break;
+ }
+ xs << html::StartTag("div", "class='longtable' style='text-align: " + align + ";'")
+ << html::CR();
+ // The caption flag wins over head/foot
+ if (haveLTCaption()) {
+ xs << html::StartTag("div", "class='longtable-caption' style='text-align: " + align + ";'")
+ << html::CR();
+ for (row_type r = 0; r < nrows(); ++r)
+ if (row_info[r].caption)
+ ret += xhtmlRow(xs, r, runparams);
+ xs << html::EndTag("div") << html::CR();
+ }
+ }
+
+ xs << html::StartTag("table") << html::CR();
+
+ // output header info
+ bool const havefirsthead = haveLTFirstHead(false);
+ // if we have a first head, then we are going to ignore the
+ // headers for the additional pages, since there aren't any
+ // in XHTML. this test accomplishes that.
+ bool const havehead = !havefirsthead && haveLTHead(false);
+ if (havehead || havefirsthead) {
+ xs << html::StartTag("thead") << html::CR();
+ for (row_type r = 0; r < nrows(); ++r) {
+ if (((havefirsthead && row_info[r].endfirsthead) ||
+ (havehead && row_info[r].endhead)) &&
+ !row_info[r].caption) {
+ ret += xhtmlRow(xs, r, runparams, true);
+ }
+ }
+ xs << html::EndTag("thead") << html::CR();
+ }
+ // output footer info
+ bool const havelastfoot = haveLTLastFoot(false);
+ // as before.
+ bool const havefoot = !havelastfoot && haveLTFoot(false);
+ if (havefoot || havelastfoot) {
+ xs << html::StartTag("tfoot") << html::CR();
+ for (row_type r = 0; r < nrows(); ++r) {
+ if (((havelastfoot && row_info[r].endlastfoot) ||
+ (havefoot && row_info[r].endfoot)) &&
+ !row_info[r].caption) {
+ ret += xhtmlRow(xs, r, runparams);
+ }
+ }
+ xs << html::EndTag("tfoot") << html::CR();
+ }
+
+ xs << html::StartTag("tbody") << html::CR();