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"
39 // Uncomment to activate debugging code.
40 // #define XHTML_DEBUG
43 using namespace lyx::support;
50 docstring escapeChar(char_type c, XHTMLStream::EscapeSettings e)
54 case XHTMLStream::ESCAPE_NONE:
57 case XHTMLStream::ESCAPE_ALL:
61 } else if (c == '>') {
66 case XHTMLStream::ESCAPE_AND:
77 // escape what needs escaping
78 docstring htmlize(docstring const & str, XHTMLStream::EscapeSettings e)
81 docstring::const_iterator it = str.begin();
82 docstring::const_iterator en = str.end();
83 for (; it != en; ++it)
84 d << escapeChar(*it, e);
89 string escapeChar(char c, XHTMLStream::EscapeSettings e)
93 case XHTMLStream::ESCAPE_NONE:
96 case XHTMLStream::ESCAPE_ALL:
100 } else if (c == '>') {
105 case XHTMLStream::ESCAPE_AND:
116 // escape what needs escaping
117 string htmlize(string const & str, XHTMLStream::EscapeSettings e)
120 string::const_iterator it = str.begin();
121 string::const_iterator en = str.end();
122 for (; it != en; ++it)
123 d << escapeChar(*it, e);
128 string cleanAttr(string const & str)
131 string::const_iterator it = str.begin();
132 string::const_iterator en = str.end();
133 for (; it != en; ++it)
134 newname += isAlnumASCII(*it) ? *it : '_';
139 docstring cleanAttr(docstring const & str)
142 docstring::const_iterator it = str.begin();
143 docstring::const_iterator en = str.end();
144 for (; it != en; ++it) {
145 char_type const c = *it;
146 newname += isAlnumASCII(c) ? c : char_type('_');
152 bool isFontTag(string const & s)
154 return s == "em" || s == "strong" || s == "i" || s == "b"
155 || s == "dfn" || s == "kbd" || s == "var" || s == "samp"
156 || s == "del" || s == "u";
160 docstring StartTag::asTag() const
162 string output = "<" + tag_;
164 output += " " + html::htmlize(attr_, XHTMLStream::ESCAPE_NONE);
166 return from_utf8(output);
170 docstring StartTag::asEndTag() const
172 string output = "</" + tag_ + ">";
173 return from_utf8(output);
177 docstring EndTag::asEndTag() const
179 string output = "</" + tag_ + ">";
180 return from_utf8(output);
184 docstring CompTag::asTag() const
186 string output = "<" + tag_;
188 output += " " + html::htmlize(attr_, XHTMLStream::ESCAPE_NONE);
190 return from_utf8(output);
197 ////////////////////////////////////////////////////////////////
201 ////////////////////////////////////////////////////////////////
203 XHTMLStream::XHTMLStream(odocstream & os)
204 : os_(os), escape_(ESCAPE_ALL)
209 void XHTMLStream::dumpTagStack(string const & msg) const
211 writeError(msg + ": Tag Stack");
212 TagStack::const_reverse_iterator it = tag_stack_.rbegin();
213 TagStack::const_reverse_iterator en = tag_stack_.rend();
214 for (; it != en; ++it) {
215 writeError(it->tag_);
217 writeError("Pending Tags");
218 it = pending_tags_.rbegin();
219 en = pending_tags_.rend();
220 for (; it != en; ++it) {
221 writeError(it->tag_);
223 writeError("End Tag Stack");
228 void XHTMLStream::writeError(std::string const & s) const
231 os_ << from_utf8("<!-- Output Error: " + s + " -->\n");
236 // an illegal tag for internal use
237 static string const parsep_tag = "&LyX_parsep_tag&";
241 bool XHTMLStream::closeFontTags()
243 if (isTagPending(parsep_tag))
244 // we haven't had any content
247 // this may be a useless check, since we ought at least to have
248 // the parsep_tag. but it can't hurt too much to be careful.
249 if (tag_stack_.empty())
252 // first, we close any open font tags we can close
253 TagPtr curtag = tag_stack_.back();
254 while (html::isFontTag(curtag->tag_)) {
255 os_ << curtag->asEndTag();
256 tag_stack_.pop_back();
257 // this shouldn't happen, since then the font tags
258 // weren't in any other tag.
259 LBUFERR(!tag_stack_.empty());
260 curtag = tag_stack_.back();
263 if (curtag->tag_ == parsep_tag)
266 // so we've hit a non-font tag.
267 writeError("Tags still open in closeFontTags(). Probably not a problem,\n"
268 "but you might want to check these tags:");
269 TagDeque::const_reverse_iterator it = tag_stack_.rbegin();
270 TagDeque::const_reverse_iterator const en = tag_stack_.rend();
271 for (; it != en; ++it) {
272 string const tagname = (*it)->tag_;
273 if (tagname == parsep_tag)
275 writeError((*it)->tag_);
281 void XHTMLStream::startParagraph(bool keep_empty)
283 pending_tags_.push_back(makeTagPtr(html::StartTag(parsep_tag)));
289 void XHTMLStream::endParagraph()
291 if (isTagPending(parsep_tag)) {
292 // this case is normal. it just means we didn't have content,
293 // so the parsep_tag never got moved onto the tag stack.
294 while (!pending_tags_.empty()) {
295 // clear all pending tags up to and including the parsep tag.
296 // note that we work from the back, because we want to get rid
297 // of everything that hasn't been used.
298 TagPtr const cur_tag = pending_tags_.back();
299 pending_tags_.pop_back();
300 if (cur_tag->tag_ == parsep_tag)
306 if (!isTagOpen(parsep_tag)) {
307 writeError("No paragraph separation tag found in endParagraph().");
311 // this case is also normal, if the parsep tag is the last one
312 // on the stack. otherwise, it's an error.
313 while (!tag_stack_.empty()) {
314 TagPtr const cur_tag = tag_stack_.back();
315 tag_stack_.pop_back();
316 if (cur_tag->tag_ == parsep_tag)
318 writeError("Tag `" + cur_tag->tag_ + "' still open at end of paragraph. Closing.");
319 os_ << cur_tag->asEndTag();
324 void XHTMLStream::clearTagDeque()
326 while (!pending_tags_.empty()) {
327 TagPtr 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(makeTagPtr(tag));
401 XHTMLStream & XHTMLStream::operator<<(html::CompTag const & tag)
403 if (tag.tag_.empty())
412 XHTMLStream & XHTMLStream::operator<<(html::CR const &)
415 os_ << from_ascii("\n");
420 bool XHTMLStream::isTagOpen(string const & stag) const
422 TagDeque::const_iterator sit = tag_stack_.begin();
423 TagDeque::const_iterator const sen = tag_stack_.end();
424 for (; sit != sen; ++sit)
425 if ((*sit)->tag_ == stag)
431 bool XHTMLStream::isTagPending(string const & stag) const
433 TagDeque::const_iterator sit = pending_tags_.begin();
434 TagDeque::const_iterator const sen = pending_tags_.end();
435 for (; sit != sen; ++sit)
436 if ((*sit)->tag_ == stag)
442 // this is complicated, because we want to make sure that
443 // everything is properly nested. the code ought to make
444 // sure of that, but we won't assert (yet) if we run into
445 // a problem. we'll just output error messages and try our
446 // best to make things work.
447 XHTMLStream & XHTMLStream::operator<<(html::EndTag const & etag)
449 if (etag.tag_.empty())
452 // if this tag is pending, we can simply discard it.
453 if (!pending_tags_.empty()) {
455 if (etag.tag_ == pending_tags_.back()->tag_) {
456 // we have <tag></tag>, so we discard it and remove it
457 // from the pending_tags_.
458 pending_tags_.pop_back();
462 // there is a pending tag that isn't the one we are trying
465 // is this tag itself pending?
466 // non-const iterators because we may call erase().
467 TagDeque::iterator dit = pending_tags_.begin();
468 TagDeque::iterator const den = pending_tags_.end();
469 for (; dit != den; ++dit) {
470 if ((*dit)->tag_ == etag.tag_) {
471 // it was pending, so we just erase it
472 writeError("Tried to close pending tag `" + etag.tag_
473 + "' when other tags were pending. Last pending tag is `"
474 + pending_tags_.back()->tag_ + "'. Tag discarded.");
475 pending_tags_.erase(dit);
479 // so etag isn't itself pending. is it even open?
480 if (!isTagOpen(etag.tag_)) {
481 writeError("Tried to close `" + etag.tag_
482 + "' when tag was not open. Tag discarded.");
485 // ok, so etag is open.
486 // our strategy will be as below: we will do what we need to
487 // do to close this tag.
488 string estr = "Closing tag `" + etag.tag_
489 + "' when other tags are pending. Discarded pending tags:\n";
490 for (dit = pending_tags_.begin(); dit != den; ++dit)
491 estr += (*dit)->tag_ + "\n";
493 // clear the pending tags...
494 pending_tags_.clear();
495 // ...and then just fall through.
498 // make sure there are tags to be closed
499 if (tag_stack_.empty()) {
500 writeError("Tried to close `" + etag.tag_
501 + "' when no tags were open!");
505 // is the tag we are closing the last one we opened?
506 if (etag.tag_ == tag_stack_.back()->tag_) {
508 os_ << etag.asEndTag();
509 // ...and forget about it
510 tag_stack_.pop_back();
514 // we are trying to close a tag other than the one last opened.
515 // let's first see if this particular tag is still open somehow.
516 if (!isTagOpen(etag.tag_)) {
517 writeError("Tried to close `" + etag.tag_
518 + "' when tag was not open. Tag discarded.");
522 // so the tag was opened, but other tags have been opened since
523 // and not yet closed.
524 // if it's a font tag, though...
525 if (html::isFontTag(etag.tag_)) {
526 // it won't be a problem if the other tags open since this one
527 // are also font tags.
528 TagDeque::const_reverse_iterator rit = tag_stack_.rbegin();
529 TagDeque::const_reverse_iterator ren = tag_stack_.rend();
530 for (; rit != ren; ++rit) {
531 if ((*rit)->tag_ == etag.tag_)
533 if (!html::isFontTag((*rit)->tag_)) {
534 // we'll just leave it and, presumably, have to close it later.
535 writeError("Unable to close font tag `" + etag.tag_
536 + "' due to open non-font tag `" + (*rit)->tag_ + "'.");
542 // <em>this is <strong>bold
543 // and are being asked to closed em. we want:
544 // <em>this is <strong>bold</strong></em><strong>
545 // first, we close the intervening tags...
546 TagPtr curtag = tag_stack_.back();
547 // ...remembering them in a stack.
549 while (etag.tag_ != curtag->tag_) {
550 os_ << curtag->asEndTag();
551 fontstack.push_back(curtag);
552 tag_stack_.pop_back();
553 curtag = tag_stack_.back();
555 // now close our tag...
556 os_ << etag.asEndTag();
557 tag_stack_.pop_back();
559 // ...and restore the other tags.
560 rit = fontstack.rbegin();
561 ren = fontstack.rend();
562 for (; rit != ren; ++rit)
563 pending_tags_.push_back(*rit);
567 // it wasn't a font tag.
568 // so other tags were opened before this one and not properly closed.
569 // so we'll close them, too. that may cause other issues later, but it
570 // at least guarantees proper nesting.
571 writeError("Closing tag `" + etag.tag_
572 + "' when other tags are open, namely:");
573 TagPtr curtag = tag_stack_.back();
574 while (etag.tag_ != curtag->tag_) {
575 writeError(curtag->tag_);
576 if (curtag->tag_ != parsep_tag)
577 os_ << curtag->asEndTag();
578 tag_stack_.pop_back();
579 curtag = tag_stack_.back();
581 // curtag is now the one we actually want.
582 os_ << curtag->asEndTag();
583 tag_stack_.pop_back();
588 // End code for XHTMLStream
592 // convenience functions
594 inline void openTag(XHTMLStream & xs, Layout const & lay)
596 xs << html::StartTag(lay.htmltag(), lay.htmlattr());
600 void openTag(XHTMLStream & xs, Layout const & lay,
601 ParagraphParameters const & params)
603 // FIXME Are there other things we should handle here?
604 string const align = alignmentToCSS(params.align());
609 string attrs = lay.htmlattr() + " style='text-align: " + align + ";'";
610 xs << html::StartTag(lay.htmltag(), attrs);
614 inline void closeTag(XHTMLStream & xs, Layout const & lay)
616 xs << html::EndTag(lay.htmltag());
620 inline void openLabelTag(XHTMLStream & xs, Layout const & lay)
622 xs << html::StartTag(lay.htmllabeltag(), lay.htmllabelattr());
626 inline void closeLabelTag(XHTMLStream & xs, Layout const & lay)
628 xs << html::EndTag(lay.htmllabeltag());
632 inline void openItemTag(XHTMLStream & xs, Layout const & lay)
634 xs << html::StartTag(lay.htmlitemtag(), lay.htmlitemattr(), true);
638 void openItemTag(XHTMLStream & xs, Layout const & lay,
639 ParagraphParameters const & params)
641 // FIXME Are there other things we should handle here?
642 string const align = alignmentToCSS(params.align());
644 openItemTag(xs, lay);
647 string attrs = lay.htmlattr() + " style='text-align: " + align + ";'";
648 xs << html::StartTag(lay.htmlitemtag(), attrs);
652 inline void closeItemTag(XHTMLStream & xs, Layout const & lay)
654 xs << html::EndTag(lay.htmlitemtag());
657 // end of convenience functions
659 ParagraphList::const_iterator findLastParagraph(
660 ParagraphList::const_iterator p,
661 ParagraphList::const_iterator const & pend)
663 for (++p; p != pend && p->layout().latextype == LATEX_PARAGRAPH; ++p)
670 ParagraphList::const_iterator findEndOfEnvironment(
671 ParagraphList::const_iterator const pstart,
672 ParagraphList::const_iterator const & pend)
674 ParagraphList::const_iterator p = pstart;
675 Layout const & bstyle = p->layout();
676 size_t const depth = p->params().depth();
677 for (++p; p != pend; ++p) {
678 Layout const & style = p->layout();
679 // It shouldn't happen that e.g. a section command occurs inside
680 // a quotation environment, at a higher depth, but as of 6/2009,
681 // it can happen. We pretend that it's just at lowest depth.
682 if (style.latextype == LATEX_COMMAND)
684 // If depth is down, we're done
685 if (p->params().depth() < depth)
687 // If depth is up, we're not done
688 if (p->params().depth() > depth)
690 // Now we know we are at the same depth
691 if (style.latextype == LATEX_PARAGRAPH
692 || style.latexname() != bstyle.latexname())
699 ParagraphList::const_iterator makeParagraphs(Buffer const & buf,
701 OutputParams const & runparams,
703 ParagraphList::const_iterator const & pbegin,
704 ParagraphList::const_iterator const & pend)
706 ParagraphList::const_iterator const begin = text.paragraphs().begin();
707 ParagraphList::const_iterator par = pbegin;
708 for (; par != pend; ++par) {
709 Layout const & lay = par->layout();
710 if (!lay.counter.empty())
711 buf.masterBuffer()->params().
712 documentClass().counters().step(lay.counter, OutputUpdate);
713 // FIXME We should see if there's a label to be output and
714 // do something with it.
718 // If we are already in a paragraph, and this is the first one, then we
719 // do not want to open the paragraph tag.
720 // we also do not want to open it if the current layout does not permit
721 // multiple paragraphs.
722 bool const opened = runparams.html_make_pars &&
723 (par != pbegin || !runparams.html_in_par);
725 openTag(xs, lay, par->params());
726 docstring const deferred =
727 par->simpleLyXHTMLOnePar(buf, xs, runparams, text.outerFont(distance(begin, par)));
729 // We want to issue the closing tag if either:
730 // (i) We opened it, and either html_in_par is false,
731 // or we're not in the last paragraph, anyway.
732 // (ii) We didn't open it and html_in_par is true,
733 // but we are in the first par, and there is a next par.
734 ParagraphList::const_iterator nextpar = par;
736 bool const needclose =
737 (opened && (!runparams.html_in_par || nextpar != pend))
738 || (!opened && runparams.html_in_par && par == pbegin && nextpar != pend);
743 if (!deferred.empty()) {
744 xs << XHTMLStream::ESCAPE_NONE << deferred << html::CR();
751 ParagraphList::const_iterator makeBibliography(Buffer const & buf,
753 OutputParams const & runparams,
755 ParagraphList::const_iterator const & pbegin,
756 ParagraphList::const_iterator const & pend)
759 // Use TextClass::htmlTOCLayout() to figure out how we should look.
760 xs << html::StartTag("h2", "class='bibliography'")
761 << pbegin->layout().labelstring(false)
762 << html::EndTag("h2")
764 << html::StartTag("div", "class='bibliography'")
766 makeParagraphs(buf, xs, runparams, text, pbegin, pend);
767 xs << html::EndTag("div");
772 bool isNormalEnv(Layout const & lay)
774 return lay.latextype == LATEX_ENVIRONMENT
775 || lay.latextype == LATEX_BIB_ENVIRONMENT;
779 ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
781 OutputParams const & runparams,
783 ParagraphList::const_iterator const & pbegin,
784 ParagraphList::const_iterator const & pend)
786 ParagraphList::const_iterator const begin = text.paragraphs().begin();
787 ParagraphList::const_iterator par = pbegin;
788 Layout const & bstyle = par->layout();
789 depth_type const origdepth = pbegin->params().depth();
791 // open tag for this environment
795 // we will on occasion need to remember a layout from before.
796 Layout const * lastlay = 0;
798 while (par != pend) {
799 Layout const & style = par->layout();
800 // the counter only gets stepped if we're in some kind of list,
801 // or if it's the first time through.
802 // note that enum, etc, are handled automatically.
803 // FIXME There may be a bug here about user defined enumeration
804 // types. If so, then we'll need to take the counter and add "i",
805 // "ii", etc, as with enum.
806 Counters & cnts = buf.masterBuffer()->params().documentClass().counters();
807 docstring const & cntr = style.counter;
808 if (!style.counter.empty()
809 && (par == pbegin || !isNormalEnv(style))
810 && cnts.hasCounter(cntr)
812 cnts.step(cntr, OutputUpdate);
813 ParagraphList::const_iterator send;
814 // this will be positive, if we want to skip the initial word
815 // (if it's been taken for the label).
818 switch (style.latextype) {
819 case LATEX_ENVIRONMENT:
820 case LATEX_LIST_ENVIRONMENT:
821 case LATEX_ITEM_ENVIRONMENT: {
822 // There are two possiblities in this case.
823 // One is that we are still in the environment in which we
824 // started---which we will be if the depth is the same.
825 if (par->params().depth() == origdepth) {
826 LATTEST(bstyle == style);
828 closeItemTag(xs, *lastlay);
832 bool const labelfirst = style.htmllabelfirst();
834 openItemTag(xs, style, par->params());
837 if (style.labeltype != LABEL_NO_LABEL &&
838 style.htmllabeltag() != "NONE") {
839 if (isNormalEnv(style)) {
840 // in this case, we print the label only for the first
841 // paragraph (as in a theorem).
843 docstring const lbl =
844 pbegin->params().labelString();
846 openLabelTag(xs, style);
848 closeLabelTag(xs, style);
852 } else { // some kind of list
853 if (style.labeltype == LABEL_MANUAL) {
854 openLabelTag(xs, style);
855 sep = par->firstWordLyXHTML(xs, runparams);
856 closeLabelTag(xs, style);
860 openLabelTag(xs, style);
861 xs << par->params().labelString();
862 closeLabelTag(xs, style);
866 } // end label output
869 openItemTag(xs, style, par->params());
871 par->simpleLyXHTMLOnePar(buf, xs, runparams,
872 text.outerFont(distance(begin, par)), sep);
875 // We may not want to close the tag yet, in particular:
876 // If we're not at the end...
878 // and are doing items...
879 && !isNormalEnv(style)
880 // and if the depth has changed...
881 && par->params().depth() != origdepth) {
882 // then we'll save this layout for later, and close it when
883 // we get another item.
886 closeItemTag(xs, style);
889 // The other possibility is that the depth has increased, in which
890 // case we need to recurse.
892 send = findEndOfEnvironment(par, pend);
893 par = makeEnvironment(buf, xs, runparams, text, par, send);
897 case LATEX_PARAGRAPH:
898 send = findLastParagraph(par, pend);
899 par = makeParagraphs(buf, xs, runparams, text, par, send);
902 case LATEX_BIB_ENVIRONMENT:
905 par = makeParagraphs(buf, xs, runparams, text, par, send);
915 closeItemTag(xs, *lastlay);
916 closeTag(xs, bstyle);
922 void makeCommand(Buffer const & buf,
924 OutputParams const & runparams,
926 ParagraphList::const_iterator const & pbegin)
928 Layout const & style = pbegin->layout();
929 if (!style.counter.empty())
930 buf.masterBuffer()->params().
931 documentClass().counters().step(style.counter, OutputUpdate);
933 openTag(xs, style, pbegin->params());
935 // Label around sectioning number:
936 // FIXME Probably need to account for LABEL_MANUAL
937 // FIXME Probably also need now to account for labels ABOVE and CENTERED.
938 if (style.labeltype != LABEL_NO_LABEL) {
939 openLabelTag(xs, style);
940 xs << pbegin->params().labelString();
941 closeLabelTag(xs, style);
942 // Otherwise the label might run together with the text
943 xs << from_ascii(" ");
946 ParagraphList::const_iterator const begin = text.paragraphs().begin();
947 pbegin->simpleLyXHTMLOnePar(buf, xs, runparams,
948 text.outerFont(distance(begin, pbegin)));
953 } // end anonymous namespace
956 void xhtmlParagraphs(Text const & text,
959 OutputParams const & runparams)
961 ParagraphList const & paragraphs = text.paragraphs();
962 if (runparams.par_begin == runparams.par_end) {
963 runparams.par_begin = 0;
964 runparams.par_end = paragraphs.size();
966 pit_type bpit = runparams.par_begin;
967 pit_type const epit = runparams.par_end;
969 { xs << XHTMLStream::ESCAPE_NONE << "<!-- XHTML output error! -->\n"; return; });
971 OutputParams ourparams = runparams;
972 ParagraphList::const_iterator const pend =
973 (epit == (int) paragraphs.size()) ?
974 paragraphs.end() : paragraphs.constIterator(epit);
975 while (bpit < epit) {
976 ParagraphList::const_iterator par = paragraphs.constIterator(bpit);
977 if (par->params().startOfAppendix()) {
978 // We want to reset the counter corresponding to toplevel sectioning
980 buf.masterBuffer()->params().documentClass().getTOCLayout();
981 docstring const cnt = lay.counter;
984 buf.masterBuffer()->params().documentClass().counters();
988 Layout const & style = par->layout();
989 ParagraphList::const_iterator const lastpar = par;
990 ParagraphList::const_iterator send;
992 switch (style.latextype) {
993 case LATEX_COMMAND: {
994 // The files with which we are working never have more than
995 // one paragraph in a command structure.
997 // if (ourparams.html_in_par)
998 // fix it so we don't get sections inside standard, e.g.
999 // note that we may then need to make runparams not const, so we
1000 // can communicate that back.
1001 // FIXME Maybe this fix should be in the routines themselves, in case
1002 // they are called from elsewhere.
1003 makeCommand(buf, xs, ourparams, text, par);
1007 case LATEX_ENVIRONMENT:
1008 case LATEX_LIST_ENVIRONMENT:
1009 case LATEX_ITEM_ENVIRONMENT: {
1010 // FIXME Same fix here.
1011 send = findEndOfEnvironment(par, pend);
1012 par = makeEnvironment(buf, xs, ourparams, text, par, send);
1015 case LATEX_BIB_ENVIRONMENT: {
1016 // FIXME Same fix here.
1017 send = findEndOfEnvironment(par, pend);
1018 par = makeBibliography(buf, xs, ourparams, text, par, send);
1021 case LATEX_PARAGRAPH:
1022 send = findLastParagraph(par, pend);
1023 par = makeParagraphs(buf, xs, ourparams, text, par, send);
1026 bpit += distance(lastpar, par);
1031 string alignmentToCSS(LyXAlignment align)
1034 case LYX_ALIGN_BLOCK:
1035 // we are NOT going to use text-align: justify!!
1036 case LYX_ALIGN_LEFT:
1038 case LYX_ALIGN_RIGHT:
1040 case LYX_ALIGN_CENTER: