#include "Paragraph.h"
#include "ParagraphList.h"
#include "ParagraphParameters.h"
-#include "sgml.h"
+#include "xml.h"
#include "Text.h"
#include "TextClass.h"
#include "support/lstrings.h"
#include "support/lyxalgo.h"
+#include <iostream>
+
using namespace std;
using namespace lyx::support;
namespace {
+std::string const fontToDocBookTag(xml::FontTypes type) {
+ switch (type) {
+ case xml::FontTypes::FT_EMPH:
+ case xml::FontTypes::FT_BOLD:
+ return "emphasis";
+ case xml::FontTypes::FT_NOUN:
+ return "person";
+ case xml::FontTypes::FT_UBAR:
+ case xml::FontTypes::FT_WAVE:
+ case xml::FontTypes::FT_DBAR:
+ case xml::FontTypes::FT_SOUT:
+ case xml::FontTypes::FT_XOUT:
+ case xml::FontTypes::FT_ITALIC:
+ case xml::FontTypes::FT_UPRIGHT:
+ case xml::FontTypes::FT_SLANTED:
+ case xml::FontTypes::FT_SMALLCAPS:
+ case xml::FontTypes::FT_ROMAN:
+ case xml::FontTypes::FT_SANS:
+ return "emphasis";
+ case xml::FontTypes::FT_TYPE:
+ return "code";
+ case xml::FontTypes::FT_SIZE_TINY:
+ case xml::FontTypes::FT_SIZE_SCRIPT:
+ case xml::FontTypes::FT_SIZE_FOOTNOTE:
+ case xml::FontTypes::FT_SIZE_SMALL:
+ case xml::FontTypes::FT_SIZE_NORMAL:
+ case xml::FontTypes::FT_SIZE_LARGE:
+ case xml::FontTypes::FT_SIZE_LARGER:
+ case xml::FontTypes::FT_SIZE_LARGEST:
+ case xml::FontTypes::FT_SIZE_HUGE:
+ case xml::FontTypes::FT_SIZE_HUGER:
+ case xml::FontTypes::FT_SIZE_INCREASE:
+ case xml::FontTypes::FT_SIZE_DECREASE:
+ return "emphasis";
+ default:
+ return "";
+ }
+}
+
ParagraphList::const_iterator searchParagraph(
ParagraphList::const_iterator p,
ParagraphList::const_iterator const & pend)
for (ParagraphList::const_iterator par = pbegin; par != pend; ++par) {
if (par != pbegin)
os << '\n';
- bool const default_or_plain =
- (buf.params().documentClass().isDefaultLayout(par->layout())
+ bool const default_or_plain =
+ (buf.params().documentClass().isDefaultLayout(par->layout())
|| buf.params().documentClass().isPlainLayout(par->layout()));
if (default_or_plain && par->emptyTag()) {
- par->simpleDocBookOnePar(buf, os, runparams,
+ par->simpleDocBookOnePar(buf, os, runparams,
text.outerFont(distance(paragraphs.begin(), par)));
} else {
- sgml::openTag(buf, os, runparams, *par);
- par->simpleDocBookOnePar(buf, os, runparams,
+ xml::openTag(buf, os, runparams, *par);
+ par->simpleDocBookOnePar(buf, os, runparams,
text.outerFont(distance(paragraphs.begin(), par)));
- sgml::closeTag(os, *par);
+ xml::closeTag(os, *par);
}
}
return pend;
Layout const & bstyle = par->layout();
// Opening outter tag
- sgml::openTag(buf, os, runparams, *pbegin);
+ xml::openTag(buf, os, runparams, *pbegin);
os << '\n';
if (bstyle.latextype == LATEX_ENVIRONMENT && bstyle.pass_thru)
os << "<![CDATA[";
switch (bstyle.latextype) {
case LATEX_ENVIRONMENT:
if (!bstyle.innertag().empty()) {
- sgml::openTag(os, bstyle.innertag(), id);
+ xml::openTag(os, bstyle.innertag(), id);
}
break;
case LATEX_ITEM_ENVIRONMENT:
if (!bstyle.labeltag().empty()) {
- sgml::openTag(os, bstyle.innertag(), id);
- sgml::openTag(os, bstyle.labeltag());
+ xml::openTag(os, bstyle.innertag(), id);
+ xml::openTag(os, bstyle.labeltag());
sep = par->firstWordDocBook(os, runparams) + 1;
- sgml::closeTag(os, bstyle.labeltag());
+ xml::closeTag(os, bstyle.labeltag());
}
wrapper = defaultstyle.latexname();
// If a sub list (embedded list) appears next with a
// different depth, then there is no need to open
// another tag at the current depth.
if(par->params().depth() == pbegin->params().depth()) {
- sgml::openTag(os, bstyle.itemtag());
+ xml::openTag(os, bstyle.itemtag());
}
break;
default:
case LATEX_ENVIRONMENT:
case LATEX_ITEM_ENVIRONMENT: {
if (par->params().depth() == pbegin->params().depth()) {
- sgml::openTag(os, wrapper);
+ xml::openTag(os, wrapper);
par->simpleDocBookOnePar(buf, os, runparams,
text.outerFont(distance(paragraphs.begin(), par)), sep);
- sgml::closeTag(os, wrapper);
+ xml::closeTag(os, wrapper);
++par;
}
else {
switch (bstyle.latextype) {
case LATEX_ENVIRONMENT:
if (!bstyle.innertag().empty()) {
- sgml::closeTag(os, bstyle.innertag());
+ xml::closeTag(os, bstyle.innertag());
os << '\n';
}
break;
// when par == pend but at the same time that the
// current tag is closed.
if((par != pend && par->params().depth() == pbegin->params().depth()) || par == pend) {
- sgml::closeTag(os, bstyle.itemtag());
+ xml::closeTag(os, bstyle.itemtag());
}
if (!bstyle.labeltag().empty())
- sgml::closeTag(os, bstyle.innertag());
+ xml::closeTag(os, bstyle.innertag());
break;
default:
break;
os << "]]>";
// Closing outer tag
- sgml::closeTag(os, *pbegin);
+ xml::closeTag(os, *pbegin);
return pend;
}
Layout const & bstyle = par->layout();
//Open outter tag
- sgml::openTag(buf, os, runparams, *pbegin);
+ xml::openTag(buf, os, runparams, *pbegin);
os << '\n';
// Label around sectioning number:
if (!bstyle.labeltag().empty()) {
- sgml::openTag(os, bstyle.labeltag());
+ xml::openTag(os, bstyle.labeltag());
// We don't care about appendix in DOCBOOK.
os << par->expandDocBookLabel(bstyle, buf.params());
- sgml::closeTag(os, bstyle.labeltag());
+ xml::closeTag(os, bstyle.labeltag());
}
// Opend inner tag and close inner tags
- sgml::openTag(os, bstyle.innertag());
+ xml::openTag(os, bstyle.innertag());
par->simpleDocBookOnePar(buf, os, runparams,
text.outerFont(distance(paragraphs.begin(), par)));
- sgml::closeTag(os, bstyle.innertag());
+ xml::closeTag(os, bstyle.innertag());
os << '\n';
++par;
}
}
// Close outter tag
- sgml::closeTag(os, *pbegin);
+ xml::closeTag(os, *pbegin);
return pend;
}
-} // end anonym namespace
+} // namespace
void docbookParagraphs(Text const & text,
// if only part of the paragraphs will be outputed
if (runparams.par_begin != runparams.par_end) {
- par = lyx::next(paragraphs.begin(), runparams.par_begin);
- pend = lyx::next(paragraphs.begin(), runparams.par_end);
+ par = paragraphs.iterator_at(runparams.par_begin);
+ pend = paragraphs.iterator_at(runparams.par_end);
// runparams will be passed to nested paragraphs, so
// we have to reset the range parameters.
const_cast<OutputParams&>(runparams).par_begin = 0;