2 * \file output_xhtml.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * This code is based upon output_docbook.cpp
10 * Full author contact details are available in file CREDITS.
15 #include "output_xhtml.h"
18 #include "buffer_funcs.h"
19 #include "BufferParams.h"
23 #include "OutputParams.h"
24 #include "Paragraph.h"
25 #include "ParagraphList.h"
26 #include "ParagraphParameters.h"
29 #include "TextClass.h"
31 #include "support/convert.h"
32 #include "support/debug.h"
33 #include "support/lassert.h"
34 #include "support/lstrings.h"
35 #include "support/textutils.h"
40 using namespace lyx::support;
46 docstring escapeChar(char_type c, XHTMLStream::EscapeSettings e)
50 case XHTMLStream::ESCAPE_NONE:
53 case XHTMLStream::ESCAPE_ALL:
57 } else if (c == '>') {
62 case XHTMLStream::ESCAPE_AND:
73 // escape what needs escaping
74 docstring htmlize(docstring const & str, XHTMLStream::EscapeSettings e) {
76 docstring::const_iterator it = str.begin();
77 docstring::const_iterator en = str.end();
78 for (; it != en; ++it)
79 d << escapeChar(*it, e);
84 string escapeChar(char c, XHTMLStream::EscapeSettings e)
88 case XHTMLStream::ESCAPE_NONE:
91 case XHTMLStream::ESCAPE_ALL:
95 } else if (c == '>') {
100 case XHTMLStream::ESCAPE_AND:
111 // escape what needs escaping
112 string htmlize(string const & str, XHTMLStream::EscapeSettings e) {
114 string::const_iterator it = str.begin();
115 string::const_iterator en = str.end();
116 for (; it != en; ++it)
117 d << escapeChar(*it, e);
122 string cleanAttr(string const & str)
125 string::const_iterator it = str.begin();
126 string::const_iterator en = str.end();
127 for (; it != en; ++it)
128 newname += isAlnumASCII(*it) ? *it : '_';
133 docstring cleanAttr(docstring const & str)
136 docstring::const_iterator it = str.begin();
137 docstring::const_iterator en = str.end();
138 for (; it != en; ++it) {
139 char_type const c = *it;
140 newname += isAlnumASCII(c) ? c : char_type('_');
146 bool isFontTag(string const & s)
149 return s == "em" || s == "strong" || s == "i" || s == "b";
153 docstring StartTag::asTag() const
155 string output = "<" + tag_;
157 output += " " + html::htmlize(attr_, XHTMLStream::ESCAPE_NONE);
159 return from_utf8(output);
163 docstring StartTag::asEndTag() const
165 string output = "</" + tag_ + ">";
166 return from_utf8(output);
170 docstring EndTag::asEndTag() const
172 string output = "</" + tag_ + ">";
173 return from_utf8(output);
177 docstring CompTag::asTag() const
179 string output = "<" + tag_;
181 output += " " + html::htmlize(attr_, XHTMLStream::ESCAPE_NONE);
183 return from_utf8(output);
190 ////////////////////////////////////////////////////////////////
194 ////////////////////////////////////////////////////////////////
196 XHTMLStream::XHTMLStream(odocstream & os)
197 : os_(os), escape_(ESCAPE_ALL)
202 void XHTMLStream::dumpTagStack(string const & msg) const
204 writeError(msg + ": Tag Stack");
205 TagStack::const_reverse_iterator it = tag_stack_.rbegin();
206 TagStack::const_reverse_iterator en = tag_stack_.rend();
207 for (; it != en; ++it) {
208 writeError(it->tag_);
210 writeError("Pending Tags");
211 it = pending_tags_.rbegin();
212 en = pending_tags_.rend();
213 for (; it != en; ++it) {
214 writeError(it->tag_);
216 writeError("End Tag Stack");
221 void XHTMLStream::writeError(std::string const & s) const
224 os_ << from_utf8("<!-- Output Error: " + s + " -->\n");
229 // an illegal tag for internal use
230 static string const parsep_tag = "&LyX_parsep_tag&";
234 bool XHTMLStream::closeFontTags()
236 if (isTagPending(parsep_tag))
237 // we haven't had any content
240 // this may be a useless check, since we ought at least to have
241 // the parsep_tag. but it can't hurt too much to be careful.
242 if (tag_stack_.empty())
245 // first, we close any open font tags we can close
246 html::StartTag curtag = tag_stack_.back();
247 while (html::isFontTag(curtag.tag_)) {
248 os_ << curtag.asEndTag();
249 tag_stack_.pop_back();
250 if (tag_stack_.empty())
251 // this probably shouldn't happen, since then the
252 // font tags weren't in any other tag. but that
253 // problem will likely be caught elsewhere.
255 curtag = tag_stack_.back();
258 if (curtag.tag_ == parsep_tag)
261 // so we've hit a non-font tag.
262 writeError("Tags still open in closeFontTags(). Probably not a problem,\n"
263 "but you might want to check these tags:");
264 TagStack::const_reverse_iterator it = tag_stack_.rbegin();
265 TagStack::const_reverse_iterator const en = tag_stack_.rend();
266 for (; it != en; ++it) {
267 string const tagname = it->tag_;
268 if (tagname == parsep_tag)
270 writeError(it->tag_);
276 void XHTMLStream::startParagraph(bool keep_empty)
278 pending_tags_.push_back(html::StartTag(parsep_tag));
284 void XHTMLStream::endParagraph()
286 if (isTagPending(parsep_tag)) {
287 // this case is normal. it just means we didn't have content,
288 // so the parsep_tag never got moved onto the tag stack.
289 while (!pending_tags_.empty()) {
290 // clear all pending tags up to and including the parsep tag.
291 // note that we work from the back, because we want to get rid
292 // of everything that hasn't been used.
293 html::StartTag const cur_tag = pending_tags_.back();
294 string const & tag = cur_tag.tag_;
295 pending_tags_.pop_back();
296 if (tag == parsep_tag)
302 if (!isTagOpen(parsep_tag)) {
303 writeError("No paragraph separation tag found in endParagraph().");
307 // this case is also normal, if the parsep tag is the last one
308 // on the stack. otherwise, it's an error.
309 while (!tag_stack_.empty()) {
310 html::StartTag const cur_tag = tag_stack_.back();
311 string const & tag = cur_tag.tag_;
312 tag_stack_.pop_back();
313 if (tag == parsep_tag)
315 writeError("Tag `" + tag + "' still open at end of paragraph. Closing.");
316 os_ << cur_tag.asEndTag();
321 void XHTMLStream::clearTagDeque()
323 while (!pending_tags_.empty()) {
324 html::StartTag const & tag = pending_tags_.front();
325 if (tag.tag_ != parsep_tag)
328 tag_stack_.push_back(tag);
329 pending_tags_.pop_front();
334 XHTMLStream & XHTMLStream::operator<<(docstring const & d)
337 os_ << html::htmlize(d, escape_);
338 escape_ = ESCAPE_ALL;
343 XHTMLStream & XHTMLStream::operator<<(const char * s)
346 docstring const d = from_ascii(s);
347 os_ << html::htmlize(d, escape_);
348 escape_ = ESCAPE_ALL;
353 XHTMLStream & XHTMLStream::operator<<(char_type c)
356 os_ << html::escapeChar(c, escape_);
357 escape_ = ESCAPE_ALL;
362 XHTMLStream & XHTMLStream::operator<<(char c)
365 string const d = html::escapeChar(c, escape_);
366 escape_ = ESCAPE_ALL;
371 XHTMLStream & XHTMLStream::operator<<(int i)
375 escape_ = ESCAPE_ALL;
380 XHTMLStream & XHTMLStream::operator<<(EscapeSettings e)
387 XHTMLStream & XHTMLStream::operator<<(html::StartTag const & tag)
389 if (tag.tag_.empty())
391 pending_tags_.push_back(tag);
398 XHTMLStream & XHTMLStream::operator<<(html::CompTag const & tag)
400 if (tag.tag_.empty())
410 XHTMLStream & XHTMLStream::operator<<(html::CR const &)
413 os_ << from_ascii("\n");
418 bool XHTMLStream::isTagOpen(string const & stag) const
420 TagStack::const_iterator sit = tag_stack_.begin();
421 TagStack::const_iterator const sen = tag_stack_.end();
422 for (; sit != sen; ++sit)
423 if (sit->tag_ == stag)
429 bool XHTMLStream::isTagPending(string const & stag) const
431 TagStack::const_iterator sit = pending_tags_.begin();
432 TagStack::const_iterator const sen = pending_tags_.end();
433 for (; sit != sen; ++sit)
434 if (sit->tag_ == stag)
440 // this is complicated, because we want to make sure that
441 // everything is properly nested. the code ought to make
442 // sure of that, but we won't assert (yet) if we run into
443 // a problem. we'll just output error messages and try our
444 // best to make things work.
445 XHTMLStream & XHTMLStream::operator<<(html::EndTag const & etag)
447 if (etag.tag_.empty())
450 // make sure there are tags to be closed
451 if (tag_stack_.empty()) {
452 writeError("Tried to close `" + etag.tag_
453 + "' when no tags were open!");
457 // first make sure we're not closing an empty tag
458 if (!pending_tags_.empty()) {
459 html::StartTag const & stag = pending_tags_.back();
460 if (etag.tag_ == stag.tag_) {
461 // we have <tag></tag>, so we discard it and remove it
462 // from the pending_tags_.
463 pending_tags_.pop_back();
466 // there is a pending tag that isn't the one we are trying
468 // is this tag itself pending?
469 // non-const iterators because we may call erase().
470 TagStack::iterator dit = pending_tags_.begin();
471 TagStack::iterator const den = pending_tags_.end();
472 for (; dit != den; ++dit) {
473 if (dit->tag_ == etag.tag_) {
474 // it was pending, so we just erase it
475 writeError("Tried to close pending tag `" + etag.tag_
476 + "' when other tags were pending. Last pending tag is `"
477 + pending_tags_.back().tag_ + "'. Tag discarded.");
478 pending_tags_.erase(dit);
482 // so etag isn't itself pending. is it even open?
483 if (!isTagOpen(etag.tag_)) {
484 writeError("Tried to close `" + etag.tag_
485 + "' when tag was not open. Tag discarded.");
488 // ok, so etag is open.
489 // our strategy will be as below: we will do what we need to
490 // do to close this tag.
491 string estr = "Closing tag `" + etag.tag_
492 + "' when other tags are pending. Discarded pending tags:\n";
493 for (dit = pending_tags_.begin(); dit != den; ++dit)
494 estr += dit->tag_ + "\n";
496 // clear the pending tags...
497 pending_tags_.clear();
498 // ...and then just fall through.
501 // is the tag we are closing the last one we opened?
502 if (etag.tag_ == tag_stack_.back().tag_) {
504 os_ << etag.asEndTag();
505 // ...and forget about it
506 tag_stack_.pop_back();
510 // we are trying to close a tag other than the one last opened.
511 // let's first see if this particular tag is still open somehow.
512 if (!isTagOpen(etag.tag_)) {
513 writeError("Tried to close `" + etag.tag_
514 + "' when tag was not open. Tag discarded.");
518 // so the tag was opened, but other tags have been opened since
519 // and not yet closed.
520 // if it's a font tag, though...
521 if (html::isFontTag(etag.tag_)) {
522 // it won't be a problem if the other tags open since this one
523 // are also font tags.
524 TagStack::const_reverse_iterator rit = tag_stack_.rbegin();
525 TagStack::const_reverse_iterator ren = tag_stack_.rend();
526 for (; rit != ren; ++rit) {
527 if (rit->tag_ == etag.tag_)
529 if (!html::isFontTag(rit->tag_)) {
530 // we'll just leave it and, presumably, have to close it later.
531 writeError("Unable to close font tag `" + etag.tag_
532 + "' due to open non-font tag `" + rit->tag_ + "'.");
538 // <em>this is <strong>bold
539 // and are being asked to closed em. we want:
540 // <em>this is <strong>bold</strong></em><strong>
541 // first, we close the intervening tags...
542 html::StartTag curtag = tag_stack_.back();
543 // ...remembering them in a stack.
545 while (curtag.tag_ != etag.tag_) {
546 os_ << curtag.asEndTag();
547 fontstack.push_back(curtag);
548 tag_stack_.pop_back();
549 curtag = tag_stack_.back();
551 // now close our tag...
552 os_ << etag.asEndTag();
553 tag_stack_.pop_back();
555 // ...and restore the other tags.
556 rit = fontstack.rbegin();
557 ren = fontstack.rend();
558 for (; rit != ren; ++rit)
559 pending_tags_.push_back(*rit);
563 // it wasn't a font tag.
564 // so other tags were opened before this one and not properly closed.
565 // so we'll close them, too. that may cause other issues later, but it
566 // at least guarantees proper nesting.
567 writeError("Closing tag `" + etag.tag_
568 + "' when other tags are open, namely:");
569 html::StartTag curtag = tag_stack_.back();
570 while (curtag.tag_ != etag.tag_) {
571 writeError(curtag.tag_);
572 if (curtag.tag_ != parsep_tag)
573 os_ << curtag.asEndTag();
574 tag_stack_.pop_back();
575 curtag = tag_stack_.back();
577 // curtag is now the one we actually want.
578 os_ << curtag.asEndTag();
579 tag_stack_.pop_back();
584 // End code for XHTMLStream
588 // convenience functions
590 inline void openTag(XHTMLStream & xs, Layout const & lay)
592 xs << html::StartTag(lay.htmltag(), lay.htmlattr());
596 void openTag(XHTMLStream & xs, Layout const & lay,
597 ParagraphParameters const & params)
599 // FIXME Are there other things we should handle here?
600 string const align = alignmentToCSS(params.align());
605 string attrs = lay.htmlattr() + " style='text-align: " + align + ";'";
606 xs << html::StartTag(lay.htmltag(), attrs);
610 inline void closeTag(XHTMLStream & xs, Layout const & lay)
612 xs << html::EndTag(lay.htmltag());
616 inline void openLabelTag(XHTMLStream & xs, Layout const & lay)
618 xs << html::StartTag(lay.htmllabeltag(), lay.htmllabelattr());
622 inline void closeLabelTag(XHTMLStream & xs, Layout const & lay)
624 xs << html::EndTag(lay.htmllabeltag());
628 inline void openItemTag(XHTMLStream & xs, Layout const & lay)
630 xs << html::StartTag(lay.htmlitemtag(), lay.htmlitemattr(), true);
634 void openItemTag(XHTMLStream & xs, Layout const & lay,
635 ParagraphParameters const & params)
637 // FIXME Are there other things we should handle here?
638 string const align = alignmentToCSS(params.align());
640 openItemTag(xs, lay);
643 string attrs = lay.htmlattr() + " style='text-align: " + align + ";'";
644 xs << html::StartTag(lay.htmlitemtag(), attrs);
648 inline void closeItemTag(XHTMLStream & xs, Layout const & lay)
650 xs << html::EndTag(lay.htmlitemtag());
653 // end of convenience functions
655 ParagraphList::const_iterator searchParagraphHtml(
656 ParagraphList::const_iterator p,
657 ParagraphList::const_iterator const & pend)
659 for (++p; p != pend && p->layout().latextype == LATEX_PARAGRAPH; ++p)
666 ParagraphList::const_iterator searchEnvironmentHtml(
667 ParagraphList::const_iterator const pstart,
668 ParagraphList::const_iterator const & pend)
670 ParagraphList::const_iterator p = pstart;
671 Layout const & bstyle = p->layout();
672 size_t const depth = p->params().depth();
673 for (++p; p != pend; ++p) {
674 Layout const & style = p->layout();
675 // It shouldn't happen that e.g. a section command occurs inside
676 // a quotation environment, at a higher depth, but as of 6/2009,
677 // it can happen. We pretend that it's just at lowest depth.
678 if (style.latextype == LATEX_COMMAND)
680 // If depth is down, we're done
681 if (p->params().depth() < depth)
683 // If depth is up, we're not done
684 if (p->params().depth() > depth)
686 // Now we know we are at the same depth
687 if (style.latextype == LATEX_PARAGRAPH
688 || style.latexname() != bstyle.latexname())
695 ParagraphList::const_iterator makeParagraphs(Buffer const & buf,
697 OutputParams const & runparams,
699 ParagraphList::const_iterator const & pbegin,
700 ParagraphList::const_iterator const & pend)
702 ParagraphList::const_iterator const begin = text.paragraphs().begin();
703 ParagraphList::const_iterator par = pbegin;
704 for (; par != pend; ++par) {
705 Layout const & lay = par->layout();
706 if (!lay.counter.empty())
707 buf.params().documentClass().counters().step(lay.counter, OutputUpdate);
708 // FIXME We should see if there's a label to be output and
709 // do something with it.
713 // If we are already in a paragraph, and this is the first one, then we
714 // do not want to open the paragraph tag.
715 // we also do not want to open it if the current layout does not permit
716 // multiple paragraphs.
717 bool const opened = runparams.html_make_pars &&
718 (par != pbegin || !runparams.html_in_par);
720 openTag(xs, lay, par->params());
721 docstring const deferred =
722 par->simpleLyXHTMLOnePar(buf, xs, runparams, text.outerFont(distance(begin, par)));
724 // We want to issue the closing tag if either:
725 // (i) We opened it, and either html_in_par is false,
726 // or we're not in the last paragraph, anyway.
727 // (ii) We didn't open it and html_in_par is true,
728 // but we are in the first par, and there is a next par.
729 ParagraphList::const_iterator nextpar = par;
731 bool const needclose =
732 (opened && (!runparams.html_in_par || nextpar != pend))
733 || (!opened && runparams.html_in_par && par == pbegin && nextpar != pend);
738 if (!deferred.empty()) {
739 xs << XHTMLStream::ESCAPE_NONE << deferred << html::CR();
746 ParagraphList::const_iterator makeBibliography(Buffer const & buf,
748 OutputParams const & runparams,
750 ParagraphList::const_iterator const & pbegin,
751 ParagraphList::const_iterator const & pend)
754 // Use TextClass::htmlTOCLayout() to figure out how we should look.
755 xs << html::StartTag("h2", "class='bibliography'")
756 << pbegin->layout().labelstring(false)
757 << html::EndTag("h2")
759 << html::StartTag("div", "class='bibliography'")
761 makeParagraphs(buf, xs, runparams, text, pbegin, pend);
762 xs << html::EndTag("div");
767 bool isNormalEnv(Layout const & lay)
769 return lay.latextype == LATEX_ENVIRONMENT
770 || lay.latextype == LATEX_BIB_ENVIRONMENT;
774 ParagraphList::const_iterator makeEnvironmentHtml(Buffer const & buf,
776 OutputParams const & runparams,
778 ParagraphList::const_iterator const & pbegin,
779 ParagraphList::const_iterator const & pend)
781 ParagraphList::const_iterator const begin = text.paragraphs().begin();
782 ParagraphList::const_iterator par = pbegin;
783 Layout const & bstyle = par->layout();
784 depth_type const origdepth = pbegin->params().depth();
786 // open tag for this environment
790 // we will on occasion need to remember a layout from before.
791 Layout const * lastlay = 0;
793 while (par != pend) {
794 Layout const & style = par->layout();
795 // the counter only gets stepped if we're in some kind of list,
796 // or if it's the first time through.
797 // note that enum, etc, are handled automatically.
798 // FIXME There may be a bug here about user defined enumeration
799 // types. If so, then we'll need to take the counter and add "i",
800 // "ii", etc, as with enum.
801 Counters & cnts = buf.params().documentClass().counters();
802 docstring const & cntr = style.counter;
803 if (!style.counter.empty()
804 && (par == pbegin || !isNormalEnv(style))
805 && cnts.hasCounter(cntr)
807 cnts.step(cntr, OutputUpdate);
808 ParagraphList::const_iterator send;
809 // this will be positive, if we want to skip the initial word
810 // (if it's been taken for the label).
813 switch (style.latextype) {
814 case LATEX_ENVIRONMENT:
815 case LATEX_LIST_ENVIRONMENT:
816 case LATEX_ITEM_ENVIRONMENT: {
817 // There are two possiblities in this case.
818 // One is that we are still in the environment in which we
819 // started---which we will be if the depth is the same.
820 if (par->params().depth() == origdepth) {
821 LASSERT(bstyle == style, /* */);
823 closeItemTag(xs, *lastlay);
827 bool const labelfirst = style.htmllabelfirst();
829 openItemTag(xs, style, par->params());
832 if (style.labeltype != LABEL_NO_LABEL &&
833 style.htmllabeltag() != "NONE") {
834 if (isNormalEnv(style)) {
835 // in this case, we print the label only for the first
836 // paragraph (as in a theorem).
838 docstring const lbl =
839 pbegin->params().labelString();
841 openLabelTag(xs, style);
843 closeLabelTag(xs, style);
847 } else { // some kind of list
848 if (style.labeltype == LABEL_MANUAL) {
849 openLabelTag(xs, style);
850 sep = par->firstWordLyXHTML(xs, runparams);
851 closeLabelTag(xs, style);
855 openLabelTag(xs, style);
856 xs << par->params().labelString();
857 closeLabelTag(xs, style);
861 } // end label output
864 openItemTag(xs, style, par->params());
866 par->simpleLyXHTMLOnePar(buf, xs, runparams,
867 text.outerFont(distance(begin, par)), sep);
870 // We may not want to close the tag yet, in particular:
871 // If we're not at the end...
873 // and are doing items...
874 && !isNormalEnv(style)
875 // and if the depth has changed...
876 && par->params().depth() != origdepth) {
877 // then we'll save this layout for later, and close it when
878 // we get another item.
881 closeItemTag(xs, style);
884 // The other possibility is that the depth has increased, in which
885 // case we need to recurse.
887 send = searchEnvironmentHtml(par, pend);
888 par = makeEnvironmentHtml(buf, xs, runparams, text, par, send);
892 case LATEX_PARAGRAPH:
893 send = searchParagraphHtml(par, pend);
894 par = makeParagraphs(buf, xs, runparams, text, par, send);
897 case LATEX_BIB_ENVIRONMENT:
900 par = makeParagraphs(buf, xs, runparams, text, par, send);
910 closeItemTag(xs, *lastlay);
911 closeTag(xs, bstyle);
917 void makeCommand(Buffer const & buf,
919 OutputParams const & runparams,
921 ParagraphList::const_iterator const & pbegin)
923 Layout const & style = pbegin->layout();
924 if (!style.counter.empty())
925 buf.params().documentClass().counters().step(style.counter, OutputUpdate);
927 openTag(xs, style, pbegin->params());
929 // Label around sectioning number:
930 // FIXME Probably need to account for LABEL_MANUAL
931 if (style.labeltype != LABEL_NO_LABEL) {
932 openLabelTag(xs, style);
933 xs << pbegin->params().labelString();
934 closeLabelTag(xs, style);
935 // Otherwise the label might run together with the text
936 xs << from_ascii(" ");
939 ParagraphList::const_iterator const begin = text.paragraphs().begin();
940 pbegin->simpleLyXHTMLOnePar(buf, xs, runparams,
941 text.outerFont(distance(begin, pbegin)));
946 } // end anonymous namespace
949 void xhtmlParagraphs(Text const & text,
952 OutputParams const & runparams)
954 ParagraphList const & paragraphs = text.paragraphs();
955 if (runparams.par_begin == runparams.par_end) {
956 runparams.par_begin = 0;
957 runparams.par_end = paragraphs.size();
959 pit_type bpit = runparams.par_begin;
960 pit_type const epit = runparams.par_end;
961 LASSERT(bpit < epit, /* */);
963 OutputParams ourparams = runparams;
964 ParagraphList::const_iterator const pend =
965 (epit == (int) paragraphs.size()) ?
966 paragraphs.end() : paragraphs.constIterator(epit);
967 while (bpit < epit) {
968 ParagraphList::const_iterator par = paragraphs.constIterator(bpit);
969 if (par->params().startOfAppendix()) {
970 // FIXME: only the counter corresponding to toplevel
971 // sectioning should be reset
972 Counters & cnts = buf.masterBuffer()->params().documentClass().counters();
976 Layout const & style = par->layout();
977 ParagraphList::const_iterator const lastpar = par;
978 ParagraphList::const_iterator send;
980 switch (style.latextype) {
981 case LATEX_COMMAND: {
982 // The files with which we are working never have more than
983 // one paragraph in a command structure.
985 // if (ourparams.html_in_par)
986 // fix it so we don't get sections inside standard, e.g.
987 // note that we may then need to make runparams not const, so we
988 // can communicate that back.
989 // FIXME Maybe this fix should be in the routines themselves, in case
990 // they are called from elsewhere.
991 makeCommand(buf, xs, ourparams, text, par);
995 case LATEX_ENVIRONMENT:
996 case LATEX_LIST_ENVIRONMENT:
997 case LATEX_ITEM_ENVIRONMENT: {
998 // FIXME Same fix here.
999 send = searchEnvironmentHtml(par, pend);
1000 par = makeEnvironmentHtml(buf, xs, ourparams, text, par, send);
1003 case LATEX_BIB_ENVIRONMENT: {
1004 // FIXME Same fix here.
1005 send = searchEnvironmentHtml(par, pend);
1006 par = makeBibliography(buf, xs, ourparams, text, par, send);
1009 case LATEX_PARAGRAPH:
1010 send = searchParagraphHtml(par, pend);
1011 par = makeParagraphs(buf, xs, ourparams, text, par, send);
1014 bpit += distance(lastpar, par);
1019 string alignmentToCSS(LyXAlignment align) {
1021 case LYX_ALIGN_BLOCK:
1022 // we are NOT going to use text-align: justify!!
1023 case LYX_ALIGN_LEFT:
1025 case LYX_ALIGN_RIGHT:
1027 case LYX_ALIGN_CENTER: