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)
77 docstring::const_iterator it = str.begin();
78 docstring::const_iterator en = str.end();
79 for (; it != en; ++it)
80 d << escapeChar(*it, e);
85 string escapeChar(char c, XHTMLStream::EscapeSettings e)
89 case XHTMLStream::ESCAPE_NONE:
92 case XHTMLStream::ESCAPE_ALL:
96 } else if (c == '>') {
101 case XHTMLStream::ESCAPE_AND:
112 // escape what needs escaping
113 string htmlize(string const & str, XHTMLStream::EscapeSettings e)
116 string::const_iterator it = str.begin();
117 string::const_iterator en = str.end();
118 for (; it != en; ++it)
119 d << escapeChar(*it, e);
124 string cleanAttr(string const & str)
127 string::const_iterator it = str.begin();
128 string::const_iterator en = str.end();
129 for (; it != en; ++it)
130 newname += isAlnumASCII(*it) ? *it : '_';
135 docstring cleanAttr(docstring const & str)
138 docstring::const_iterator it = str.begin();
139 docstring::const_iterator en = str.end();
140 for (; it != en; ++it) {
141 char_type const c = *it;
142 newname += isAlnumASCII(c) ? c : char_type('_');
148 bool isFontTag(string const & s)
150 return s == "em" || s == "strong" || s == "i" || s == "b"
151 || s == "dfn" || s == "kbd" || s == "var" || s == "samp"
152 || s == "del" || s == "u";
156 docstring StartTag::asTag() const
158 string output = "<" + tag_;
160 output += " " + html::htmlize(attr_, XHTMLStream::ESCAPE_NONE);
162 return from_utf8(output);
166 docstring StartTag::asEndTag() const
168 string output = "</" + tag_ + ">";
169 return from_utf8(output);
173 docstring EndTag::asEndTag() const
175 string output = "</" + tag_ + ">";
176 return from_utf8(output);
180 docstring CompTag::asTag() const
182 string output = "<" + tag_;
184 output += " " + html::htmlize(attr_, XHTMLStream::ESCAPE_NONE);
186 return from_utf8(output);
193 ////////////////////////////////////////////////////////////////
197 ////////////////////////////////////////////////////////////////
199 XHTMLStream::XHTMLStream(odocstream & os)
200 : os_(os), escape_(ESCAPE_ALL)
205 void XHTMLStream::dumpTagStack(string const & msg) const
207 writeError(msg + ": Tag Stack");
208 TagStack::const_reverse_iterator it = tag_stack_.rbegin();
209 TagStack::const_reverse_iterator en = tag_stack_.rend();
210 for (; it != en; ++it) {
211 writeError(it->tag_);
213 writeError("Pending Tags");
214 it = pending_tags_.rbegin();
215 en = pending_tags_.rend();
216 for (; it != en; ++it) {
217 writeError(it->tag_);
219 writeError("End Tag Stack");
224 void XHTMLStream::writeError(std::string const & s) const
227 os_ << from_utf8("<!-- Output Error: " + s + " -->\n");
232 // an illegal tag for internal use
233 static string const parsep_tag = "&LyX_parsep_tag&";
237 bool XHTMLStream::closeFontTags()
239 if (isTagPending(parsep_tag))
240 // we haven't had any content
243 // this may be a useless check, since we ought at least to have
244 // the parsep_tag. but it can't hurt too much to be careful.
245 if (tag_stack_.empty())
248 // first, we close any open font tags we can close
249 html::StartTag curtag = tag_stack_.back();
250 while (html::isFontTag(curtag.tag_)) {
251 os_ << curtag.asEndTag();
252 tag_stack_.pop_back();
253 if (tag_stack_.empty())
254 // this probably shouldn't happen, since then the
255 // font tags weren't in any other tag. but that
256 // problem will likely be caught elsewhere.
258 curtag = tag_stack_.back();
261 if (curtag.tag_ == parsep_tag)
264 // so we've hit a non-font tag.
265 writeError("Tags still open in closeFontTags(). Probably not a problem,\n"
266 "but you might want to check these tags:");
267 TagStack::const_reverse_iterator it = tag_stack_.rbegin();
268 TagStack::const_reverse_iterator const en = tag_stack_.rend();
269 for (; it != en; ++it) {
270 string const tagname = it->tag_;
271 if (tagname == parsep_tag)
273 writeError(it->tag_);
279 void XHTMLStream::startParagraph(bool keep_empty)
281 pending_tags_.push_back(html::StartTag(parsep_tag));
287 void XHTMLStream::endParagraph()
289 if (isTagPending(parsep_tag)) {
290 // this case is normal. it just means we didn't have content,
291 // so the parsep_tag never got moved onto the tag stack.
292 while (!pending_tags_.empty()) {
293 // clear all pending tags up to and including the parsep tag.
294 // note that we work from the back, because we want to get rid
295 // of everything that hasn't been used.
296 html::StartTag const cur_tag = pending_tags_.back();
297 string const & tag = cur_tag.tag_;
298 pending_tags_.pop_back();
299 if (tag == parsep_tag)
305 if (!isTagOpen(parsep_tag)) {
306 writeError("No paragraph separation tag found in endParagraph().");
310 // this case is also normal, if the parsep tag is the last one
311 // on the stack. otherwise, it's an error.
312 while (!tag_stack_.empty()) {
313 html::StartTag const cur_tag = tag_stack_.back();
314 string const & tag = cur_tag.tag_;
315 tag_stack_.pop_back();
316 if (tag == parsep_tag)
318 writeError("Tag `" + tag + "' still open at end of paragraph. Closing.");
319 os_ << cur_tag.asEndTag();
324 void XHTMLStream::clearTagDeque()
326 while (!pending_tags_.empty()) {
327 html::StartTag const & tag = pending_tags_.front();
328 if (tag.tag_ != parsep_tag)
331 tag_stack_.push_back(tag);
332 pending_tags_.pop_front();
337 XHTMLStream & XHTMLStream::operator<<(docstring const & d)
340 os_ << html::htmlize(d, escape_);
341 escape_ = ESCAPE_ALL;
346 XHTMLStream & XHTMLStream::operator<<(const char * s)
349 docstring const d = from_ascii(s);
350 os_ << html::htmlize(d, escape_);
351 escape_ = ESCAPE_ALL;
356 XHTMLStream & XHTMLStream::operator<<(char_type c)
359 os_ << html::escapeChar(c, escape_);
360 escape_ = ESCAPE_ALL;
365 XHTMLStream & XHTMLStream::operator<<(char c)
368 string const d = html::escapeChar(c, escape_);
369 escape_ = ESCAPE_ALL;
374 XHTMLStream & XHTMLStream::operator<<(int i)
378 escape_ = ESCAPE_ALL;
383 XHTMLStream & XHTMLStream::operator<<(EscapeSettings e)
390 XHTMLStream & XHTMLStream::operator<<(html::StartTag const & tag)
392 if (tag.tag_.empty())
394 pending_tags_.push_back(tag);
401 XHTMLStream & XHTMLStream::operator<<(html::CompTag const & tag)
403 if (tag.tag_.empty())
413 XHTMLStream & XHTMLStream::operator<<(html::CR const &)
416 os_ << from_ascii("\n");
421 bool XHTMLStream::isTagOpen(string const & stag) const
423 TagStack::const_iterator sit = tag_stack_.begin();
424 TagStack::const_iterator const sen = tag_stack_.end();
425 for (; sit != sen; ++sit)
426 if (sit->tag_ == stag)
432 bool XHTMLStream::isTagPending(string const & stag) const
434 TagStack::const_iterator sit = pending_tags_.begin();
435 TagStack::const_iterator const sen = pending_tags_.end();
436 for (; sit != sen; ++sit)
437 if (sit->tag_ == stag)
443 // this is complicated, because we want to make sure that
444 // everything is properly nested. the code ought to make
445 // sure of that, but we won't assert (yet) if we run into
446 // a problem. we'll just output error messages and try our
447 // best to make things work.
448 XHTMLStream & XHTMLStream::operator<<(html::EndTag const & etag)
450 if (etag.tag_.empty())
453 // make sure there are tags to be closed
454 if (tag_stack_.empty()) {
455 writeError("Tried to close `" + etag.tag_
456 + "' when no tags were open!");
460 // first make sure we're not closing an empty tag
461 if (!pending_tags_.empty()) {
462 html::StartTag const & stag = pending_tags_.back();
463 if (etag.tag_ == stag.tag_) {
464 // we have <tag></tag>, so we discard it and remove it
465 // from the pending_tags_.
466 pending_tags_.pop_back();
469 // there is a pending tag that isn't the one we are trying
471 // is this tag itself pending?
472 // non-const iterators because we may call erase().
473 TagStack::iterator dit = pending_tags_.begin();
474 TagStack::iterator const den = pending_tags_.end();
475 for (; dit != den; ++dit) {
476 if (dit->tag_ == etag.tag_) {
477 // it was pending, so we just erase it
478 writeError("Tried to close pending tag `" + etag.tag_
479 + "' when other tags were pending. Last pending tag is `"
480 + pending_tags_.back().tag_ + "'. Tag discarded.");
481 pending_tags_.erase(dit);
485 // so etag isn't itself pending. is it even open?
486 if (!isTagOpen(etag.tag_)) {
487 writeError("Tried to close `" + etag.tag_
488 + "' when tag was not open. Tag discarded.");
491 // ok, so etag is open.
492 // our strategy will be as below: we will do what we need to
493 // do to close this tag.
494 string estr = "Closing tag `" + etag.tag_
495 + "' when other tags are pending. Discarded pending tags:\n";
496 for (dit = pending_tags_.begin(); dit != den; ++dit)
497 estr += dit->tag_ + "\n";
499 // clear the pending tags...
500 pending_tags_.clear();
501 // ...and then just fall through.
504 // is the tag we are closing the last one we opened?
505 if (etag.tag_ == tag_stack_.back().tag_) {
507 os_ << etag.asEndTag();
508 // ...and forget about it
509 tag_stack_.pop_back();
513 // we are trying to close a tag other than the one last opened.
514 // let's first see if this particular tag is still open somehow.
515 if (!isTagOpen(etag.tag_)) {
516 writeError("Tried to close `" + etag.tag_
517 + "' when tag was not open. Tag discarded.");
521 // so the tag was opened, but other tags have been opened since
522 // and not yet closed.
523 // if it's a font tag, though...
524 if (html::isFontTag(etag.tag_)) {
525 // it won't be a problem if the other tags open since this one
526 // are also font tags.
527 TagStack::const_reverse_iterator rit = tag_stack_.rbegin();
528 TagStack::const_reverse_iterator ren = tag_stack_.rend();
529 for (; rit != ren; ++rit) {
530 if (rit->tag_ == etag.tag_)
532 if (!html::isFontTag(rit->tag_)) {
533 // we'll just leave it and, presumably, have to close it later.
534 writeError("Unable to close font tag `" + etag.tag_
535 + "' due to open non-font tag `" + rit->tag_ + "'.");
541 // <em>this is <strong>bold
542 // and are being asked to closed em. we want:
543 // <em>this is <strong>bold</strong></em><strong>
544 // first, we close the intervening tags...
545 html::StartTag curtag = tag_stack_.back();
546 // ...remembering them in a stack.
548 while (curtag.tag_ != etag.tag_) {
549 os_ << curtag.asEndTag();
550 fontstack.push_back(curtag);
551 tag_stack_.pop_back();
552 curtag = tag_stack_.back();
554 // now close our tag...
555 os_ << etag.asEndTag();
556 tag_stack_.pop_back();
558 // ...and restore the other tags.
559 rit = fontstack.rbegin();
560 ren = fontstack.rend();
561 for (; rit != ren; ++rit)
562 pending_tags_.push_back(*rit);
566 // it wasn't a font tag.
567 // so other tags were opened before this one and not properly closed.
568 // so we'll close them, too. that may cause other issues later, but it
569 // at least guarantees proper nesting.
570 writeError("Closing tag `" + etag.tag_
571 + "' when other tags are open, namely:");
572 html::StartTag curtag = tag_stack_.back();
573 while (curtag.tag_ != etag.tag_) {
574 writeError(curtag.tag_);
575 if (curtag.tag_ != parsep_tag)
576 os_ << curtag.asEndTag();
577 tag_stack_.pop_back();
578 curtag = tag_stack_.back();
580 // curtag is now the one we actually want.
581 os_ << curtag.asEndTag();
582 tag_stack_.pop_back();
587 // End code for XHTMLStream
591 // convenience functions
593 inline void openTag(XHTMLStream & xs, Layout const & lay)
595 xs << html::StartTag(lay.htmltag(), lay.htmlattr());
599 void openTag(XHTMLStream & xs, Layout const & lay,
600 ParagraphParameters const & params)
602 // FIXME Are there other things we should handle here?
603 string const align = alignmentToCSS(params.align());
608 string attrs = lay.htmlattr() + " style='text-align: " + align + ";'";
609 xs << html::StartTag(lay.htmltag(), attrs);
613 inline void closeTag(XHTMLStream & xs, Layout const & lay)
615 xs << html::EndTag(lay.htmltag());
619 inline void openLabelTag(XHTMLStream & xs, Layout const & lay)
621 xs << html::StartTag(lay.htmllabeltag(), lay.htmllabelattr());
625 inline void closeLabelTag(XHTMLStream & xs, Layout const & lay)
627 xs << html::EndTag(lay.htmllabeltag());
631 inline void openItemTag(XHTMLStream & xs, Layout const & lay)
633 xs << html::StartTag(lay.htmlitemtag(), lay.htmlitemattr(), true);
637 void openItemTag(XHTMLStream & xs, Layout const & lay,
638 ParagraphParameters const & params)
640 // FIXME Are there other things we should handle here?
641 string const align = alignmentToCSS(params.align());
643 openItemTag(xs, lay);
646 string attrs = lay.htmlattr() + " style='text-align: " + align + ";'";
647 xs << html::StartTag(lay.htmlitemtag(), attrs);
651 inline void closeItemTag(XHTMLStream & xs, Layout const & lay)
653 xs << html::EndTag(lay.htmlitemtag());
656 // end of convenience functions
658 ParagraphList::const_iterator searchParagraph(
659 ParagraphList::const_iterator p,
660 ParagraphList::const_iterator const & pend)
662 for (++p; p != pend && p->layout().latextype == LATEX_PARAGRAPH; ++p)
669 ParagraphList::const_iterator searchEnvironment(
670 ParagraphList::const_iterator const pstart,
671 ParagraphList::const_iterator const & pend)
673 ParagraphList::const_iterator p = pstart;
674 Layout const & bstyle = p->layout();
675 size_t const depth = p->params().depth();
676 for (++p; p != pend; ++p) {
677 Layout const & style = p->layout();
678 // It shouldn't happen that e.g. a section command occurs inside
679 // a quotation environment, at a higher depth, but as of 6/2009,
680 // it can happen. We pretend that it's just at lowest depth.
681 if (style.latextype == LATEX_COMMAND)
683 // If depth is down, we're done
684 if (p->params().depth() < depth)
686 // If depth is up, we're not done
687 if (p->params().depth() > depth)
689 // Now we know we are at the same depth
690 if (style.latextype == LATEX_PARAGRAPH
691 || style.latexname() != bstyle.latexname())
698 ParagraphList::const_iterator makeParagraphs(Buffer const & buf,
700 OutputParams const & runparams,
702 ParagraphList::const_iterator const & pbegin,
703 ParagraphList::const_iterator const & pend)
705 ParagraphList::const_iterator const begin = text.paragraphs().begin();
706 ParagraphList::const_iterator par = pbegin;
707 for (; par != pend; ++par) {
708 Layout const & lay = par->layout();
709 if (!lay.counter.empty())
710 buf.masterBuffer()->params().
711 documentClass().counters().step(lay.counter, OutputUpdate);
712 // FIXME We should see if there's a label to be output and
713 // do something with it.
717 // If we are already in a paragraph, and this is the first one, then we
718 // do not want to open the paragraph tag.
719 // we also do not want to open it if the current layout does not permit
720 // multiple paragraphs.
721 bool const opened = runparams.html_make_pars &&
722 (par != pbegin || !runparams.html_in_par);
724 openTag(xs, lay, par->params());
725 docstring const deferred =
726 par->simpleLyXHTMLOnePar(buf, xs, runparams, text.outerFont(distance(begin, par)));
728 // We want to issue the closing tag if either:
729 // (i) We opened it, and either html_in_par is false,
730 // or we're not in the last paragraph, anyway.
731 // (ii) We didn't open it and html_in_par is true,
732 // but we are in the first par, and there is a next par.
733 ParagraphList::const_iterator nextpar = par;
735 bool const needclose =
736 (opened && (!runparams.html_in_par || nextpar != pend))
737 || (!opened && runparams.html_in_par && par == pbegin && nextpar != pend);
742 if (!deferred.empty()) {
743 xs << XHTMLStream::ESCAPE_NONE << deferred << html::CR();
750 ParagraphList::const_iterator makeBibliography(Buffer const & buf,
752 OutputParams const & runparams,
754 ParagraphList::const_iterator const & pbegin,
755 ParagraphList::const_iterator const & pend)
758 // Use TextClass::htmlTOCLayout() to figure out how we should look.
759 xs << html::StartTag("h2", "class='bibliography'")
760 << pbegin->layout().labelstring(false)
761 << html::EndTag("h2")
763 << html::StartTag("div", "class='bibliography'")
765 makeParagraphs(buf, xs, runparams, text, pbegin, pend);
766 xs << html::EndTag("div");
771 bool isNormalEnv(Layout const & lay)
773 return lay.latextype == LATEX_ENVIRONMENT
774 || lay.latextype == LATEX_BIB_ENVIRONMENT;
778 ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
780 OutputParams const & runparams,
782 ParagraphList::const_iterator const & pbegin,
783 ParagraphList::const_iterator const & pend)
785 ParagraphList::const_iterator const begin = text.paragraphs().begin();
786 ParagraphList::const_iterator par = pbegin;
787 Layout const & bstyle = par->layout();
788 depth_type const origdepth = pbegin->params().depth();
790 // open tag for this environment
794 // we will on occasion need to remember a layout from before.
795 Layout const * lastlay = 0;
797 while (par != pend) {
798 Layout const & style = par->layout();
799 // the counter only gets stepped if we're in some kind of list,
800 // or if it's the first time through.
801 // note that enum, etc, are handled automatically.
802 // FIXME There may be a bug here about user defined enumeration
803 // types. If so, then we'll need to take the counter and add "i",
804 // "ii", etc, as with enum.
805 Counters & cnts = buf.masterBuffer()->params().documentClass().counters();
806 docstring const & cntr = style.counter;
807 if (!style.counter.empty()
808 && (par == pbegin || !isNormalEnv(style))
809 && cnts.hasCounter(cntr)
811 cnts.step(cntr, OutputUpdate);
812 ParagraphList::const_iterator send;
813 // this will be positive, if we want to skip the initial word
814 // (if it's been taken for the label).
817 switch (style.latextype) {
818 case LATEX_ENVIRONMENT:
819 case LATEX_LIST_ENVIRONMENT:
820 case LATEX_ITEM_ENVIRONMENT: {
821 // There are two possiblities in this case.
822 // One is that we are still in the environment in which we
823 // started---which we will be if the depth is the same.
824 if (par->params().depth() == origdepth) {
825 LATTEST(bstyle == style);
827 closeItemTag(xs, *lastlay);
831 bool const labelfirst = style.htmllabelfirst();
833 openItemTag(xs, style, par->params());
836 if (style.labeltype != LABEL_NO_LABEL &&
837 style.htmllabeltag() != "NONE") {
838 if (isNormalEnv(style)) {
839 // in this case, we print the label only for the first
840 // paragraph (as in a theorem).
842 docstring const lbl =
843 pbegin->params().labelString();
845 openLabelTag(xs, style);
847 closeLabelTag(xs, style);
851 } else { // some kind of list
852 if (style.labeltype == LABEL_MANUAL) {
853 openLabelTag(xs, style);
854 sep = par->firstWordLyXHTML(xs, runparams);
855 closeLabelTag(xs, style);
859 openLabelTag(xs, style);
860 xs << par->params().labelString();
861 closeLabelTag(xs, style);
865 } // end label output
868 openItemTag(xs, style, par->params());
870 par->simpleLyXHTMLOnePar(buf, xs, runparams,
871 text.outerFont(distance(begin, par)), sep);
874 // We may not want to close the tag yet, in particular:
875 // If we're not at the end...
877 // and are doing items...
878 && !isNormalEnv(style)
879 // and if the depth has changed...
880 && par->params().depth() != origdepth) {
881 // then we'll save this layout for later, and close it when
882 // we get another item.
885 closeItemTag(xs, style);
888 // The other possibility is that the depth has increased, in which
889 // case we need to recurse.
891 send = searchEnvironment(par, pend);
892 par = makeEnvironment(buf, xs, runparams, text, par, send);
896 case LATEX_PARAGRAPH:
897 send = searchParagraph(par, pend);
898 par = makeParagraphs(buf, xs, runparams, text, par, send);
901 case LATEX_BIB_ENVIRONMENT:
904 par = makeParagraphs(buf, xs, runparams, text, par, send);
914 closeItemTag(xs, *lastlay);
915 closeTag(xs, bstyle);
921 void makeCommand(Buffer const & buf,
923 OutputParams const & runparams,
925 ParagraphList::const_iterator const & pbegin)
927 Layout const & style = pbegin->layout();
928 if (!style.counter.empty())
929 buf.masterBuffer()->params().
930 documentClass().counters().step(style.counter, OutputUpdate);
932 openTag(xs, style, pbegin->params());
934 // Label around sectioning number:
935 // FIXME Probably need to account for LABEL_MANUAL
936 // FIXME Probably also need now to account for labels ABOVE and CENTERED.
937 if (style.labeltype != LABEL_NO_LABEL) {
938 openLabelTag(xs, style);
939 xs << pbegin->params().labelString();
940 closeLabelTag(xs, style);
941 // Otherwise the label might run together with the text
942 xs << from_ascii(" ");
945 ParagraphList::const_iterator const begin = text.paragraphs().begin();
946 pbegin->simpleLyXHTMLOnePar(buf, xs, runparams,
947 text.outerFont(distance(begin, pbegin)));
952 } // end anonymous namespace
955 void xhtmlParagraphs(Text const & text,
958 OutputParams const & runparams)
960 ParagraphList const & paragraphs = text.paragraphs();
961 if (runparams.par_begin == runparams.par_end) {
962 runparams.par_begin = 0;
963 runparams.par_end = paragraphs.size();
965 pit_type bpit = runparams.par_begin;
966 pit_type const epit = runparams.par_end;
968 { xs << XHTMLStream::ESCAPE_NONE << "<!-- XHTML output error! -->\n"; return; });
970 OutputParams ourparams = runparams;
971 ParagraphList::const_iterator const pend =
972 (epit == (int) paragraphs.size()) ?
973 paragraphs.end() : paragraphs.constIterator(epit);
974 while (bpit < epit) {
975 ParagraphList::const_iterator par = paragraphs.constIterator(bpit);
976 if (par->params().startOfAppendix()) {
977 // We want to reset the counter corresponding to toplevel sectioning
979 buf.masterBuffer()->params().documentClass().getTOCLayout();
980 docstring const cnt = lay.counter;
983 buf.masterBuffer()->params().documentClass().counters();
987 Layout const & style = par->layout();
988 ParagraphList::const_iterator const lastpar = par;
989 ParagraphList::const_iterator send;
991 switch (style.latextype) {
992 case LATEX_COMMAND: {
993 // The files with which we are working never have more than
994 // one paragraph in a command structure.
996 // if (ourparams.html_in_par)
997 // fix it so we don't get sections inside standard, e.g.
998 // note that we may then need to make runparams not const, so we
999 // can communicate that back.
1000 // FIXME Maybe this fix should be in the routines themselves, in case
1001 // they are called from elsewhere.
1002 makeCommand(buf, xs, ourparams, text, par);
1006 case LATEX_ENVIRONMENT:
1007 case LATEX_LIST_ENVIRONMENT:
1008 case LATEX_ITEM_ENVIRONMENT: {
1009 // FIXME Same fix here.
1010 send = searchEnvironment(par, pend);
1011 par = makeEnvironment(buf, xs, ourparams, text, par, send);
1014 case LATEX_BIB_ENVIRONMENT: {
1015 // FIXME Same fix here.
1016 send = searchEnvironment(par, pend);
1017 par = makeBibliography(buf, xs, ourparams, text, par, send);
1020 case LATEX_PARAGRAPH:
1021 send = searchParagraph(par, pend);
1022 par = makeParagraphs(buf, xs, ourparams, text, par, send);
1025 bpit += distance(lastpar, par);
1030 string alignmentToCSS(LyXAlignment align)
1033 case LYX_ALIGN_BLOCK:
1034 // we are NOT going to use text-align: justify!!
1035 case LYX_ALIGN_LEFT:
1037 case LYX_ALIGN_RIGHT:
1039 case LYX_ALIGN_CENTER: