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 += isalnum(*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 (!isTagOpen(parsep_tag)) {
288 TagStack::const_iterator dit = pending_tags_.begin();
289 TagStack::const_iterator const den = pending_tags_.end();
291 for (; dit != den; ++dit) {
292 if (dit->tag_ == parsep_tag) {
299 writeError("No paragraph separation tag found in endParagraph().");
303 // this case is normal.
304 while (!pending_tags_.empty()) {
305 // clear all pending tags up to and including the parsep tag.
306 // note that we work from the back, because we want to get rid
307 // of everything that hasnt' been used.
308 html::StartTag const cur_tag = pending_tags_.back();
309 string const & tag = cur_tag.tag_;
310 tag_stack_.pop_back();
311 if (tag == parsep_tag)
317 // this case is also normal, if the parsep tag is the last one
318 // on the stack. otherwise, it's an error.
319 while (!tag_stack_.empty()) {
320 html::StartTag const cur_tag = tag_stack_.back();
321 string const & tag = cur_tag.tag_;
322 tag_stack_.pop_back();
323 if (tag == parsep_tag)
325 writeError("Tag `" + tag + "' still open at end of paragraph. Closing.");
326 os_ << cur_tag.asEndTag();
331 void XHTMLStream::clearTagDeque()
333 while (!pending_tags_.empty()) {
334 html::StartTag const & tag = pending_tags_.front();
335 if (tag.tag_ != parsep_tag)
338 tag_stack_.push_back(tag);
339 pending_tags_.pop_front();
344 XHTMLStream & XHTMLStream::operator<<(docstring const & d)
347 os_ << html::htmlize(d, escape_);
348 escape_ = ESCAPE_ALL;
353 XHTMLStream & XHTMLStream::operator<<(const char * s)
356 docstring const d = from_ascii(s);
357 os_ << html::htmlize(d, escape_);
358 escape_ = ESCAPE_ALL;
363 XHTMLStream & XHTMLStream::operator<<(char_type c)
366 os_ << html::escapeChar(c, escape_);
367 escape_ = ESCAPE_ALL;
372 XHTMLStream & XHTMLStream::operator<<(char c)
375 string const d = html::escapeChar(c, escape_);
376 escape_ = ESCAPE_ALL;
381 XHTMLStream & XHTMLStream::operator<<(int i)
385 escape_ = ESCAPE_ALL;
390 XHTMLStream & XHTMLStream::operator<<(EscapeSettings e)
397 XHTMLStream & XHTMLStream::operator<<(html::StartTag const & tag)
399 if (tag.tag_.empty())
401 pending_tags_.push_back(tag);
408 XHTMLStream & XHTMLStream::operator<<(html::CompTag const & tag)
410 if (tag.tag_.empty())
420 XHTMLStream & XHTMLStream::operator<<(html::CR const &)
423 os_ << from_ascii("\n");
428 bool XHTMLStream::isTagOpen(string const & stag) const
430 TagStack::const_iterator sit = tag_stack_.begin();
431 TagStack::const_iterator const sen = tag_stack_.end();
432 for (; sit != sen; ++sit)
433 if (sit->tag_ == stag)
439 bool XHTMLStream::isTagPending(string const & stag) const
441 TagStack::const_iterator sit = pending_tags_.begin();
442 TagStack::const_iterator const sen = pending_tags_.end();
443 for (; sit != sen; ++sit)
444 if (sit->tag_ == stag)
450 // this is complicated, because we want to make sure that
451 // everything is properly nested. the code ought to make
452 // sure of that, but we won't assert (yet) if we run into
453 // a problem. we'll just output error messages and try our
454 // best to make things work.
455 XHTMLStream & XHTMLStream::operator<<(html::EndTag const & etag)
457 if (etag.tag_.empty())
460 // make sure there are tags to be closed
461 if (tag_stack_.empty()) {
462 writeError("Tried to close `" + etag.tag_
463 + "' when no tags were open!");
467 // first make sure we're not closing an empty tag
468 if (!pending_tags_.empty()) {
469 html::StartTag const & stag = pending_tags_.back();
470 if (etag.tag_ == stag.tag_) {
471 // we have <tag></tag>, so we discard it and remove it
472 // from the pending_tags_.
473 pending_tags_.pop_back();
476 // there is a pending tag that isn't the one we are trying
478 // is this tag itself pending?
479 // non-const iterators because we may call erase().
480 TagStack::iterator dit = pending_tags_.begin();
481 TagStack::iterator const den = pending_tags_.end();
482 for (; dit != den; ++dit) {
483 if (dit->tag_ == etag.tag_) {
484 // it was pending, so we just erase it
485 writeError("Tried to close pending tag `" + etag.tag_
486 + "' when other tags were pending. Last pending tag is `"
487 + pending_tags_.back().tag_ + "'. Tag discarded.");
488 pending_tags_.erase(dit);
492 // so etag isn't itself pending. is it even open?
493 if (!isTagOpen(etag.tag_)) {
494 writeError("Tried to close `" + etag.tag_
495 + "' when tag was not open. Tag discarded.");
498 // ok, so etag is open.
499 // our strategy will be as below: we will do what we need to
500 // do to close this tag.
501 string estr = "Closing tag `" + etag.tag_
502 + "' when other tags are pending. Discarded pending tags:\n";
503 for (dit = pending_tags_.begin(); dit != den; ++dit)
504 estr += dit->tag_ + "\n";
506 // clear the pending tags...
507 pending_tags_.clear();
508 // ...and then just fall through.
511 // is the tag we are closing the last one we opened?
512 if (etag.tag_ == tag_stack_.back().tag_) {
514 os_ << etag.asEndTag();
515 // ...and forget about it
516 tag_stack_.pop_back();
520 // we are trying to close a tag other than the one last opened.
521 // let's first see if this particular tag is still open somehow.
522 if (!isTagOpen(etag.tag_)) {
523 writeError("Tried to close `" + etag.tag_
524 + "' when tag was not open. Tag discarded.");
528 // so the tag was opened, but other tags have been opened since
529 // and not yet closed.
530 // if it's a font tag, though...
531 if (html::isFontTag(etag.tag_)) {
532 // it won't be a problem if the other tags open since this one
533 // are also font tags.
534 TagStack::const_reverse_iterator rit = tag_stack_.rbegin();
535 TagStack::const_reverse_iterator ren = tag_stack_.rend();
536 for (; rit != ren; ++rit) {
537 if (rit->tag_ == etag.tag_)
539 if (!html::isFontTag(rit->tag_)) {
540 // we'll just leave it and, presumably, have to close it later.
541 writeError("Unable to close font tag `" + etag.tag_
542 + "' due to open non-font tag `" + rit->tag_ + "'.");
548 // <em>this is <strong>bold
549 // and are being asked to closed em. we want:
550 // <em>this is <strong>bold</strong></em><strong>
551 // first, we close the intervening tags...
552 html::StartTag curtag = tag_stack_.back();
553 // ...remembering them in a stack.
555 while (curtag.tag_ != etag.tag_) {
556 os_ << curtag.asEndTag();
557 fontstack.push_back(curtag);
558 tag_stack_.pop_back();
559 curtag = tag_stack_.back();
561 // now close our tag...
562 os_ << etag.asEndTag();
563 tag_stack_.pop_back();
565 // ...and restore the other tags.
566 rit = fontstack.rbegin();
567 ren = fontstack.rend();
568 for (; rit != ren; ++rit)
569 pending_tags_.push_back(*rit);
573 // it wasn't a font tag.
574 // so other tags were opened before this one and not properly closed.
575 // so we'll close them, too. that may cause other issues later, but it
576 // at least guarantees proper nesting.
577 writeError("Closing tag `" + etag.tag_
578 + "' when other tags are open, namely:");
579 html::StartTag curtag = tag_stack_.back();
580 while (curtag.tag_ != etag.tag_) {
581 writeError(curtag.tag_);
582 if (curtag.tag_ != parsep_tag)
583 os_ << curtag.asEndTag();
584 tag_stack_.pop_back();
585 curtag = tag_stack_.back();
587 // curtag is now the one we actually want.
588 os_ << curtag.asEndTag();
589 tag_stack_.pop_back();
594 // End code for XHTMLStream
598 // convenience functions
600 inline void openTag(XHTMLStream & xs, Layout const & lay)
602 xs << html::StartTag(lay.htmltag(), lay.htmlattr());
606 void openTag(XHTMLStream & xs, Layout const & lay,
607 ParagraphParameters const & params)
609 // FIXME Are there other things we should handle here?
610 string const align = alignmentToCSS(params.align());
615 string attrs = lay.htmlattr() + " style='text-align: " + align + ";'";
616 xs << html::StartTag(lay.htmltag(), attrs);
620 inline void closeTag(XHTMLStream & xs, Layout const & lay)
622 xs << html::EndTag(lay.htmltag());
626 inline void openLabelTag(XHTMLStream & xs, Layout const & lay)
628 xs << html::StartTag(lay.htmllabeltag(), lay.htmllabelattr());
632 inline void closeLabelTag(XHTMLStream & xs, Layout const & lay)
634 xs << html::EndTag(lay.htmllabeltag());
638 inline void openItemTag(XHTMLStream & xs, Layout const & lay)
640 xs << html::StartTag(lay.htmlitemtag(), lay.htmlitemattr(), true);
644 void openItemTag(XHTMLStream & xs, Layout const & lay,
645 ParagraphParameters const & params)
647 // FIXME Are there other things we should handle here?
648 string const align = alignmentToCSS(params.align());
650 openItemTag(xs, lay);
653 string attrs = lay.htmlattr() + " style='text-align: " + align + ";'";
654 xs << html::StartTag(lay.htmlitemtag(), attrs);
658 inline void closeItemTag(XHTMLStream & xs, Layout const & lay)
660 xs << html::EndTag(lay.htmlitemtag());
663 // end of convenience functions
665 ParagraphList::const_iterator searchParagraphHtml(
666 ParagraphList::const_iterator p,
667 ParagraphList::const_iterator const & pend)
669 for (++p; p != pend && p->layout().latextype == LATEX_PARAGRAPH; ++p)
676 ParagraphList::const_iterator searchEnvironmentHtml(
677 ParagraphList::const_iterator const pstart,
678 ParagraphList::const_iterator const & pend)
680 ParagraphList::const_iterator p = pstart;
681 Layout const & bstyle = p->layout();
682 size_t const depth = p->params().depth();
683 for (++p; p != pend; ++p) {
684 Layout const & style = p->layout();
685 // It shouldn't happen that e.g. a section command occurs inside
686 // a quotation environment, at a higher depth, but as of 6/2009,
687 // it can happen. We pretend that it's just at lowest depth.
688 if (style.latextype == LATEX_COMMAND)
690 // If depth is down, we're done
691 if (p->params().depth() < depth)
693 // If depth is up, we're not done
694 if (p->params().depth() > depth)
696 // Now we know we are at the same depth
697 if (style.latextype == LATEX_PARAGRAPH
698 || style.latexname() != bstyle.latexname())
705 ParagraphList::const_iterator makeParagraphs(Buffer const & buf,
707 OutputParams const & runparams,
709 ParagraphList::const_iterator const & pbegin,
710 ParagraphList::const_iterator const & pend)
712 ParagraphList::const_iterator const begin = text.paragraphs().begin();
713 ParagraphList::const_iterator par = pbegin;
714 for (; par != pend; ++par) {
715 Layout const & lay = par->layout();
716 if (!lay.counter.empty())
717 buf.params().documentClass().counters().step(lay.counter, OutputUpdate);
718 // FIXME We should see if there's a label to be output and
719 // do something with it.
723 // If we are already in a paragraph, and this is the first one, then we
724 // do not want to open the paragraph tag.
725 // we also do not want to open it if the current layout does not permit
726 // multiple paragraphs.
727 bool const opened = runparams.html_make_pars &&
728 (par != pbegin || !runparams.html_in_par);
730 openTag(xs, lay, par->params());
731 docstring const deferred =
732 par->simpleLyXHTMLOnePar(buf, xs, runparams, text.outerFont(distance(begin, par)));
734 // We want to issue the closing tag if either:
735 // (i) We opened it, and either html_in_par is false,
736 // or we're not in the last paragraph, anyway.
737 // (ii) We didn't open it and html_in_par is true,
738 // but we are in the first par, and there is a next par.
739 ParagraphList::const_iterator nextpar = par;
741 bool const needclose =
742 (opened && (!runparams.html_in_par || nextpar != pend))
743 || (!opened && runparams.html_in_par && par == pbegin && nextpar != pend);
748 if (!deferred.empty()) {
749 xs << XHTMLStream::ESCAPE_NONE << deferred << html::CR();
756 ParagraphList::const_iterator makeBibliography(Buffer const & buf,
758 OutputParams const & runparams,
760 ParagraphList::const_iterator const & pbegin,
761 ParagraphList::const_iterator const & pend)
764 // Use TextClass::htmlTOCLayout() to figure out how we should look.
765 xs << html::StartTag("h2", "class='bibliography'")
766 << pbegin->layout().labelstring(false)
767 << html::EndTag("h2")
769 << html::StartTag("div", "class='bibliography'")
771 makeParagraphs(buf, xs, runparams, text, pbegin, pend);
772 xs << html::EndTag("div");
777 bool isNormalEnv(Layout const & lay)
779 return lay.latextype == LATEX_ENVIRONMENT
780 || lay.latextype == LATEX_BIB_ENVIRONMENT;
784 ParagraphList::const_iterator makeEnvironmentHtml(Buffer const & buf,
786 OutputParams const & runparams,
788 ParagraphList::const_iterator const & pbegin,
789 ParagraphList::const_iterator const & pend)
791 ParagraphList::const_iterator const begin = text.paragraphs().begin();
792 ParagraphList::const_iterator par = pbegin;
793 Layout const & bstyle = par->layout();
794 depth_type const origdepth = pbegin->params().depth();
796 // open tag for this environment
800 // we will on occasion need to remember a layout from before.
801 Layout const * lastlay = 0;
803 while (par != pend) {
804 Layout const & style = par->layout();
805 // the counter only gets stepped if we're in some kind of list,
806 // or if it's the first time through.
807 // note that enum, etc, are handled automatically.
808 // FIXME There may be a bug here about user defined enumeration
809 // types. If so, then we'll need to take the counter and add "i",
810 // "ii", etc, as with enum.
811 Counters & cnts = buf.params().documentClass().counters();
812 docstring const & cntr = style.counter;
813 if (!style.counter.empty()
814 && (par == pbegin || !isNormalEnv(style))
815 && cnts.hasCounter(cntr)
817 cnts.step(cntr, OutputUpdate);
818 ParagraphList::const_iterator send;
819 // this will be positive, if we want to skip the initial word
820 // (if it's been taken for the label).
823 switch (style.latextype) {
824 case LATEX_ENVIRONMENT:
825 case LATEX_LIST_ENVIRONMENT:
826 case LATEX_ITEM_ENVIRONMENT: {
827 // There are two possiblities in this case.
828 // One is that we are still in the environment in which we
829 // started---which we will be if the depth is the same.
830 if (par->params().depth() == origdepth) {
831 LASSERT(bstyle == style, /* */);
833 closeItemTag(xs, *lastlay);
837 bool const labelfirst = style.htmllabelfirst();
839 openItemTag(xs, style, par->params());
842 if (style.labeltype != LABEL_NO_LABEL &&
843 style.htmllabeltag() != "NONE") {
844 if (isNormalEnv(style)) {
845 // in this case, we print the label only for the first
846 // paragraph (as in a theorem).
848 docstring const lbl =
849 pbegin->params().labelString();
851 openLabelTag(xs, style);
853 closeLabelTag(xs, style);
857 } else { // some kind of list
858 if (style.labeltype == LABEL_MANUAL) {
859 openLabelTag(xs, style);
860 sep = par->firstWordLyXHTML(xs, runparams);
861 closeLabelTag(xs, style);
865 openLabelTag(xs, style);
866 xs << par->params().labelString();
867 closeLabelTag(xs, style);
871 } // end label output
874 openItemTag(xs, style, par->params());
876 par->simpleLyXHTMLOnePar(buf, xs, runparams,
877 text.outerFont(distance(begin, par)), sep);
880 // We may not want to close the tag yet, in particular:
881 // If we're not at the end...
883 // and are doing items...
884 && !isNormalEnv(style)
885 // and if the depth has changed...
886 && par->params().depth() != origdepth) {
887 // then we'll save this layout for later, and close it when
888 // we get another item.
891 closeItemTag(xs, style);
894 // The other possibility is that the depth has increased, in which
895 // case we need to recurse.
897 send = searchEnvironmentHtml(par, pend);
898 par = makeEnvironmentHtml(buf, xs, runparams, text, par, send);
902 case LATEX_PARAGRAPH:
903 send = searchParagraphHtml(par, pend);
904 par = makeParagraphs(buf, xs, runparams, text, par, send);
907 case LATEX_BIB_ENVIRONMENT:
910 par = makeParagraphs(buf, xs, runparams, text, par, send);
920 closeItemTag(xs, *lastlay);
921 closeTag(xs, bstyle);
927 void makeCommand(Buffer const & buf,
929 OutputParams const & runparams,
931 ParagraphList::const_iterator const & pbegin)
933 Layout const & style = pbegin->layout();
934 if (!style.counter.empty())
935 buf.params().documentClass().counters().step(style.counter, OutputUpdate);
937 openTag(xs, style, pbegin->params());
939 // Label around sectioning number:
940 // FIXME Probably need to account for LABEL_MANUAL
941 if (style.labeltype != LABEL_NO_LABEL) {
942 openLabelTag(xs, style);
943 xs << pbegin->params().labelString();
944 closeLabelTag(xs, style);
945 // Otherwise the label might run together with the text
946 xs << from_ascii(" ");
949 ParagraphList::const_iterator const begin = text.paragraphs().begin();
950 pbegin->simpleLyXHTMLOnePar(buf, xs, runparams,
951 text.outerFont(distance(begin, pbegin)));
956 } // end anonymous namespace
959 void xhtmlParagraphs(Text const & text,
962 OutputParams const & runparams)
964 ParagraphList const & paragraphs = text.paragraphs();
965 if (runparams.par_begin == runparams.par_end) {
966 runparams.par_begin = 0;
967 runparams.par_end = paragraphs.size();
969 pit_type bpit = runparams.par_begin;
970 pit_type const epit = runparams.par_end;
971 LASSERT(bpit < epit, /* */);
973 OutputParams ourparams = runparams;
974 ParagraphList::const_iterator const pend =
975 (epit == (int) paragraphs.size()) ?
976 paragraphs.end() : paragraphs.constIterator(epit);
977 while (bpit < epit) {
978 ParagraphList::const_iterator par = paragraphs.constIterator(bpit);
979 if (par->params().startOfAppendix()) {
980 // FIXME: only the counter corresponding to toplevel
981 // sectioning should be reset
982 Counters & cnts = buf.masterBuffer()->params().documentClass().counters();
986 Layout const & style = par->layout();
987 ParagraphList::const_iterator const lastpar = par;
988 ParagraphList::const_iterator send;
990 switch (style.latextype) {
991 case LATEX_COMMAND: {
992 // The files with which we are working never have more than
993 // one paragraph in a command structure.
995 // if (ourparams.html_in_par)
996 // fix it so we don't get sections inside standard, e.g.
997 // note that we may then need to make runparams not const, so we
998 // can communicate that back.
999 // FIXME Maybe this fix should be in the routines themselves, in case
1000 // they are called from elsewhere.
1001 makeCommand(buf, xs, ourparams, text, par);
1005 case LATEX_ENVIRONMENT:
1006 case LATEX_LIST_ENVIRONMENT:
1007 case LATEX_ITEM_ENVIRONMENT: {
1008 // FIXME Same fix here.
1009 send = searchEnvironmentHtml(par, pend);
1010 par = makeEnvironmentHtml(buf, xs, ourparams, text, par, send);
1013 case LATEX_BIB_ENVIRONMENT: {
1014 // FIXME Same fix here.
1015 send = searchEnvironmentHtml(par, pend);
1016 par = makeBibliography(buf, xs, ourparams, text, par, send);
1019 case LATEX_PARAGRAPH:
1020 send = searchParagraphHtml(par, pend);
1021 par = makeParagraphs(buf, xs, ourparams, text, par, send);
1024 bpit += distance(lastpar, par);
1029 string alignmentToCSS(LyXAlignment align) {
1031 case LYX_ALIGN_BLOCK:
1032 // we are NOT going to use text-align: justify!!
1033 case LYX_ALIGN_LEFT:
1035 case LYX_ALIGN_RIGHT:
1037 case LYX_ALIGN_CENTER: