mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 13:18:28 +00:00
XHTML output for InsetListings.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30185 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
33c6656769
commit
51d4d42906
@ -5,14 +5,17 @@ Known issues:
|
||||
<p>, in violation of the DTD. I guess we could close the paragraph and then do
|
||||
the <hr />, but isn't there a better solution? There's actually a LyX bug here,
|
||||
I think, since a line surely ought not appear in a normal paragraph?
|
||||
* The same issue arises with InsetVSpace, unsurprisingly.
|
||||
* The same issue arises with InsetVSpace, unsurprisingly. And also with the inline
|
||||
version of InsetListings.
|
||||
* One option here, actually, would be to use just <div> and never use <p>, setting
|
||||
the spacing and such via CSS.
|
||||
* The code that manages the nesting of tags is pretty primitive. It needs a lot
|
||||
of work.
|
||||
|
||||
These insets are basically done, though there are probably issues here and there,
|
||||
and there are even some FIXMEs:
|
||||
Bibitem, Branch, Caption, Collapsable, Footnote, Hyperlink, Info, Label, Line,
|
||||
Marginal, Note, Newline, Newpage, Quotes, Space, SpecialChar, Wrap
|
||||
Listings, Marginal, Note, Newline, Newpage, Quotes, Space, SpecialChar, Wrap
|
||||
|
||||
These insets do nothing for XHTML:
|
||||
ERT, OptArg, Phantom
|
||||
@ -58,7 +61,6 @@ These do not yet work and need some attention:
|
||||
InsetInclude: I think we just want to include it, straightforwardly. Probably will
|
||||
base this more on the latex() routine, then. Another possibility, maybe with a
|
||||
flag of some sort, would be to do it as a separate file, to which we link.
|
||||
InsetListings: Probably just output it as <pre>.
|
||||
InsetRef: Presumably, this is an internal link. But what should the text be, and how
|
||||
should we get it? Probably some validation thing again, where labels tell us where
|
||||
they are. Alternatively, we could parse the aux file.
|
||||
|
@ -135,7 +135,7 @@ int InsetListings::latex(odocstream & os, OutputParams const & runparams) const
|
||||
// NOTE: I use {} to quote text, which is an experimental feature
|
||||
// of the listings package (see page 25 of the manual)
|
||||
int lines = 0;
|
||||
bool isInline = params().isInline();
|
||||
bool const isInline = params().isInline();
|
||||
// get the paragraphs. We can not output them directly to given odocstream
|
||||
// because we can not yet determine the delimiter character of \lstinline
|
||||
docstring code;
|
||||
@ -273,6 +273,37 @@ int InsetListings::latex(odocstream & os, OutputParams const & runparams) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetListings::xhtml(odocstream & os, OutputParams const & rp) const
|
||||
{
|
||||
odocstringstream out;
|
||||
|
||||
bool const isInline = params().isInline();
|
||||
if (isInline)
|
||||
out << "<br />\n";
|
||||
else {
|
||||
out << "<div class='float float-listings'>\n";
|
||||
docstring caption = getCaptionHTML(rp);
|
||||
if (!caption.empty())
|
||||
out << "<div class='float-caption'>" << caption << "</div>\n";
|
||||
}
|
||||
|
||||
out << "<pre>\n";
|
||||
docstring def = InsetText::xhtml(out, rp);
|
||||
out << "\n</pre>\n";
|
||||
|
||||
if (isInline) {
|
||||
out << "<br />\n";
|
||||
os << out.str();
|
||||
} else {
|
||||
out << "</div>";
|
||||
// In this case, this needs to be deferred, but we'll put it
|
||||
// before anything the text itself deferred.
|
||||
def = out.str() + '\n' + def;
|
||||
}
|
||||
return def;
|
||||
}
|
||||
|
||||
|
||||
docstring InsetListings::contextMenu(BufferView const &, int, int) const
|
||||
{
|
||||
return from_ascii("context-listings");
|
||||
|
@ -57,6 +57,8 @@ private:
|
||||
///
|
||||
int latex(odocstream &, OutputParams const &) const;
|
||||
///
|
||||
docstring xhtml(odocstream &, OutputParams const &) const;
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
///
|
||||
bool showInsetDialog(BufferView *) const;
|
||||
|
Loading…
Reference in New Issue
Block a user