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 (tag_stack_.empty())
238 // first, we close any open font tags we can close
239 html::StartTag curtag = tag_stack_.back();
240 while (html::isFontTag(curtag.tag_)) {
241 os_ << curtag.asEndTag();
242 tag_stack_.pop_back();
243 if (tag_stack_.empty())
244 // this probably shouldn't happen, since then the
245 // font tags weren't in any other tag. but that
246 // problem will likely be caught elsewhere.
248 curtag = tag_stack_.back();
251 if (curtag.tag_ == parsep_tag)
254 // so we've hit a non-font tag.
255 writeError("Tags still open in closeFontTags(). Probably not a problem,\n"
256 "but you might want to check these tags:");
257 TagStack::const_reverse_iterator it = tag_stack_.rbegin();
258 TagStack::const_reverse_iterator const en = tag_stack_.rend();
259 for (; it != en; ++it) {
260 string const tagname = it->tag_;
261 if (tagname == parsep_tag)
263 writeError(it->tag_);
269 void XHTMLStream::startParagraph(bool keep_empty)
271 pending_tags_.push_back(html::StartTag(parsep_tag));
277 void XHTMLStream::endParagraph()
279 if (!isTagOpen(parsep_tag)) {
281 TagStack::const_iterator dit = pending_tags_.begin();
282 TagStack::const_iterator const den = pending_tags_.end();
284 for (; dit != den; ++dit) {
285 if (dit->tag_ == parsep_tag) {
292 writeError("No paragraph separation tag found in endParagraph().");
296 // this case is normal.
297 while (!pending_tags_.empty()) {
298 // clear all pending tags up to and including the parsep tag.
299 // note that we work from the back, because we want to get rid
300 // of everything that hasnt' been used.
301 html::StartTag const cur_tag = pending_tags_.back();
302 string const & tag = cur_tag.tag_;
303 tag_stack_.pop_back();
304 if (tag == parsep_tag)
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)
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 // this is complicated, because we want to make sure that
433 // everything is properly nested. the code ought to make
434 // sure of that, but we won't assert (yet) if we run into
435 // a problem. we'll just output error messages and try our
436 // best to make things work.
437 XHTMLStream & XHTMLStream::operator<<(html::EndTag const & etag)
439 if (etag.tag_.empty())
442 // make sure there are tags to be closed
443 if (tag_stack_.empty()) {
444 writeError("Tried to close `" + etag.tag_
445 + "' when no tags were open!");
449 // first make sure we're not closing an empty tag
450 if (!pending_tags_.empty()) {
451 html::StartTag const & stag = pending_tags_.back();
452 if (etag.tag_ == stag.tag_) {
453 // we have <tag></tag>, so we discard it and remove it
454 // from the pending_tags_.
455 pending_tags_.pop_back();
458 // there is a pending tag that isn't the one we are trying
460 // is this tag itself pending?
461 // non-const iterators because we may call erase().
462 TagStack::iterator dit = pending_tags_.begin();
463 TagStack::iterator const den = pending_tags_.end();
464 for (; dit != den; ++dit) {
465 if (dit->tag_ == etag.tag_) {
466 // it was pending, so we just erase it
467 writeError("Tried to close pending tag `" + etag.tag_
468 + "' when other tags were pending. Last pending tag is `"
469 + pending_tags_.back().tag_ + "'. Tag discarded.");
470 pending_tags_.erase(dit);
474 // so etag isn't itself pending. is it even open?
475 if (!isTagOpen(etag.tag_)) {
476 writeError("Tried to close `" + etag.tag_
477 + "' when tag was not open. Tag discarded.");
480 // ok, so etag is open.
481 // our strategy will be as below: we will do what we need to
482 // do to close this tag.
483 string estr = "Closing tag `" + etag.tag_
484 + "' when other tags are pending. Discarded pending tags:\n";
485 for (dit = pending_tags_.begin(); dit != den; ++dit)
486 estr += dit->tag_ + "\n";
488 // clear the pending tags...
489 pending_tags_.clear();
490 // ...and then just fall through.
493 // is the tag we are closing the last one we opened?
494 if (etag.tag_ == tag_stack_.back().tag_) {
496 os_ << etag.asEndTag();
497 // ...and forget about it
498 tag_stack_.pop_back();
502 // we are trying to close a tag other than the one last opened.
503 // let's first see if this particular tag is still open somehow.
504 if (!isTagOpen(etag.tag_)) {
505 writeError("Tried to close `" + etag.tag_
506 + "' when tag was not open. Tag discarded.");
510 // so the tag was opened, but other tags have been opened since
511 // and not yet closed.
512 // if it's a font tag, though...
513 if (html::isFontTag(etag.tag_)) {
514 // it won't be a problem if the other tags open since this one
515 // are also font tags.
516 TagStack::const_reverse_iterator rit = tag_stack_.rbegin();
517 TagStack::const_reverse_iterator ren = tag_stack_.rend();
518 for (; rit != ren; ++rit) {
519 if (rit->tag_ == etag.tag_)
521 if (!html::isFontTag(rit->tag_)) {
522 // we'll just leave it and, presumably, have to close it later.
523 writeError("Unable to close font tag `" + etag.tag_
524 + "' due to open non-font tag `" + rit->tag_ + "'.");
530 // <em>this is <strong>bold
531 // and are being asked to closed em. we want:
532 // <em>this is <strong>bold</strong></em><strong>
533 // first, we close the intervening tags...
534 html::StartTag curtag = tag_stack_.back();
535 // ...remembering them in a stack.
537 while (curtag.tag_ != etag.tag_) {
538 os_ << curtag.asEndTag();
539 fontstack.push_back(curtag);
540 tag_stack_.pop_back();
541 curtag = tag_stack_.back();
543 // now close our tag...
544 os_ << etag.asEndTag();
545 tag_stack_.pop_back();
547 // ...and restore the other tags.
548 rit = fontstack.rbegin();
549 ren = fontstack.rend();
550 for (; rit != ren; ++rit)
551 pending_tags_.push_back(*rit);
555 // it wasn't a font tag.
556 // so other tags were opened before this one and not properly closed.
557 // so we'll close them, too. that may cause other issues later, but it
558 // at least guarantees proper nesting.
559 writeError("Closing tag `" + etag.tag_
560 + "' when other tags are open, namely:");
561 html::StartTag curtag = tag_stack_.back();
562 while (curtag.tag_ != etag.tag_) {
563 writeError(curtag.tag_);
564 if (curtag.tag_ != parsep_tag)
565 os_ << curtag.asEndTag();
566 tag_stack_.pop_back();
567 curtag = tag_stack_.back();
569 // curtag is now the one we actually want.
570 os_ << curtag.asEndTag();
571 tag_stack_.pop_back();
576 // End code for XHTMLStream
580 // convenience functions
582 inline void openTag(XHTMLStream & xs, Layout const & lay)
584 xs << html::StartTag(lay.htmltag(), lay.htmlattr());
588 void openTag(XHTMLStream & xs, Layout const & lay,
589 ParagraphParameters const & params)
591 // FIXME Are there other things we should handle here?
592 string const align = alignmentToCSS(params.align());
597 string attrs = lay.htmlattr() + " style='text-align: " + align + ";'";
598 xs << html::StartTag(lay.htmltag(), attrs);
602 inline void closeTag(XHTMLStream & xs, Layout const & lay)
604 xs << html::EndTag(lay.htmltag());
608 inline void openLabelTag(XHTMLStream & xs, Layout const & lay)
610 xs << html::StartTag(lay.htmllabeltag(), lay.htmllabelattr());
614 inline void closeLabelTag(XHTMLStream & xs, Layout const & lay)
616 xs << html::EndTag(lay.htmllabeltag());
620 inline void openItemTag(XHTMLStream & xs, Layout const & lay)
622 xs << html::StartTag(lay.htmlitemtag(), lay.htmlitemattr(), true);
626 void openItemTag(XHTMLStream & xs, Layout const & lay,
627 ParagraphParameters const & params)
629 // FIXME Are there other things we should handle here?
630 string const align = alignmentToCSS(params.align());
632 openItemTag(xs, lay);
635 string attrs = lay.htmlattr() + " style='text-align: " + align + ";'";
636 xs << html::StartTag(lay.htmlitemtag(), attrs);
640 inline void closeItemTag(XHTMLStream & xs, Layout const & lay)
642 xs << html::EndTag(lay.htmlitemtag());
645 // end of convenience functions
647 ParagraphList::const_iterator searchParagraphHtml(
648 ParagraphList::const_iterator p,
649 ParagraphList::const_iterator const & pend)
651 for (++p; p != pend && p->layout().latextype == LATEX_PARAGRAPH; ++p)
658 ParagraphList::const_iterator searchEnvironmentHtml(
659 ParagraphList::const_iterator const pstart,
660 ParagraphList::const_iterator const & pend)
662 ParagraphList::const_iterator p = pstart;
663 Layout const & bstyle = p->layout();
664 size_t const depth = p->params().depth();
665 for (++p; p != pend; ++p) {
666 Layout const & style = p->layout();
667 // It shouldn't happen that e.g. a section command occurs inside
668 // a quotation environment, at a higher depth, but as of 6/2009,
669 // it can happen. We pretend that it's just at lowest depth.
670 if (style.latextype == LATEX_COMMAND)
672 // If depth is down, we're done
673 if (p->params().depth() < depth)
675 // If depth is up, we're not done
676 if (p->params().depth() > depth)
678 // Now we know we are at the same depth
679 if (style.latextype == LATEX_PARAGRAPH
680 || style.latexname() != bstyle.latexname())
687 ParagraphList::const_iterator makeParagraphs(Buffer const & buf,
689 OutputParams const & runparams,
691 ParagraphList::const_iterator const & pbegin,
692 ParagraphList::const_iterator const & pend)
694 ParagraphList::const_iterator const begin = text.paragraphs().begin();
695 ParagraphList::const_iterator par = pbegin;
696 for (; par != pend; ++par) {
697 Layout const & lay = par->layout();
698 if (!lay.counter.empty())
699 buf.params().documentClass().counters().step(lay.counter, OutputUpdate);
700 // FIXME We should see if there's a label to be output and
701 // do something with it.
705 // If we are already in a paragraph, and this is the first one, then we
706 // do not want to open the paragraph tag.
707 // we also do not want to open it if the current layout does not permit
708 // multiple paragraphs.
709 bool const opened = runparams.html_make_pars &&
710 (par != pbegin || !runparams.html_in_par);
712 openTag(xs, lay, par->params());
713 docstring const deferred =
714 par->simpleLyXHTMLOnePar(buf, xs, runparams, text.outerFont(distance(begin, par)));
716 // We want to issue the closing tag if either:
717 // (i) We opened it, and either html_in_par is false,
718 // or we're not in the last paragraph, anyway.
719 // (ii) We didn't open it and html_in_par is true,
720 // but we are in the first par, and there is a next par.
721 ParagraphList::const_iterator nextpar = par;
723 bool const needclose =
724 (opened && (!runparams.html_in_par || nextpar != pend))
725 || (!opened && runparams.html_in_par && par == pbegin && nextpar != pend);
730 if (!deferred.empty()) {
731 xs << XHTMLStream::ESCAPE_NONE << deferred << html::CR();
738 ParagraphList::const_iterator makeBibliography(Buffer const & buf,
740 OutputParams const & runparams,
742 ParagraphList::const_iterator const & pbegin,
743 ParagraphList::const_iterator const & pend)
746 // Use TextClass::htmlTOCLayout() to figure out how we should look.
747 xs << html::StartTag("h2", "class='bibliography'")
748 << pbegin->layout().labelstring(false)
749 << html::EndTag("h2")
751 << html::StartTag("div", "class='bibliography'")
753 makeParagraphs(buf, xs, runparams, text, pbegin, pend);
754 xs << html::EndTag("div");
759 bool isNormalEnv(Layout const & lay)
761 return lay.latextype == LATEX_ENVIRONMENT
762 || lay.latextype == LATEX_BIB_ENVIRONMENT;
766 ParagraphList::const_iterator makeEnvironmentHtml(Buffer const & buf,
768 OutputParams const & runparams,
770 ParagraphList::const_iterator const & pbegin,
771 ParagraphList::const_iterator const & pend)
773 ParagraphList::const_iterator const begin = text.paragraphs().begin();
774 ParagraphList::const_iterator par = pbegin;
775 Layout const & bstyle = par->layout();
776 depth_type const origdepth = pbegin->params().depth();
778 // open tag for this environment
782 // we will on occasion need to remember a layout from before.
783 Layout const * lastlay = 0;
785 while (par != pend) {
786 Layout const & style = par->layout();
787 // the counter only gets stepped if we're in some kind of list,
788 // or if it's the first time through.
789 // note that enum, etc, are handled automatically.
790 // FIXME There may be a bug here about user defined enumeration
791 // types. If so, then we'll need to take the counter and add "i",
792 // "ii", etc, as with enum.
793 Counters & cnts = buf.params().documentClass().counters();
794 docstring const & cntr = style.counter;
795 if (!style.counter.empty()
796 && (par == pbegin || !isNormalEnv(style))
797 && cnts.hasCounter(cntr)
799 cnts.step(cntr, OutputUpdate);
800 ParagraphList::const_iterator send;
801 // this will be positive, if we want to skip the initial word
802 // (if it's been taken for the label).
805 switch (style.latextype) {
806 case LATEX_ENVIRONMENT:
807 case LATEX_LIST_ENVIRONMENT:
808 case LATEX_ITEM_ENVIRONMENT: {
809 // There are two possiblities in this case.
810 // One is that we are still in the environment in which we
811 // started---which we will be if the depth is the same.
812 if (par->params().depth() == origdepth) {
813 LASSERT(bstyle == style, /* */);
815 closeItemTag(xs, *lastlay);
819 bool const labelfirst = style.htmllabelfirst();
821 openItemTag(xs, style, par->params());
824 if (style.labeltype != LABEL_NO_LABEL &&
825 style.htmllabeltag() != "NONE") {
826 if (isNormalEnv(style)) {
827 // in this case, we print the label only for the first
828 // paragraph (as in a theorem).
830 docstring const lbl =
831 pbegin->params().labelString();
833 openLabelTag(xs, style);
835 closeLabelTag(xs, style);
839 } else { // some kind of list
840 if (style.labeltype == LABEL_MANUAL) {
841 openLabelTag(xs, style);
842 sep = par->firstWordLyXHTML(xs, runparams);
843 closeLabelTag(xs, style);
847 openLabelTag(xs, style);
848 xs << par->params().labelString();
849 closeLabelTag(xs, style);
853 } // end label output
856 openItemTag(xs, style, par->params());
858 par->simpleLyXHTMLOnePar(buf, xs, runparams,
859 text.outerFont(distance(begin, par)), sep);
862 // We may not want to close the tag yet, in particular:
863 // If we're not at the end...
865 // and are doing items...
866 && !isNormalEnv(style)
867 // and if the depth has changed...
868 && par->params().depth() != origdepth) {
869 // then we'll save this layout for later, and close it when
870 // we get another item.
873 closeItemTag(xs, style);
876 // The other possibility is that the depth has increased, in which
877 // case we need to recurse.
879 send = searchEnvironmentHtml(par, pend);
880 par = makeEnvironmentHtml(buf, xs, runparams, text, par, send);
884 case LATEX_PARAGRAPH:
885 send = searchParagraphHtml(par, pend);
886 par = makeParagraphs(buf, xs, runparams, text, par, send);
889 case LATEX_BIB_ENVIRONMENT:
892 par = makeParagraphs(buf, xs, runparams, text, par, send);
902 closeItemTag(xs, *lastlay);
903 closeTag(xs, bstyle);
909 void makeCommand(Buffer const & buf,
911 OutputParams const & runparams,
913 ParagraphList::const_iterator const & pbegin)
915 Layout const & style = pbegin->layout();
916 if (!style.counter.empty())
917 buf.params().documentClass().counters().step(style.counter, OutputUpdate);
919 openTag(xs, style, pbegin->params());
921 // Label around sectioning number:
922 // FIXME Probably need to account for LABEL_MANUAL
923 if (style.labeltype != LABEL_NO_LABEL) {
924 openLabelTag(xs, style);
925 xs << pbegin->params().labelString();
926 closeLabelTag(xs, style);
927 // Otherwise the label might run together with the text
928 xs << from_ascii(" ");
931 ParagraphList::const_iterator const begin = text.paragraphs().begin();
932 pbegin->simpleLyXHTMLOnePar(buf, xs, runparams,
933 text.outerFont(distance(begin, pbegin)));
938 } // end anonymous namespace
941 void xhtmlParagraphs(Text const & text,
944 OutputParams const & runparams)
946 ParagraphList const & paragraphs = text.paragraphs();
947 if (runparams.par_begin == runparams.par_end) {
948 runparams.par_begin = 0;
949 runparams.par_end = paragraphs.size();
951 pit_type bpit = runparams.par_begin;
952 pit_type const epit = runparams.par_end;
953 LASSERT(bpit < epit, /* */);
955 OutputParams ourparams = runparams;
956 ParagraphList::const_iterator const pend =
957 (epit == (int) paragraphs.size()) ?
958 paragraphs.end() : paragraphs.constIterator(epit);
959 while (bpit < epit) {
960 ParagraphList::const_iterator par = paragraphs.constIterator(bpit);
961 if (par->params().startOfAppendix()) {
962 // FIXME: only the counter corresponding to toplevel
963 // sectioning should be reset
964 Counters & cnts = buf.masterBuffer()->params().documentClass().counters();
968 Layout const & style = par->layout();
969 ParagraphList::const_iterator const lastpar = par;
970 ParagraphList::const_iterator send;
972 switch (style.latextype) {
973 case LATEX_COMMAND: {
974 // The files with which we are working never have more than
975 // one paragraph in a command structure.
977 // if (ourparams.html_in_par)
978 // fix it so we don't get sections inside standard, e.g.
979 // note that we may then need to make runparams not const, so we
980 // can communicate that back.
981 // FIXME Maybe this fix should be in the routines themselves, in case
982 // they are called from elsewhere.
983 makeCommand(buf, xs, ourparams, text, par);
987 case LATEX_ENVIRONMENT:
988 case LATEX_LIST_ENVIRONMENT:
989 case LATEX_ITEM_ENVIRONMENT: {
990 // FIXME Same fix here.
991 send = searchEnvironmentHtml(par, pend);
992 par = makeEnvironmentHtml(buf, xs, ourparams, text, par, send);
995 case LATEX_BIB_ENVIRONMENT: {
996 // FIXME Same fix here.
997 send = searchEnvironmentHtml(par, pend);
998 par = makeBibliography(buf, xs, ourparams, text, par, send);
1001 case LATEX_PARAGRAPH:
1002 send = searchParagraphHtml(par, pend);
1003 par = makeParagraphs(buf, xs, ourparams, text, par, send);
1006 bpit += distance(lastpar, par);
1011 string alignmentToCSS(LyXAlignment align) {
1013 case LYX_ALIGN_BLOCK:
1014 // we are NOT going to use text-align: justify!!
1015 case LYX_ALIGN_LEFT:
1017 case LYX_ALIGN_RIGHT:
1019 case LYX_ALIGN_CENTER: