mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-30 05:12:40 +00:00
HTML output code for a handful of easy insets.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29951 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
92a69bb790
commit
f61bebd7fb
@ -484,6 +484,16 @@ int InsetBox::docbook(odocstream & os, OutputParams const & runparams) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int InsetBox::xhtml(odocstream & os, OutputParams const & runparams) const
|
||||||
|
{
|
||||||
|
// FIXME We also want to do something with the length info, etc,
|
||||||
|
// presumably as "style='...'".
|
||||||
|
os << from_ascii("<span class='" + params_.type + "'>\n");
|
||||||
|
InsetText::xhtml(os, runparams);
|
||||||
|
os << "</span>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetBox::validate(LaTeXFeatures & features) const
|
void InsetBox::validate(LaTeXFeatures & features) const
|
||||||
{
|
{
|
||||||
BoxType btype = boxtranslator().find(params_.type);
|
BoxType btype = boxtranslator().find(params_.type);
|
||||||
|
@ -119,6 +119,8 @@ private:
|
|||||||
///
|
///
|
||||||
int docbook(odocstream &, OutputParams const &) const;
|
int docbook(odocstream &, OutputParams const &) const;
|
||||||
///
|
///
|
||||||
|
int xhtml(odocstream &, OutputParams const &) const;
|
||||||
|
///
|
||||||
void validate(LaTeXFeatures &) const;
|
void validate(LaTeXFeatures &) const;
|
||||||
///
|
///
|
||||||
InsetBoxParams const & params() const { return params_; }
|
InsetBoxParams const & params() const { return params_; }
|
||||||
|
@ -235,6 +235,13 @@ int InsetBranch::docbook(odocstream & os,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int InsetBranch::xhtml(odocstream & os,
|
||||||
|
OutputParams const & runparams) const
|
||||||
|
{
|
||||||
|
return isBranchSelected() ? InsetText::xhtml(os, runparams) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetBranch::tocString(odocstream & os) const
|
void InsetBranch::tocString(odocstream & os) const
|
||||||
{
|
{
|
||||||
if (isBranchSelected())
|
if (isBranchSelected())
|
||||||
|
@ -74,6 +74,8 @@ private:
|
|||||||
///
|
///
|
||||||
int docbook(odocstream &, OutputParams const &) const;
|
int docbook(odocstream &, OutputParams const &) const;
|
||||||
///
|
///
|
||||||
|
int xhtml(odocstream &, OutputParams const &) const;
|
||||||
|
///
|
||||||
void tocString(odocstream &) const;
|
void tocString(odocstream &) const;
|
||||||
///
|
///
|
||||||
void validate(LaTeXFeatures &) const;
|
void validate(LaTeXFeatures &) const;
|
||||||
|
@ -181,6 +181,18 @@ int InsetHyperlink::docbook(odocstream & os, OutputParams const &) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int InsetHyperlink::xhtml(odocstream & os, OutputParams const &) const
|
||||||
|
{
|
||||||
|
os << "<a href=\""
|
||||||
|
// FIXME Do we need to do more escaping than this?
|
||||||
|
<< subst(getParam("target"), from_ascii("&"), from_ascii("&"))
|
||||||
|
<< "\">"
|
||||||
|
<< getParam("name")
|
||||||
|
<< "</a>";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetHyperlink::tocString(odocstream & os) const
|
void InsetHyperlink::tocString(odocstream & os) const
|
||||||
{
|
{
|
||||||
plaintext(os, OutputParams(0));
|
plaintext(os, OutputParams(0));
|
||||||
|
@ -40,6 +40,8 @@ public:
|
|||||||
int plaintext(odocstream &, OutputParams const &) const;
|
int plaintext(odocstream &, OutputParams const &) const;
|
||||||
///
|
///
|
||||||
int docbook(odocstream &, OutputParams const &) const;
|
int docbook(odocstream &, OutputParams const &) const;
|
||||||
|
///
|
||||||
|
int xhtml(odocstream &, OutputParams const &) const;
|
||||||
/// the string that is passed to the TOC
|
/// the string that is passed to the TOC
|
||||||
void tocString(odocstream &) const;
|
void tocString(odocstream &) const;
|
||||||
///
|
///
|
||||||
|
@ -218,4 +218,11 @@ int InsetLabel::docbook(odocstream & os, OutputParams const & runparams) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int InsetLabel::xhtml(odocstream & os, OutputParams const & runparams) const
|
||||||
|
{
|
||||||
|
// FIXME Does this need to be escaped?
|
||||||
|
os << "<a name=\"" << getParam("name") << "\"></a>";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
@ -44,6 +44,8 @@ public:
|
|||||||
///
|
///
|
||||||
int docbook(odocstream &, OutputParams const &) const;
|
int docbook(odocstream &, OutputParams const &) const;
|
||||||
///
|
///
|
||||||
|
int xhtml(odocstream &, OutputParams const &) const;
|
||||||
|
///
|
||||||
static ParamInfo const & findInfo(std::string const &);
|
static ParamInfo const & findInfo(std::string const &);
|
||||||
///
|
///
|
||||||
static std::string defaultCommand() { return "label"; };
|
static std::string defaultCommand() { return "label"; };
|
||||||
|
@ -85,6 +85,13 @@ int InsetLine::docbook(odocstream & os, OutputParams const &) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int InsetLine::xhtml(odocstream & os, OutputParams const &) const
|
||||||
|
{
|
||||||
|
os << "<hr />\n";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetLine::validate(LaTeXFeatures & features) const
|
void InsetLine::validate(LaTeXFeatures & features) const
|
||||||
{
|
{
|
||||||
features.require("lyxline");
|
features.require("lyxline");
|
||||||
|
@ -20,27 +20,29 @@ namespace lyx {
|
|||||||
|
|
||||||
class InsetLine : public Inset {
|
class InsetLine : public Inset {
|
||||||
public:
|
public:
|
||||||
|
///
|
||||||
InsetLine() {}
|
InsetLine() {}
|
||||||
|
///
|
||||||
InsetCode lyxCode() const { return LINE_CODE; }
|
InsetCode lyxCode() const { return LINE_CODE; }
|
||||||
|
///
|
||||||
void metrics(MetricsInfo &, Dimension &) const;
|
void metrics(MetricsInfo &, Dimension &) const;
|
||||||
|
///
|
||||||
void draw(PainterInfo & pi, int x, int y) const;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
|
///
|
||||||
int latex(odocstream &, OutputParams const &) const;
|
int latex(odocstream &, OutputParams const &) const;
|
||||||
|
///
|
||||||
int plaintext(odocstream &, OutputParams const &) const;
|
int plaintext(odocstream &, OutputParams const &) const;
|
||||||
|
///
|
||||||
int docbook(odocstream &, OutputParams const &) const;
|
int docbook(odocstream &, OutputParams const &) const;
|
||||||
|
///
|
||||||
|
int xhtml(odocstream &, OutputParams const &) const;
|
||||||
|
///
|
||||||
void read(Lexer & lex);
|
void read(Lexer & lex);
|
||||||
|
///
|
||||||
void write(std::ostream & os) const;
|
void write(std::ostream & os) const;
|
||||||
/// We don't need \begin_inset and \end_inset
|
/// We don't need \begin_inset and \end_inset
|
||||||
bool directWrite() const { return true; }
|
bool directWrite() const { return true; }
|
||||||
|
///
|
||||||
DisplayType display() const { return AlignCenter; }
|
DisplayType display() const { return AlignCenter; }
|
||||||
///
|
///
|
||||||
void validate(LaTeXFeatures & features) const;
|
void validate(LaTeXFeatures & features) const;
|
||||||
|
@ -173,6 +173,13 @@ int InsetNewline::docbook(odocstream & os, OutputParams const &) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int InsetNewline::xhtml(odocstream & os, OutputParams const &) const
|
||||||
|
{
|
||||||
|
os << "<br />\n";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetNewline::draw(PainterInfo & pi, int x, int y) const
|
void InsetNewline::draw(PainterInfo & pi, int x, int y) const
|
||||||
{
|
{
|
||||||
FontInfo font;
|
FontInfo font;
|
||||||
|
@ -65,6 +65,8 @@ private:
|
|||||||
///
|
///
|
||||||
int docbook(odocstream &, OutputParams const &) const;
|
int docbook(odocstream &, OutputParams const &) const;
|
||||||
///
|
///
|
||||||
|
int xhtml(odocstream &, OutputParams const &) const;
|
||||||
|
///
|
||||||
void read(Lexer & lex);
|
void read(Lexer & lex);
|
||||||
///
|
///
|
||||||
void write(std::ostream & os) const;
|
void write(std::ostream & os) const;
|
||||||
|
@ -247,6 +247,13 @@ int InsetNewpage::docbook(odocstream & os, OutputParams const &) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int InsetNewpage::xhtml(odocstream & os, OutputParams const &) const
|
||||||
|
{
|
||||||
|
os << "<br />\n";
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
docstring InsetNewpage::contextMenu(BufferView const &, int, int) const
|
docstring InsetNewpage::contextMenu(BufferView const &, int, int) const
|
||||||
{
|
{
|
||||||
return from_ascii("context-newpage");
|
return from_ascii("context-newpage");
|
||||||
|
@ -69,6 +69,8 @@ private:
|
|||||||
///
|
///
|
||||||
int docbook(odocstream &, OutputParams const &) const;
|
int docbook(odocstream &, OutputParams const &) const;
|
||||||
///
|
///
|
||||||
|
int xhtml(odocstream &, OutputParams const &) const;
|
||||||
|
///
|
||||||
void read(Lexer & lex);
|
void read(Lexer & lex);
|
||||||
///
|
///
|
||||||
void write(std::ostream & os) const;
|
void write(std::ostream & os) const;
|
||||||
|
@ -312,6 +312,12 @@ int InsetQuotes::docbook(odocstream & os, OutputParams const &) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int InsetQuotes::xhtml(odocstream & os, OutputParams const & op) const
|
||||||
|
{
|
||||||
|
return docbook(os, op);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetQuotes::tocString(odocstream & os) const
|
void InsetQuotes::tocString(odocstream & os) const
|
||||||
{
|
{
|
||||||
os << displayString();
|
os << displayString();
|
||||||
|
@ -83,6 +83,8 @@ public:
|
|||||||
int plaintext(odocstream &, OutputParams const &) const;
|
int plaintext(odocstream &, OutputParams const &) const;
|
||||||
///
|
///
|
||||||
int docbook(odocstream &, OutputParams const &) const;
|
int docbook(odocstream &, OutputParams const &) const;
|
||||||
|
///
|
||||||
|
int xhtml(odocstream &, OutputParams const &) const;
|
||||||
|
|
||||||
/// the string that is passed to the TOC
|
/// the string that is passed to the TOC
|
||||||
void tocString(odocstream &) const;
|
void tocString(odocstream &) const;
|
||||||
|
@ -680,6 +680,52 @@ int InsetSpace::docbook(odocstream & os, OutputParams const &) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int InsetSpace::xhtml(odocstream & os, OutputParams const &) const
|
||||||
|
{
|
||||||
|
switch (params_.kind) {
|
||||||
|
case InsetSpaceParams::NORMAL:
|
||||||
|
os << " ";
|
||||||
|
break;
|
||||||
|
case InsetSpaceParams::ENSKIP:
|
||||||
|
case InsetSpaceParams::ENSPACE:
|
||||||
|
os << " ";
|
||||||
|
break;
|
||||||
|
case InsetSpaceParams::QQUAD:
|
||||||
|
os << " ";
|
||||||
|
case InsetSpaceParams::THICK:
|
||||||
|
case InsetSpaceParams::QUAD:
|
||||||
|
os << " ";
|
||||||
|
break;
|
||||||
|
case InsetSpaceParams::THIN:
|
||||||
|
os << " ";
|
||||||
|
break;
|
||||||
|
case InsetSpaceParams::PROTECTED:
|
||||||
|
case InsetSpaceParams::MEDIUM:
|
||||||
|
case InsetSpaceParams::NEGTHIN:
|
||||||
|
case InsetSpaceParams::NEGMEDIUM:
|
||||||
|
case InsetSpaceParams::NEGTHICK:
|
||||||
|
os << " ";
|
||||||
|
break;
|
||||||
|
case InsetSpaceParams::HFILL:
|
||||||
|
case InsetSpaceParams::HFILL_PROTECTED:
|
||||||
|
case InsetSpaceParams::DOTFILL:
|
||||||
|
case InsetSpaceParams::HRULEFILL:
|
||||||
|
case InsetSpaceParams::LEFTARROWFILL:
|
||||||
|
case InsetSpaceParams::RIGHTARROWFILL:
|
||||||
|
case InsetSpaceParams::UPBRACEFILL:
|
||||||
|
case InsetSpaceParams::DOWNBRACEFILL:
|
||||||
|
// FIXME Can we do anything with those in HTML?
|
||||||
|
os << '\n';
|
||||||
|
break;
|
||||||
|
case InsetSpaceParams::CUSTOM:
|
||||||
|
case InsetSpaceParams::CUSTOM_PROTECTED:
|
||||||
|
// FIXME Probably we could do some sort of blank span?
|
||||||
|
os << '\n';
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetSpace::validate(LaTeXFeatures & features) const
|
void InsetSpace::validate(LaTeXFeatures & features) const
|
||||||
{
|
{
|
||||||
if (params_.kind == InsetSpaceParams::NEGMEDIUM ||
|
if (params_.kind == InsetSpaceParams::NEGMEDIUM ||
|
||||||
|
@ -129,6 +129,8 @@ public:
|
|||||||
///
|
///
|
||||||
int docbook(odocstream &, OutputParams const &) const;
|
int docbook(odocstream &, OutputParams const &) const;
|
||||||
///
|
///
|
||||||
|
int xhtml(odocstream &, OutputParams const &) const;
|
||||||
|
///
|
||||||
void validate(LaTeXFeatures & features) const;
|
void validate(LaTeXFeatures & features) const;
|
||||||
/// the string that is passed to the TOC
|
/// the string that is passed to the TOC
|
||||||
void tocString(odocstream &) const;
|
void tocString(odocstream &) const;
|
||||||
|
@ -291,6 +291,32 @@ int InsetSpecialChar::docbook(odocstream & os, OutputParams const &) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int InsetSpecialChar::xhtml(odocstream & os, OutputParams const &) const
|
||||||
|
{
|
||||||
|
switch (kind_) {
|
||||||
|
case HYPHENATION:
|
||||||
|
case LIGATURE_BREAK:
|
||||||
|
break;
|
||||||
|
case END_OF_SENTENCE:
|
||||||
|
os << '.';
|
||||||
|
break;
|
||||||
|
case LDOTS:
|
||||||
|
os << "…";
|
||||||
|
break;
|
||||||
|
case MENU_SEPARATOR:
|
||||||
|
os << "⇒";
|
||||||
|
break;
|
||||||
|
case SLASH:
|
||||||
|
os << "⁄";
|
||||||
|
break;
|
||||||
|
case NOBREAKDASH:
|
||||||
|
os << '-';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetSpecialChar::tocString(odocstream & os) const
|
void InsetSpecialChar::tocString(odocstream & os) const
|
||||||
{
|
{
|
||||||
plaintext(os, OutputParams(0));
|
plaintext(os, OutputParams(0));
|
||||||
|
@ -64,6 +64,8 @@ public:
|
|||||||
int plaintext(odocstream &, OutputParams const &) const;
|
int plaintext(odocstream &, OutputParams const &) const;
|
||||||
///
|
///
|
||||||
int docbook(odocstream &, OutputParams const &) const;
|
int docbook(odocstream &, OutputParams const &) const;
|
||||||
|
///
|
||||||
|
int xhtml(odocstream &, OutputParams const &) const;
|
||||||
/// the string that is passed to the TOC
|
/// the string that is passed to the TOC
|
||||||
void tocString(odocstream &) const;
|
void tocString(odocstream &) const;
|
||||||
///
|
///
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
#include "MetricsInfo.h"
|
#include "MetricsInfo.h"
|
||||||
#include "output_docbook.h"
|
#include "output_docbook.h"
|
||||||
#include "output_latex.h"
|
#include "output_latex.h"
|
||||||
|
#include "output_xhtml.h"
|
||||||
#include "OutputParams.h"
|
#include "OutputParams.h"
|
||||||
#include "output_plaintext.h"
|
#include "output_plaintext.h"
|
||||||
#include "paragraph_funcs.h"
|
#include "paragraph_funcs.h"
|
||||||
@ -367,6 +368,13 @@ int InsetText::docbook(odocstream & os, OutputParams const & runparams) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int InsetText::xhtml(odocstream & os, OutputParams const & runparams) const
|
||||||
|
{
|
||||||
|
xhtmlParagraphs(paragraphs(), buffer(), os, runparams);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void InsetText::validate(LaTeXFeatures & features) const
|
void InsetText::validate(LaTeXFeatures & features) const
|
||||||
{
|
{
|
||||||
for_each(paragraphs().begin(), paragraphs().end(),
|
for_each(paragraphs().begin(), paragraphs().end(),
|
||||||
|
@ -81,6 +81,8 @@ public:
|
|||||||
///
|
///
|
||||||
int docbook(odocstream &, OutputParams const &) const;
|
int docbook(odocstream &, OutputParams const &) const;
|
||||||
///
|
///
|
||||||
|
int xhtml(odocstream &, OutputParams const &) const;
|
||||||
|
///
|
||||||
void validate(LaTeXFeatures & features) const;
|
void validate(LaTeXFeatures & features) const;
|
||||||
|
|
||||||
/// return x,y of given position relative to the inset's baseline
|
/// return x,y of given position relative to the inset's baseline
|
||||||
|
Loading…
Reference in New Issue
Block a user